Hello,
My problem is as following. I have a string array, If I delete last string of GprsErrors or pointer of GprsErrors, if I make const pointer. I don't get error.
I'm using some static addresses(0x20000309, 0x20000308 .....), I guess, Keil is trying to write static address so I get the following error.
Keil shows as fgetc_b.o and constant.o overlap, I didn't find the source of the problem.
what is my fault? or How can I find and solve the problem?
Thanks alot.
Kutay,
..\Output\Project.axf: Error: L6971E: fgetc_b.o(.data) type RW incompatible with constants.o(.ARM.__AT_0x20000309) type ZI in er RW_IRAM1.
char const * GprsErrors[]={ "BAUDRATE", "AT CMD", "ATE0 CMD", "BAT INIT", "PIN CODE", ..... ".....", // I'm deleting this string and I get no error(everything is ok) };
First off - think about the difference between a pointer that is const and may not have the pointer value changed, and a pointer that points to const data that may not have individual characters changed.
Secondly - you several times writes "deletes" but never show us what code you have that tries to delete any string.
Thanks for repply, Sorry, I didn't understand you exactly. I have write my problem as step by step.
const char pointer is const char array? That points const char data. When I added a string more, I'm thinking of change const data size but not pointer size. So why get I ram overlap error?
//===================================================
1) when I compile following code. I don't get any error (no const pointer, no string)
char const * GprsErrors[]={ "BAUDRATE", "AT CMD", "ATE0 CMD", "BAT INIT", "PIN CODE", };
//=================================================== 2) when I compile following code. I get as following error (no const pointer but just added a string)
char const * GprsErrors[]={ "BAUDRATE", "AT CMD", "ATE0 CMD", "BAT INIT", "PIN CODE", "IMEI OK", // I added this string };
//=================================================== 3) when I compile following code. I don't get any error again( added const pointer and string)
char const * const GprsErrors[]={ "BAUDRATE", "AT CMD", "ATE0 CMD", "BAT INIT", "PIN CODE", "IMEI OK", // I added this string };
And I'm using stm32. I have used about 30KB RAM but there is still free 10KB ram.
OK - I didn't realized you talked about deleting a string in the editor before rebuilding.
That extra "const" changes which memory region that will be used for the data. Const data can be stored in flash, while non-const initialized data needs a copy in flash that will then be copied into RW memory to allow you to modify the data during runtime. And the RW data + ZI (zero-initialized) data must fit into the available RAM you have configured for the processor.
Not sure what your project looks like when it comes to memory regions, but maybe you overflow the available RAM regions with your data. The extra 'const', means less data to store into RAM.
I'm using some static addresses(0x20000309, 0x20000308 .....)
Why are you doing that? You have some AT directive somewhere in your code or scatter file, which conveniently isn't shown?
Perhaps the problem is that when you add more data to the table the data expands, and now your rigid AT definitions overlay data that has already been committed to memory, and the linker complains. Suggest you remove them, and look at the .MAP file to see where the memory is now used on your bigger table.
If the strings are fixed, consider if "static const" would commit them to ROM/FLASH
AT directives should really be used as little as possible. They are there for solving very special problems - and being for advanced programming, they also tends to bite.
View all questions in Keil forum