Hi Ken, in addition to the already given suggestion to use -Os optimisation for size-optimized code generation, I want to give some background information about the 'why':
"region text is full" the region 'text' holds the code. It needs to be placed in flash. Also, the region 'data' and the region 'vectors' are placed in flash. 'vectors' is located at the end of the flash area and contains the interrupt vector table. 'data' and 'text' share the region from beginning of flash to the beginning of the vector table. In your case, the code is so large that it does not fit into the available flash space. It extends to the vectors section and beyond. And leaves no more room for the data section too. 'data' is only virtually placed in flash. At runtime, it is located in the ram area, but to allow initialisation of your variables, a 'master copy' of the initialized data section mus tbe placed in flash too. This is why text and data overlap while the memory mappings list shows that they are at completely different locations. You should not initialize global variables which do not need to be initialized or are initialized with 0. Those variables without explicit initialisation are placed in a different section which does not need to have a 'master copy' in flash. Their area is simply nulled at startup (so they are auto-initialized with 0) and you save some flash space. >From the error messages below you can extract: vector segment size is 32 bytes (0xffe0-0xffff) (always this size and this location). data segment 'master copy' size is 43 bytes (0xf000-0xf02b) (you have 43 bytes of initialized variables) text segment code size is 0x100fb bytes (0xf000-0x100fb) But the available flash is only 0x1000 bytes, so the text section and therefore your code is 102 bytes too large. The given suggestion to use the -Os compiler setting instructs the compiler to do some space-saving optimisations. This may include using function calls rather than inlining code, don't do loop-unrolling, eliminate apparently useless code (such as delay loops) and other things. This might very well shrink your code by some 100 bytes, but may also make the code slightly slower. Or even break it (e.g. if you used a for loop for delay purposes, which is already listed in the mspgcc docs as a no-go) JMGross. ----- Ursprüngliche Nachricht ----- Von: Ken Otto An: [email protected] Gesendet am: 02 Jun 2010 04:07:44 Betreff: [Mspgcc-users] Overlapping sections I am working on a project that uses a MSP430F1122/MSP430F1222. When I compile the project, I get the following messages: msp430-gcc main.o rx.o -mmcu=msp430x1222 -W1 -o ACMC.elf c:\Program Files\mspgcc\bin\..\lib\gcc-lib\msp430\3.2.3\..\..\..\..\msp430\bin\ld.exe: region text is full (ACMC.elf section .text) c:\Program Files\mspgcc\bin\..\lib\gcc-lib\msp430\3.2.3\..\..\..\..\msp430\bin\ld.exe: region text is full (ACMC.elf section .text) c:\Program Files\mspgcc\bin\..\lib\gcc-lib\msp430\3.2.3\..\..\..\..\msp430\bin\ld.exe: section .vectors[0000FFE0->0000FFFF] overlaps section .text[0000FFFF->000100FB] c:\Program Files\mspgcc\bin\..\lib\gcc-lib\msp430\3.2.3\..\..\..\..\msp430\bin\ld.exe: section .text[0000F000->000100FB] overlaps section .data[0000F000->0000F02B] make: *** [ACMC.elf] Error 1 These are the memory mappings for this mcu: text F000->FFDF data 0200->02FF vectors FFE0->FFFF Any help would be appreciated. Thanks, Ken
