Hi,
I am using TWR-K60N512, with PK60DN512Z VMD10 chip and Codewarrior 10.5. I definitely have issues with the size of my code, I have about 50 source and header files in my source folder. About half of them are freemaster stuff, so I won't modify that.
I'm wondering if anybody could:
1) Show me how to increase the maximum allowable code size, if at all possible, for baremetal projects .
2) Tell me if there's a way to display the part of my baremetal project code that is taking up too much memory so I can optimize it accordingly.
Here's the error I received:
c:/freescale/cw mcu v10.5/cross_tools/arm-none-eabi-gcc-4_7_3/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/bin/ld.exe: i2c.elf section `.text' will not fit in region `m_text'
c:/freescale/cw mcu v10.5/cross_tools/arm-none-eabi-gcc-4_7_3/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/bin/ld.exe: section .data loaded at [20000000,2000019b] overlaps section .text loaded at [1fff01e0,20001507]
c:/freescale/cw mcu v10.5/cross_tools/arm-none-eabi-gcc-4_7_3/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/bin/ld.exe: region `m_text' overflowed by 5384 bytes
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [i2c.elf] Error 1
I have also attached a file with '.ld' format, which has some memory info for your reference.
Thanks.
Original Attachment has been moved to: PK60N512_ram.ld.zip
Solved! Go to Solution.
For 1) The allowed code size depends on your microcontroller (amount of on chip FLASH memory). The 512 variant has 512 KByte, so if you really need more, you need a bigger device with more FLASH. But what you could do otherwise is to turn on code size optimization in the compiler settings, this should reduce your code size by a bit.
For 2) You can report the code/data size for each object file, see https://mcuoneclipse.com/2014/07/13/listing-code-and-data-size-for-each-source-file-with-gnu-and-ecl...
I hope this helps,
Erich
For 1) The allowed code size depends on your microcontroller (amount of on chip FLASH memory). The 512 variant has 512 KByte, so if you really need more, you need a bigger device with more FLASH. But what you could do otherwise is to turn on code size optimization in the compiler settings, this should reduce your code size by a bit.
For 2) You can report the code/data size for each object file, see https://mcuoneclipse.com/2014/07/13/listing-code-and-data-size-for-each-source-file-with-gnu-and-ecl...
I hope this helps,
Erich
Thank you, Sir! I turned on the code size optimization option and it reduced my codes size significantly!