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.

Large Memory Model Linking Issue

Other Parts Discussed in Thread: MSP430F67791

I am wondering why the "#ifdef __LARGE_DATA_MODEL__" inside an unmodified linker command file seems to be ignored during link.  If I use the unmodified command file, .cinit and .const are placed in FLASH and the link dies.  If I modify the file so that .cinit and.const are placed in FLASH | FLASH2 regardless of the definition of __LARGE_DATA_MODEL__  everything works fine.   Thanks!

I am building code for an MSP430F67791 using CCS  Version: 5.5.0.00077 with compiler v4.2.3, and have selected everything I can find that would produce a large model image.

My compiler options look like this:

-vmspx --abi=eabi --code_model=large --data_model=large --near_data=none -O2 --include_path="/opt/ti/ccsv5/ccs_base/msp430/include" --include_path="/home/xxxx/code/eclipse_workspace/ufd/driverlib/MSP430F5xx_6xx" --include_path="/opt/ti/ccsv5/tools/compiler/msp430_4.2.3/include" -g --define=__MSP430F67791__ --diag_warning=225 --display_error_number --diag_wrap=off --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU40 --large_memory_model --printf_support=full


My linker options look like this:

-vmspx --abi=eabi --code_model=large --data_model=large --near_data=none -O2 -g --define=__MSP430F67791__ --diag_warning=225 --display_error_number --diag_wrap=off --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU40 --large_memory_model --printf_support=full -z -m"ufd.map" --heap_size=160 --stack_size=160 --use_hw_mpy=F5 -i"/opt/ti/ccsv5/ccs_base/msp430/include" -i"/opt/ti/ccsv5/tools/compiler/msp430_4.2.3/lib" -i"/opt/ti/ccsv5/tools/compiler/msp430_4.2.3/include" -i"/opt/ti/ccsv5/ccs_base/msp430/lib" --reread_libs --warn_sections --display_error_number --diag_wrap=off --xml_link_info="ufd_linkInfo.xml" --rom_model

  • JayTee said:
    I am wondering why the "#ifdef __LARGE_DATA_MODEL__" inside an unmodified linker command file seems to be ignored during link

    Using CCS 5.5.0.00077 and MSP430 compiler v4.2.3 as far as I can tell the #ifdef __LARGE_DATA_MODEL__ is applied. By generating syntax errors in either of the #ifdef or #else paths found that when the --large_memory_model linker option is used the symbol __LARGE_DATA_MODEL__ is defined and the #ifdef path is used by the linker.

    JayTee said:
    If I use the unmodified command file, .cinit and .const are placed in FLASH and the link dies.

    What error are you getting - maybe the problem is MSP430 linker reports "error #10099-D: program will not fit into available memory" even when there is space

    [At the time I created the referenced thread using CCS 5.2 and MSP430 compiler v4.1.2 the conditional compilation inside the linker command files was commented out as it wasn't supported - but based upon my testing CCS 5.5 and  MSP430 compiler v4.2.3 supports the conditional compilation in the linker command files]

  • Chester Gillon said:
    Using CCS 5.5.0.00077 and MSP430 compiler v4.2.3 as far as I can tell the #ifdef __LARGE_DATA_MODEL__ is applied. By generating syntax errors in either of the #ifdef or #else paths found that when the --large_memory_model linker option is used the symbol __LARGE_DATA_MODEL__ is defined and the #ifdef path is used by the linker.

    I tried the same thing, changing the linker file thus:

    #ifdef __LARGE_DATA_MODEL__
    if that is truly defined this will fail
        .cinit      : {} > FLASH | FLASH2     /* INITIALIZATION TABLES             */
        .const      : {} > FLASH | FLASH2     /* CONSTANT DATA                     */
    #else
        .cinit      : {} > FLASH              /* INITIALIZATION TABLES             */
        .const      : {} > FLASH              /* CONSTANT DATA                     */
    #endif

    This produces no syntax error, just the usual error #10099-D

    If I do this:

    //#ifdef __LARGE_DATA_MODEL__
        .cinit      : {} > FLASH | FLASH2     /* INITIALIZATION TABLES             */
        .const      : {} > FLASH | FLASH2     /* CONSTANT DATA                     */
    //#else
    //    .cinit      : {} > FLASH              /* INITIALIZATION TABLES             */
    //    .const      : {} > FLASH              /* CONSTANT DATA                     */
    //#endif

    It works!

  • JayTee said:
    Using CCS 5.5.0.00077 and MSP430 compiler v4.2.3 as far as I can tell the #ifdef __LARGE_DATA_MODEL__ is applied. By generating syntax errors in either of the #ifdef or #else paths found that when the --large_memory_model linker option is used the symbol __LARGE_DATA_MODEL__ is defined and the #ifdef path is used by the linker.

    I tried the same thing, changing the linker file thus[/quote]Looking back at my test project the information I gave was wrong - the --large_memory_model doesn't cause the symbol __LARGE_DATA_MODEL__ to be defined. I had been trying different options and had left a linker predefined symbol set:

    Is predefining __LARGE_DATA_MODEL__ a suitable work-around for you?

    [it's a hack since have to remember to predefine the linker macro as well as setting the compiler memory model options]

  • That did it for me - thanks very much.

**Attention** This is a public forum