This is is pre-built and open source code compiler tool chain for various platforms cross-compiling for the MSP430 range of MCUs.
The Motorola srecord utility is required to convert the hex output from GCC to TI text format files.
apt-get install srecord
Debian Linux comes with an old package (2012) which is adequate for a range of micros.
apt-get install binutils-msp430 gcc-msp430 msp430-libc msp430mcu
An updated tool chain is also available from TI which is needed for newer and large model devices.
For example, the TI compiler supports the large memory model on the MSP430F5438A.
wget http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-full-linux-x64-installer-9.2.0.0.run chmod +x msp430-gcc-full-linux-x64-installer-9.2.0.0.run ./msp430-gcc-full-linux-x64-installer-9.2.0.0.run
Install to /opt/msp430-gcc or anywhere else.
apt install build-essential texinfo bison flex python python-dev libexpat-dev libmpfr-dev libisl-dev libgmp-dev libmpc-dev
Check the TI website for the latest version, at this time the compiler is 9.3.1.11 and the support files are 1.212.
mkdir -p /opt/src cd /opt/src wget "https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-LlCjWuAbzH/9.3.1.2/msp430-gcc-9.3.1.11-source-full.tar.bz2" tar xjvf msp430-gcc-9.3.1.11-source-full.tar.bz2 cd msp430-gcc-9.3.1.11-source-full chmod +x README-build.sh ./README-build.sh
On a Raspberry Pi 3B this process takes quite some time and needs about 8GB of disc space.
Build Complete [toolchain root directory: install/usr/local/bin] + exit 0 11:03:19.41s
On a RPi4, it took considerably less time to build.
Build Complete [toolchain root directory: install/usr/local/bin] + exit 0 3:08:46.03s
/opt
mkdir -p /opt/msp430-gcc cp -Rpa install/usr/local/* /opt/msp430-gcc/
/usr/local/
cd install find | cpio -pdumva /
cd /opt/src wget "https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-LlCjWuAbzH/9.3.1.2/msp430-gcc-support-files-1.212.zip" unzip msp430-gcc-support-files-1.212.zip
/opt
cp -Rpa msp430-gcc-support-files/* /opt/msp430-gcc/
/usr/local
mkdir -p /usr/local/include/msp430 cp -Rpa msp430-gcc-support-files/include/* /usr/local/include/msp430