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.

CL430 linker : Link-Time Optimization (--opt_level=4 Option) does nothing

Other Parts Discussed in Thread: MSP430F5438A

I've got numeous files (.c) compiled separatlyy with --opt_level = 3.

I've read in slau132i.pdf chapter 3.4 and i hope that compiling and linking with opt_level=4 could bring me new optilmizations (I'm looking for Flash size reduction).

But two problems:

1)  "-opt_level=4" on link command raises an error: See "LINK LOG" below

2) I tried "-O=4" instead of "-opt_level=4", then it works. But, the remaining free flash size is exactly the same than when i compile all my sources with -opt_level=3 and link with no optimization.


Any idea welcome,

Thanks

LINK LOG:

cl430 --run_linker --map_file=contiki-wtc-298-tic.map --stack_size=0x0350 --heap_size=0x0205 --use_hw_mpy=F5 --warn_sections -I C:/Program\ Files/Texas\ Instruments/ccsv4/msp430/include -I C:/Program\ Files/Texas\ Instruments/ccsv4/tools/compiler/msp430/include -I C:/Program\ Files/Texas\ Instruments/ccsv4/tools/compiler/msp430/lib --reread_libs --rom_model   obj_wtc-298-tic/pre_init.o  obj_wtc-298-tic/boot.o  ips-tic.co contiki-wtc-298-tic.a --library=C:/Program\ Files/Texas\ Instruments/ccsv4/tools/compiler/msp430/lib/rts430xl.lib C:/Program\ Files/Texas\ Instruments/ccsv4/msp430/include/lnk_msp430f5438a.cmd  obj_wtc-298-tic/ips-tic-tic-management.o obj_wtc-298-tic/ips-tic-uart-management.o obj_wtc-298-tic/ips-tic-leds-management.o --opt_level=4
<Linking>
>> WARNING: more than one source file is specified; option --output_file is ignored
[_level=4.]
Fatal error: could not open source file "_level=4"
1 fatal error detected in the compilation of "_level=4".
Compilation terminated.

>> Compilation failure

>> Compilation failure
fatal error: Failed linktime optimization

>> Compilation failure

  • Optimization in CCS v4 works totally different than in v6, why you are not first updating to v6 and use EABI.

    And in v4 stay away from optimization level 4, max 2-3.

  • Thanks for your first answer.

    However, it may be difficult for me to make step to CCSV6...

    My build process is fully independant from CCS (I'm using Contiki framework). I'm affraid to have big work to do passing vrom ccsv4.3 to v6 (I'm mainly using cl430 and Debug tools with MSP430FET.

    Do you have any idea about this complexity and the price to get from v4.3 to v6 ?

    Otherwise, I will follow your advice not using level 4 optimization, But is there any "publication" talking about this advice to avoid level 4 with ccsV4.3 ?

  • You can download and install a new, free version of CCS into a separate directory (goes automatically) and so keeping your v4 working.

    Create a new workspace for v6 and import your project there. It may happen that you get some problems with the old project in v6, then start with creating a new Configuration.

  • Will I be able to COMPILE and DEBUG with CCSv6 Free version, for a quite big project (100Ko resulting binary), at least for a try ?

  • The free version is normally limited in size but you can activate a full version for 90 days. 

  • As you've suggested, I tried to install ccsV6 and use cl430 v4.3.3 in my build process (usually running under cygwin). However I've immedialy an issue regarding path processing.

    It seems that the compiler does not accept anymore "mixed separators" in pathes (mainly for "-I" parameter). ie:

    does not interprete correctly : -IC:\TICCSv6\ccsv6/tools/compiler/msp430_4.3.3/include and this either on cywin shell or windows command shell.

    Notice that cygwin shell does not accept this neither while windows commad shell accept it :-IC:\TICCSv6\ccsv6\tools\compiler\msp430_4.3.3\include


    Any idea ?

     

  • First why not using the latest compiler version 4.3.5?

    I don’t have experience with cygwin, search the ‘Development Tools’ forum.

    As I remember mixing ‘\’ and ‘/’ gives problems, also one is only valid under Unix and the other under Windows, try which one you have to use.

  • Leo Bosch said:
    First why not using the latest compiler version 4.3.5?

    Only because it was the one installed with ccsv6 webinstall...?

    About mixing or using '/' or '\', it use to work very well with with previous cl430 (enbeded in ccsv4), could it be possible that a specific option would accept them ?

  • Ok It seems that I'm OK with my pathes now. (All UNIX like even if compiling on a windows computer ;O)


    BUT: As i Want to try size optimization on my project regarding opt_level 4 I would like compilation to terminate correctly. However it seems that wit the ccsv6 I've download "rts430xl.lib" does not exist. Where could I find it ?


    In advance thanks.

  • Select output format EABI, select for the Runtime support either Automatic or one of the RTS430_xx_eabi.

    For Optimization you can select ‘View/Optimizer Assistant’ and Run this.

  • I've only got "rts430x_lc_rd_eabi.lib", "rts430x_lc_sd_eabi.lib", or "rts430x_eabi.lib", will one of this will support the "large data" "large code" models, that needs my project.


    NOTICE: I'm not using CSS to compile but a specific build chain ... Then :

    how can i specify cl430 linker command to use automatic runtime support ?

    If I need to compile "large code", "large data" don't you think that "rts430x_lc_ld_eabi.lib" will be missing ?

  • The Runtime support uses only Small Data or Restricted Data (rd), your particular data can be set to Large.

    Most of the options in CCS only applies to CCS, if you want to control cl430 manually read the manual SLAU131.

  • Correction: Particular data must match Runtime support size.

  • I'm efectively struggling with SLAU131 and SLAU123i .... ;O)

    But maybe I should ask my first question this way :

    Can I expect a flash/ram beter compacity when compiling (EABI or not) with cl430 v4.3 (from CCSv6), than I have today with cl430 v3.3 (from CCSV4) ? (I try to use same opt_level=3 in both cases)

  • If you would use CCS to compile and using Large data model and Runtime support is Automatic it will create the library for you.

  • peg said:
    Can I expect a flash/ram beter compacity when compiling (EABI or not)

    When using EABI absolutely!

    peg said:
    I try to use same opt_level=3 in both cases

    Level 3 in CCSv4 isn’t the same as Level 3 in CCSv6.

  • I finally succeded in making my build process with cl430 v4.3 (ccsv6) compiling all sources separatly with "--abi=EABI", "--opt_level=4" and link with "-O4" as the "--opt_level=4" raises an error (as shown by the end of the post).

    BUT my full software compiled with cl430 v3.3(ccsv4) with opt-level=3 stay smaller (30 Kb less !!) than same sources compiled with

    Why is it SO bigger (ccsv4 : about 70Kb flash, ccsv6/EABI: about 100 Kb) ?

    How could I verify that "Linker-optimization" really occures ?

    ERROR with : --opt_level=4 at link time

    cl430 --run_linker --map_file=contiki-wtc-294-ips.map --stack_size=0x0350 --heap_size=0x0205 --use_hw_mpy=F5 --warn_sections --opt_level=4 -I C:/TICCSv6/ccsv6/ccs_base/msp430/include -I C:/TICCSv6/ccsv6/tools/compiler/msp430_4.3.3/include -I C:/TICCSv6/ccsv6/tools/compiler/msp430_4.3.3/lib --reread_libs --rom_model   obj_wtc-294-ips/pre_init.o   --output_file=ips-temperature.wtc-294-ips ips-temperature.co contiki-wtc-294-ips.a --library=C:/TICCSv6/ccsv6/tools/compiler/msp430_4.3.3/lib/rts430x_lc_rd_eabi.lib C:/TICCSv6/ccsv6/ccs_base/msp430/include/lnk_msp430f5438a.cmd
    <Linking>
    >> WARNING: more than one source file is specified; option --output_file is ignored
    [_level=4.]
    Fatal error: cannot open source file "_level=4"
    1 catastrophic error detected in the compilation of "_level=4".
    Compilation terminated.

    >> Compilation failure

    >> Compilation failure
    fatal error: Failed linktime optimization

  • SORRY !


    In fact the flash occupation is few bigger: 1Kb with ccsv6/EABI not 30 Kb !!


    I found that big part (28 Kb) of first 64K flash is not used ! With ccsv4 this first part of 64K Flash is always full.


    BUT still it's not smaller with ccsv6 !

  • peg said:
    I found that big part (28 Kb) of first 64K flash is not used ! With ccsv4 this first part of 64K Flash is always full.

    Then CCSv4 was in error! The lower part of the Flash consist out of two parts; one 41 KB and one 23 KB which – in the linker- is added to the upper part.

    peg said:
    BUT still it's not smaller with ccsv6 !

    The next optimization step is: Speed versus Size.

  • BTW: In CCSv6 you can quickly see the amount of memory space used -> View/Memory Allocation.

  • I'm using the ".map" file generated by cl430 to make this analyze.


    And anyway I can't find the solution to get a smaller falsh size usage with cl430v4.3 (ccsv6) in EABI mode even with opt_level 4. It is always a bit bigger than the same project compiled with cl430 v3.3 (ccsv4).

  • In the .map file you can see where your Flash has gone.

    The program increases a little when EABI for RAM clearing and initialization.

    I don’t know how to compile it manually, but would you use CCS it can give you some advice on how to optimize.

**Attention** This is a public forum