2019-04-02 06:14 AM
I changed linker to use all of these three memories in domain D2. Problem is next :
When i put for example
uint32_t tempArray[4] = {0x2B7E1516 ,0x28AED2A6 ,0xABF71588 ,0x09CF4F3C} __attribute__((section(".sram1")));
this line in my code, when MCU is in debug mode firstly on address of this array i see all zeroes. After calling __HAL_RCC_TIM2_CLK_ENABLE() macro, i can see data in those sram's but it is wrong initialized (random data).
Am I missing something? I read thru all documents RF, DS, AN's but neither one says that this memory is something specific. I used this part's of memory as DMA buffers for SDMMC2 and everything is working fine. Only problem is in initialized data.
I tried same code - just changed section to AXISRAM and everything is working as expected. So not problem in code.
Thanks
Solved! Go to Solution.
2019-04-02 06:20 AM
You must enable the RAM clocks, and modify your startup code to deal with multiple section initialization, GNU/GCC does a crap job at this. Keil has table driven initialization which works properly/effectively for embedded.
I posted code to start SRAM clocks in Reset_Handler, will go dig for it.
2019-04-02 06:20 AM
You must enable the RAM clocks, and modify your startup code to deal with multiple section initialization, GNU/GCC does a crap job at this. Keil has table driven initialization which works properly/effectively for embedded.
I posted code to start SRAM clocks in Reset_Handler, will go dig for it.
2019-04-02 06:22 AM
2019-04-02 06:23 AM
Are you sure the SRAM1 is active when the startup script is copying your data from flash into there?
Edit: Clive was faster and with more information (:
2019-04-02 06:28 AM
You appear to be my doppelganger
2019-04-02 06:31 AM
Each compiler has a kind of startup() function to initialize the default values in RAM.
If the linker can't do properly the intialisation (because a clock enable is required prior to write to memory) or else, the RAM maybe random or previous hot reset values. In this case, to initialize from const to RAM by memcpy(), which was the service the statup was doing for you when ram were simple.
2019-04-02 06:32 AM
I am not sure, and i see that clocks aren't enabled :) but didn't know where to put it. Thanks @Community member for fast response. I will post results.
2019-04-02 06:39 AM
@Community member @After Forever thanks both for quick reply. I added lines in SystemInit and everything OK.
Fast fast community :)
Best regards
2019-04-02 06:45 AM
That, my friend, would be an honour, but realistically, nobody here can compete with your consistency and knowledge (and your experience with Demogorgons) (: