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.
Hi,
I have the following BIG structure:
typedef struct { BYTE c_re[3]; int c_gnrl; float c_time[2]; BYTE c_cmm[13]; int c_cmm_p[2]; BYTE c_ext[10]; int c_ext_p[10]; int c_stp[50][3]; int m_gnrl[100][10]; float m[100][22]; float m_e[100][22]; float s_clb_[10]; int an[100][22]; }pthm; pthm test; void main() { test.an[0][0] }
The problem is quite obvious, its too big. How can I make sure it doesn't consume the ZI-data memory?
kind regards, Wim
But Flash is essentially Read-Only - isn't it?
Yes,
but can I change that?
No. Only the manufacturer can rebuild the processor into replacing the flash with R/W memory (EEPROM, FRAM or similar). But such a processor will be more expensive which is the reason it doesn't have directly writeable non-volatile memory instead of the flash region in the first place.
The flash memory in the LPC2368 is writeable, but only after erasing full sectors and only by using special monitor commands. Because of this, it does not qualify as R/W memory where the compiler can generate direct write instructions for updating variables.
A variable needs to be in a memory region where the processor can change (vary) the value with normal write instructions.
A constant can be placed into the code segment, since it is never modified.
It doesn't matter if you say that your program isn't so large. Your data structure definitely is large in relation to the amount of RAM in your selected processor. You always have to define small/large based on the available resoures.
Look at it this way: you could, in principle, change a car into a truck - but it would be a whole lot easier to just buy a truck if that's what you need!