Jwan, > The compiler will not complain about the too long array. Does > this mean it does not check it and will > a) work correctly It will work correctly, thanks to 2s complement arithmetic. > b) work not correctly above the 32767 limit? In this case, it will. > c) work not correct at all? No, it'll work. I'll change the compiler to be less officious. -- Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk CrossWorks for MSP430, ARM, and (soon) Atmel AVR processors
How to define empty const in self defined flash segment?
Started by ●September 27, 2004
Reply by ●September 28, 20042004-09-28
Reply by ●September 28, 20042004-09-28
Paul, > > Hence, you cannor have an array with more > than > > 32767 elements on an MSP430. > > Ok, I did not know about this limit set by the ANSI standard. > Also, I must have had a typo somewhere at the end of a constant > placement. The initialized structs are all in place now. > > I tried to compile two different things: > > #pragma zeroedseg("FLASHDATA") > const signed long flash_array[10000]; > #pragma zeroedseg(default) > > this should require 40000 byte as size of long is 4. The compiler does > this without any complaint. > > #pragma zeroedseg("FLASHDATA") > const struct { > const unsigned char name[6]; > const unsigned char recordingMode; > const unsigned char recordedVariable; > const unsigned short switchConfig; > const signed short voltageA; > const signed short voltageB; > const unsigned short dataLength; > const signed long data[10000]; > } dataFile; > #pragma zeroedseg(default) > > this will produce the error: > "size of 'struct 5' too big" > > I can see that the index within the struct exceeds 32767 bytes. The > single array does so as well!?! The compiler will not complain about the too long array. Does this mean it does not check it and will a) work correctly b) work not correctly above the 32767 limit? c) work not correct at all? Thanks in advance! -Jean-
Reply by ●September 28, 20042004-09-28
Thanks a lot, Paul! Right now I am using @ to place the variables at specific addresses and keep a segment of the same size to reserve the space in flash. This way I know exactly where and it which order I can find the variables at runtime. Regards, -Jean- ------------------------ http://msp430.info