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.

Compiler/EZ430-CHRONOS: Compiler seems to ignore -mcpu=430

Part Number: EZ430-CHRONOS

Tool/software: TI C/C++ Compiler

We want to compile C++ code for the cc430f6137, but with the reduced instruction set 430 (without X and v2), so I passed -mmcu=cc430f6137 and -mcpu=430 to the compiler. This is passed down to the subprocesses, it also issues a warning that I should select 430x ("cc1plus: warning: MCU 'cc430f6137' supports 430X ISA but -mcpu option is set to 430" suppressed with mno-warn-mcu), but nevertheless the option seems to be ignored.

Please see the following compile log and the explanation of the error at the end:

"/compiler/ti-msp430-gcc/bin/msp430-elf-g++" -L "/compiler/ti-msp430-gcc/includes" -v -mcpu=430 -mmcu=cc430f6137 -I "/include" -I "src" -D "WITH_DISABLE_WDT" -I "/compiler/ti-msp430-gcc/include/" -Os -Wall -Wno-write-strings -fno-exceptions -I "build" -I "src/machine/simpliciti/bsp/boards/CC430EM" -I "src/machine/simpliciti/simpliciti/nwk" -I "src/machine/simpliciti/simpliciti/nwk_applications" -I "src/" -I "src/arch/cc430f6137" -I "src/ipstack" -ffunction-sections -fmove-loop-invariants -D "MSP430NEW" -D "TIMSP430" -Wno-unused-local-typedefs -Wl,--library-path=/include -fno-rtti -fno-threadsafe-statics -std=c++11 -L "/compiler/ti-msp430-gcc/includes" -mno-warn-mcu -c -xc++ "build/src/apps/Chronos_RF_Display/ChronosRfDisplayThread.acc" -xnone -I "src/apps/Chronos_RF_Display" -o "build/src/apps/Chronos_RF_Display/ChronosRfDisplayThread.o"
Using built-in specs.
COLLECT_GCC=/compiler/ti-msp430-gcc/bin/msp430-elf-g++
Target: msp430-elf
Configured with: /srv/net/msp430/jenkins/workspace/msp430-gcc-6-pkg-gnu/gcc.subtree/configure --build=i686-redhat-linux --host=i686-redhat-linux CC='x86_64-redhat-linux-gcc -m32' CXX='x86_64-redhat-linux-g++ -m32' --target=msp430-elf --enable-languages=c,c++ --disable-nls --enable-target-optspace --enable-newlib-nano-formatted-io --with-pkgversion='SOMNIUM Technologies Limited - msp430-gcc 6.2.1.16'
Thread model: single
gcc version 6.2.1 20161212 (SOMNIUM Technologies Limited - msp430-gcc 6.2.1.16)
COLLECT_GCC_OPTIONS='-L/compiler/ti-msp430-gcc/includes' '-v' '-mcpu=430' '-mmcu=cc430f6137' '-I' '/include' '-I' 'src' '-D' 'WITH_DISABLE_WDT' '-I' '/compiler/ti-msp430-gcc/include/' '-Os' '-Wall' '-Wno-write-strings' '-fno-exceptions' '-I' 'build' '-I' 'src/machine/simpliciti/bsp/boards/CC430EM' '-I' 'src/machine/simpliciti/simpliciti/nwk' '-I' 'src/machine/simpliciti/simpliciti/nwk_applications' '-I' 'src/' '-I' 'src/arch/cc430f6137' '-I' 'src/ipstack' '-ffunction-sections' '-fmove-loop-invariants' '-D' 'MSP430NEW' '-D' 'TIMSP430' '-Wno-unused-local-typedefs' '-fno-rtti' '-fno-threadsafe-statics' '-std=c++11' '-L/compiler/ti-msp430-gcc/includes' '-mno-warn-mcu' '-c' '-I' 'src/apps/Chronos_RF_Display' '-o' 'build/src/apps/Chronos_RF_Display/ChronosRfDisplayThread.o'
/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../libexec/gcc/msp430-elf/6.2.1/cc1plus -quiet -v -I /include -I src -I /compiler/ti-msp430-gcc/include/ -I build -I src/machine/simpliciti/bsp/boards/CC430EM -I src/machine/simpliciti/simpliciti/nwk -I src/machine/simpliciti/simpliciti/nwk_applications -I src/ -I src/arch/cc430f6137 -I src/ipstack -I src/apps/Chronos_RF_Display -imultilib 430 -iprefix /compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/msp430-elf/6.2.1/ -D WITH_DISABLE_WDT -D MSP430NEW -D TIMSP430 build/src/apps/Chronos_RF_Display/ChronosRfDisplayThread.acc -quiet -dumpbase ChronosRfDisplayThread.acc -mcpu=430 -mmcu=cc430f6137 -mno-warn-mcu -auxbase-strip build/src/apps/Chronos_RF_Display/ChronosRfDisplayThread.o -Os -Wall -Wno-write-strings -Wno-unused-local-typedefs -std=c++11 -version -fno-exceptions -ffunction-sections -fmove-loop-invariants -fno-rtti -fno-threadsafe-statics -o /tmp/ccHaA3kR.s
GNU C++11 (SOMNIUM Technologies Limited - msp430-gcc 6.2.1.16) version 6.2.1 20161212 (msp430-elf)
compiled by GNU C version 4.8.5 20150623 (Red Hat 4.8.5-4), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/msp430-elf/6.2.1/../../../../msp430-elf/sys-include"
ignoring duplicate directory "/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/../../lib/gcc/msp430-elf/6.2.1/../../../../msp430-elf/include/c++/6.2.1"
ignoring duplicate directory "/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/../../lib/gcc/msp430-elf/6.2.1/../../../../msp430-elf/include/c++/6.2.1/msp430-elf/430"
ignoring duplicate directory "/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/../../lib/gcc/msp430-elf/6.2.1/../../../../msp430-elf/include/c++/6.2.1/backward"
ignoring duplicate directory "/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/../../lib/gcc/msp430-elf/6.2.1/include"
ignoring duplicate directory "/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/../../lib/gcc/msp430-elf/6.2.1/include-fixed"
ignoring nonexistent directory "/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/../../lib/gcc/msp430-elf/6.2.1/../../../../msp430-elf/sys-include"
ignoring duplicate directory "/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/../../lib/gcc/msp430-elf/6.2.1/../../../../msp430-elf/include"
ignoring nonexistent directory "/include"
ignoring nonexistent directory "src/machine/simpliciti/bsp/boards/CC430EM"
ignoring nonexistent directory "src/machine/simpliciti/simpliciti/nwk"
ignoring nonexistent directory "src/machine/simpliciti/simpliciti/nwk_applications"
ignoring duplicate directory "src/"
ignoring nonexistent directory "src/ipstack"
#include "..." search starts here:
#include <...> search starts here:
src
/compiler/ti-msp430-gcc/include/
build
src/arch/cc430f6137
src/apps/Chronos_RF_Display
/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/msp430-elf/6.2.1/../../../../msp430-elf/include/c++/6.2.1
/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/msp430-elf/6.2.1/../../../../msp430-elf/include/c++/6.2.1/msp430-elf/430
/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/msp430-elf/6.2.1/../../../../msp430-elf/include/c++/6.2.1/backward
/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/msp430-elf/6.2.1/include
/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/msp430-elf/6.2.1/include-fixed
/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/msp430-elf/6.2.1/../../../../msp430-elf/include
End of search list.
GNU C++11 (SOMNIUM Technologies Limited - msp430-gcc 6.2.1.16) version 6.2.1 20161212 (msp430-elf)
compiled by GNU C version 4.8.5 20150623 (Red Hat 4.8.5-4), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: a7c174a8d75ac913c58b73c75de43678
COLLECT_GCC_OPTIONS='-L/compiler/ti-msp430-gcc/includes' '-v' '-mcpu=430' '-mmcu=cc430f6137' '-I' '/include' '-I' 'src' '-D' 'WITH_DISABLE_WDT' '-I' '/compiler/ti-msp430-gcc/include/' '-Os' '-Wall' '-Wno-write-strings' '-fno-exceptions' '-I' 'build' '-I' 'src/machine/simpliciti/bsp/boards/CC430EM' '-I' 'src/machine/simpliciti/simpliciti/nwk' '-I' 'src/machine/simpliciti/simpliciti/nwk_applications' '-I' 'src/' '-I' 'src/arch/cc430f6137' '-I' 'src/ipstack' '-ffunction-sections' '-fmove-loop-invariants' '-D' 'MSP430NEW' '-D' 'TIMSP430' '-Wno-unused-local-typedefs' '-fno-rtti' '-fno-threadsafe-statics' '-std=c++11' '-L/compiler/ti-msp430-gcc/includes' '-mno-warn-mcu' '-c' '-I' 'src/apps/Chronos_RF_Display' '-o' 'build/src/apps/Chronos_RF_Display/ChronosRfDisplayThread.o'
/compiler/msp430-gcc-full-linux-installer-5.0.0.25/bin/../lib/gcc/msp430-elf/6.2.1/../../../../msp430-elf/bin/as -v -I /include -I src -I /compiler/ti-msp430-gcc/include/ -I build -I src/machine/simpliciti/bsp/boards/CC430EM -I src/machine/simpliciti/simpliciti/nwk -I src/machine/simpliciti/simpliciti/nwk_applications -I src/ -I src/arch/cc430f6137 -I src/ipstack -I src/apps/Chronos_RF_Display -mP -mcpu=430 -md -gdwarf-sections -o build/src/apps/Chronos_RF_Display/ChronosRfDisplayThread.o /tmp/ccHaA3kR.s
GNU assembler version 2.26 (msp430-elf) using BFD version (SOMNIUM Technologies Limited - msp430-gcc 6.2.1.16) 2.26.20160125
/tmp/ccHaA3kR.s: Assembler messages:
/tmp/ccHaA3kR.s:34: Error: instruction pushm requires MSP430X mcu

The problematic code is the following snippet, which seems to me like the generated context save code by the compiler:

; start of function
; framesize_regs:     8
; framesize_locals:   6
; framesize_outgoing: 0
; framesize:          14
; elim ap -> fp       10
; elim fp -> sp       6
; saved regs: R7 R8 R9 R10
        ; start of prologue
        PUSHM.W #4, R10
        SUB.W   #6, R1
        ; end of prologue
[............]

The PUSHM instruction is apparently inserted by the optimizer. With -O0 there are no PUSHM instructions in the generated assembler file, but even then there are other extended instructions left like RPT and RRAX, which I would not expect with -mcpu=430.

Do I miss something? I appreciate any help.

  • Please see the table titled MSP430 GCC Settings: Runtime in the MSP430 GCC manual.  It explains that the option -mcpu is deprecated and replaced by -mmcu.  And the -mmcu option must match the device you use.  In your case, the cc430f6137 has a MSP430XV2 CPU core.  Building for that exact CPU is the only supported method.  

    Ulrich Gabor said:
    We want to compile C++ code for the cc430f6137, but with the reduced instruction set 430 (without X and v2)

    There might be a way to hack up the command line options, linker scripts, startup files, and so on to make that work.  But we have no documentation or examples that cover the details.

    Thanks and regards,

    -George

  • Ok, thank you for your help!
  • It actually worked the way you described. We removed -mcpu, set -mmcu=msp430 and added -D __CC430F6137__ to make it compile. Then we changed the paths in the linker command for the other object files (e.g. crtn.o) to use the files out of the 430 subdirectory, removed the given --script option(s) and chose the linker script cc430f6137.ld instead. This seems to work. Thanks again!