2020-02-13 08:03 AM
Hello,
I am relatively new in this field, and need assistance for my project at work.
Recently, in order to have more RAM, I switched from STM32F4 to STM32H7.
I saw that STM32H7 has 1MB of RAM, and decided to base our system on this MCU.
However, after compiling my code, I see that only DTCM RAM is used by the MCU and others are not used.
The DTCM RAM is now full and I can not move any further with my code.
How can I make use of RAM_D1 or RAM_D2 for my variables?
I am using CubeMX and Atollic Truestudio.
Please kindly help me as this is vital for my work. Any help is greatly appreciated.
Solved! Go to Solution.
2020-02-18 01:26 PM
My earlier posts had been inaccurate and I've edited them again.
Don't not use DTCM-RAM at all. It's your fastest memory.
If your app initializes .data and zeros .bss correctly in AXI-SRAM and crashes later, it suggests some other problem may be the cause.
You need to isolate the cause.
Hard fault? Some good information's at https://www.freertos.org/Debugging-Hard-Faults-On-Cortex-M-Microcontrollers.html and in many posts to Community.
Otherwise, load the app in the debugger and step until it crashes. Remember where, debug again. Iterate, each time getting closer. If the problem's complex, instrument the code to catch states, events or anything helpful. If the problem's simple, sometimes just stopping the debugger while the app's crashed is enough.
2020-02-25 08:23 AM
I was reading my linker file more carefully, and realised that mine has no AXI_SRAM_D1.
Instead I have SRAM_D1 which is 512k, could this be the reason why my code stops working when I bring .bss, stack, and data to SRAM_D1?
Thank you in advance for your help.
Best regards,
Vouria
2020-02-25 01:44 PM
Atollic TrueSTUDIO uses GNU toolchain. GNU linker is described at https://sourceware.org/binutils/docs/ld/index.html. GCC compiler is described at https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html. These links are their head doc versions. TrueSTUDIO 9.3.0 uses "GCC 6.3.1 20170215 + patches" and "Binutils 2.27.90.20170215". If you hunt around a bit you'll find earlier version docs closer to your tools. But these'll serve for most matters.
>mine has no AXI_SRAM_D1.
The question is quickly answered in the section in the linker doc about the MEMORY command.
>my code stops working when I bring .bss, stack, and data to SRAM_D1
It'd be much easier to help if you provided more details. In no particular order...
A general practice for debugging...
2020-02-26 02:00 AM
Hello,
Thank a lot for this complete answer. I will go through the links regarding the GNU linker and the GCC compiler. These are very good to learn, in order to improve my knowledge. I am using TrueSTUDIO 9.3.0.
Thanks very much for the suggestions regarding debugging, and fault finding in the code. These are very useful for me, cause I am really new in this field, and normally under much pressure from my work cause I do not yet know my way around things.
Yesterday, I used the memory map and the suggestions here to make changes in the linker file. I brought .bss to the RAM_D1 and left the rest as it is. Now the program is working fine.
I think the problem was that I brought heap and stack into the RAM_D1. Now I left heap and stack to be in DTCMRAM.
Thank a lot for your help.
Best regards,
Vouria