DSY_SDRAM_DATA stored in SRAM

I just noticed that DSY_SDRAM_DATA seems to not store in SDRAM, it just stores it in SRAM. I’m implementing a FIR filter and storing a bunch of IR arrays. If I do something like:

float DSY_SDRAM_DATA ir_flat[] = {1,2,3....};

it ends up identical to:

float ir_flat[] = {1,2,3....};

if I do

float DSY_SDRAM_BSS ir_flat[] = {1,2,3....};

it is properly allocated in sdram space (though of course not initialized)

ir_flat is a global variable.

Any ideas on this?
Thanks!

You should take a look at this comment

2 Likes

Close, but I’m loading from QSPIFLASH (tried the hack subbing “> QSPIFLASH” for “> FLASH” in the linker, and the usage info looks correct, but it doesn’t initialize the data properly (or at all).

.data section is filled in startup file, so you would have to do the same for variables used in SDRAM section. I.e. add a copy of that section using _esdram in place of _edata and so on.

This obviously can work if SDRAM is already initialized, which can only be done if bootloader did it as firmware can do it only at a later time when main() gets called.

2 Likes

Ah, that did it! Thank you! Maybe this should be part of the next release.

2 Likes

just wondering how to use the qspiflash hack. I see the line > SDRAM AT >FLASH but when I change that to QSPIFLASH my code won’t upload

with this error

Info : flash size probed value 128k
Info : STM32H7 flash has a single bank
Info : Bank (0) size is 128 kb, base address is 0x08000000
Info : Padding image section 1 at 0x0801269c with 4 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x080126a0 .. 0x0801ffff
Warn : no flash bank found for address 0x90000000
** Programming Finished **
** Verify Started **
Error: error executing cortex_m crc algorithm
** Verify Failed **
shutdown command invoked

make: *** [program] Error 1