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.

CCS/MSP430F5419A: Getting started with large memory model

Part Number: MSP430F5419A

Tool/software: Code Composer Studio

My code size just reached the point where I need to use the large memory model.

I am using GCC GNU v5.3.0.219. on Code Composer Studio Version: 6.2.0.00050 (Linux)

Are there any examples or tutorials on how to switch to the large memory model with the GCC tools?

I added -mlarge flag to the compiler and linker.

I am still getting:

/opt/ti-6.2.0/ccsv6/tools/compiler/gcc_msp430_5.3.0.219/bin/../lib/gcc/msp430-elf/5.3.0/../../../../msp430-elf/bin/ld: xxxx.out section `.text' will not fit in region `ROM'
/opt/ti-6.2.0/ccsv6/tools/compiler/gcc_msp430_5.3.0.219/bin/../lib/gcc/msp430-elf/5.3.0/../../../../msp430-elf/bin/ld: section __interrupt_vector_45 loaded at [0000ffd8,0000ffd9] overlaps section .text loaded at [00007008,00011f5b]
/opt/ti-6.2.0/ccsv6/tools/compiler/gcc_msp430_5.3.0.219/bin/../lib/gcc/msp430-elf/5.3.0/../../../../msp430-elf/bin/ld: region `ROM' overflowed by 8156 bytes

Also, what is the correct way to configure hardware registers such as DMAxDA and DMAxSA that hold addresses?

I tried:

char myBuffer[10];
__data16_write_addr((unsigned short) &DMA1SA, (unsigned long) myBuffer);

and I am getting 

warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

Thanks

  • Show the complete compiler/linker command lines.
  • Building file: ../main.c
    Invoking: GNU Compiler
    "/opt/ti-6.2.0/ccsv6/tools/compiler/gcc_msp430_5.3.0.219/bin/msp430-elf-gcc" -c -mmcu=msp430f5419a -I"/opt/ti-6.2.0/ccsv6/ccs_base/msp430/include_gcc" -I"/opt/ti-6.2.0/ccsv6/tools/compiler/gcc_msp430_5.3.0.219/msp430-elf/include" -Os -g -gdwarf-3 -gstrict-dwarf -Wall -mhwmult=f5series -mlarge -MMD -MP -MF"main.d" -MT"main.o" -o"main.o" "../main.c"
    ../main.c: In function 'main':
    ../main.c:89:28: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    memset(&__bssstart, 0x31, (u16)&__stack - (u16)&__bssstart - 30);
    ^
    ../main.c:89:44: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    memset(&__bssstart, 0x31, (u16)&__stack - (u16)&__bssstart - 30);



    Building target: uec100a.out
    Invoking: GNU Linker
    "/opt/ti-6.2.0/ccsv6/tools/compiler/gcc_msp430_5.3.0.219/bin/msp430-elf-gcc" -mmcu=msp430f5419a -Os -g -gdwarf-3 -gstrict-dwarf -Wall -mlarge -Wl,-Map,"uec100a.map" -L"/opt/ti-6.2.0/ccsv6/ccs_base/msp430/include_gcc" -mmcu=msp430f5419a -mlarge -o"uec100a.out" "./adc.o" "./button.o" "./debugPrint.o" "./disp.o" "./dispPrint.o" "./flash.o" "./frontPanel.o" "./hart.o" "./hartVars.o" "./hdlc.o" "./leds.o" "./main.o" "./modem.o" "./modemL2.o" "./modemMessages.o" "./radio.o" "./radioJoin.o" "./radioL2.o" "./radioMessages.o" "./serialGasSensor.o" "./stubs.o" "./timer.o" "./utils.o" -T"../msp430f5419a.ld" -Wl,--start-group -lgcc -lc -Wl,--end-group
    makefile:163: recipe for target 'uec100a.out' failed
    /opt/ti-6.2.0/ccsv6/tools/compiler/gcc_msp430_5.3.0.219/bin/../lib/gcc/msp430-elf/5.3.0/../../../../msp430-elf/bin/ld: uec100a.out section `.text' will not fit in region `ROM'
    /opt/ti-6.2.0/ccsv6/tools/compiler/gcc_msp430_5.3.0.219/bin/../lib/gcc/msp430-elf/5.3.0/../../../../msp430-elf/bin/ld: section __interrupt_vector_45 loaded at [0000ffd8,0000ffd9] overlaps section .text loaded at [00007008,00011f47]
    /opt/ti-6.2.0/ccsv6/tools/compiler/gcc_msp430_5.3.0.219/bin/../lib/gcc/msp430-elf/5.3.0/../../../../msp430-elf/bin/ld: region `ROM' overflowed by 8136 bytes
    collect2: error: ld returned 1 exit status
    gmake: *** [uec100a.out] Error 1
    gmake: Target 'all' not remade because of errors.
  • The GCC 6 changelog says

    The MSP430 compiler now has the ability to automatically distribute code and data between low memory (addresses below 64K) and high memory.

    This would imply that your GCC 5.3 does not yet have this ability.

    Anyway, MSP430 GCC automatic code splitting between low and far rom? says that it is supported since 4.9, and that you have to use the -mcode-region=either option.

  • Thanks!!!!! That worked!!

    Can you also help me with the correct way to initialize special function registers with address values:
    I tried
    char myBuffer[10];
    __data16_write_addr((unsigned short) &DMA1SA, (unsigned long) myBuffer);

    and I am getting

    warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  • In the large memory model, pointers have more than 16 bits. The compiler complains because you are casting such a pointer to an "unsigned short" value (it doesn't know that DMA1SA is at a low address).

    But you don't need that helper function, you should be able to write "DMA1SA = (uintptr_t)myBuffer;".
  • Thanks!!!
    My project is now running in the large memory model!!

**Attention** This is a public forum