Altera_Forum
Honored Contributor
16 years agoHow can I allocate a variable to a specific section?
I want a variable to be allocated in the on-chip RAM. I have all sections
(.text, .rodata, .rwdata, .heap, and .stack) in DDR2_SDRAM in the auto-generated linker script. I define a global variable "rawVideo" as I have seen in many examples: --- Quote Start --- int rawVideo __attribute__ ((section (".onchip_ram_100Kbytes.rwdata"))); --- Quote End --- where the on-chip is specified in the system.h:onchip_ram_100kbytes_name "/dev/onchip_ram_100kbytes" Then I copy some data from the flash device to it: --- Quote Start --- alt_read_flash( flash, offset, (void*) ( &rawVideo ), size); --- Quote End --- but the program execution suspends with error when applying the reading command! I made sure that the on-chip RAM size fits on the copy. So am I allocating the variable in a non-existed section or using a wrong syntax?