This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR5994: Increasing code size in linker file

Part Number: MSP430FR5994

Hi, I am using the below linker file with msp430 command line tools to build the code. My code size is overflowing by 3KB. Is there a way to move the vector table to HIFRAM to expand the code location?

Any other way of fitting in large code size? 

Error:

/opt/ti/mspgcc/bin/../lib/gcc/msp430-elf/7.3.2/../../../../msp430-elf/bin/ld: adnn.out section `.text' will not fit in region `ROM'

/opt/ti/mspgcc/bin/../lib/gcc/msp430-elf/7.3.2/../../../../msp430-elf/bin/ld: section __reset_vector loaded at [000000000000fffe,000000000000ffff] overlaps section .text loaded at [0000000000005bc0,0000000000010ce7]

/opt/ti/mspgcc/bin/../lib/gcc/msp430-elf/7.3.2/../../../../msp430-elf/bin/ld: region `ROM' overflowed by 3432 bytes

The linker script: https://github.com/CMUAbstract/maker/blob/5d58fdd629ef68e544dc0b1d2bd59d24df722163/linker-scripts/gcc-7/msp430fr5994.ld

  • Hi,

    Generally, the address of the vector table is fixed and must not be moved. Also, interrupt functions must be located in lower memory (below address 0x10000), since entries in the vector table are only 16-bits in size.

    That error message just means that the .text section, which is located between addresses 0x5BC0 and 0x10CE7, overlaps the vector table which is normally between 0xFF80 and 0xFFFF.

    So we need to make the .text section smaller, or split it up into smaller chunks.

    You can try the following options:

    • -Os: tell the compiler to optimize  for size
    • -ffunction-sections - this will put individual functions in their own sections, so the sections can be placed with finer granularity (see also -fdata-sections)
    • -mlarge and -mcode-region=either - "-mlarge" will enable the large memory model, which allows functions and data to be placed in the upper memory region at or above address 0x10000. -mcode-region=either will enable "shuffling" of the sections between upper and lower memory so the program fits.

    You'll get smaller code size overall with the latest MSP430-GCC 8.2.0.52 release. I would also recommend using the latest linker scripts (from msp430-gcc-support-files.zip) if you are going to use this version. Both are available here: http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/latest/index_FDS.html

    See also section 4.9 of the MSP430-GCC User Guide (slau646) for further details on reducing code size.

**Attention** This is a public forum