We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
H, How would I declare a struct containing an array, or just an array or a struct for that matter, in Flash memory. I have read the variable placing example. But that only seems to work for simple variables. The following code just declares it in RAM.
typedef struct { int SampleList[200]; unsigned long SLi_Next; unsigned long SLi_Max; } STC_DataStorage; //As a global const STC_DataStorage Data;
Which compiler are you using? Also did you try to put an initialization for this struct. Otherwise the declaration makes no sense.
I am using the GNU GCC. I am assuming that the compiler will initialise all the variables in the struct to 0. Richard.
You may have not defined the start of the BSS section. Take a look to \Keil\ARM\GNU\Examples\Memory. This example provides a complete setup.
I have gone through the memory example. I am a little confused. According to the docs when a variable has the const keyword it will be placed in Flash. From the example snippet below, how do I define the start of the BSS section?
/* Mapped to Intialized Data Section (.data) in Internal RAM */ unsigned char FillVal = 0xff; /* Mapped to Uninitialized Data Section (.bss) in External RAM */ unsigned char Buffer[32768]; struct { unsigned short us[16]; unsigned long ul[8]; } Table;
I have tried using code from the memory example.
/* Mapped to Uninitialized Data Section (.bss) in External RAM */ unsigned char Buffer[32768]; struct { unsigned short us[16]; unsigned long ul[8]; } Table;
/cygdrive/c/Cygnus/Arm-Tools/Bin/../lib/gcc-lib/arm-thumb-elf/3.3.1/../../../../arm-thumb-elf/bin/ld: region IntRAM is full (CMU_S1.elf section .bss)