==== MSP430-GCC ====
This is is pre-built and open source code compiler tool chain for various platforms cross-compiling for the MSP430 range of MCUs.
=== Tools ===
The Motorola srecord utility is required to convert the hex output from GCC to TI text format files.
apt-get install srecord
=== GCC Pre-built ===
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 [[https://www.ti.com/tool/download/MSP430-GCC-OPENSOURCE|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.
=== GCC Open Source===
==Install tools==
apt install build-essential texinfo bison flex python python-dev libexpat-dev libmpfr-dev libisl-dev libgmp-dev libmpc-dev
Check the [[https://www.ti.com/tool/download/MSP430-GCC-OPENSOURCE|TI website]] for the latest version, at this time the compiler
is [[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|9.3.1.11]] and the support files are [[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|1.212]].
==Build compiler==
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
==Install compiler (ensure there is about 1.5GB disc space free)==
__/opt__
mkdir -p /opt/msp430-gcc
cp -Rpa install/usr/local/* /opt/msp430-gcc/
__/usr/local/__
cd install
find | cpio -pdumva /
==Install support files==
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
=== Resources ===
[[https://www.ti.com/tool/download/MSP430-GCC-OPENSOURCE|MSP430-gcc Homepage]]
/*
[[http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50-source-full.tar.bz2|MSP430-gcc 9.2.0.50 Source]]
[[http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50-source-patches.tar.bz2|MSP430-gcc 9.2.0.50 patches for GCC]]
[[http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-support-files-1.210.zip|MSP430-gcc Support Files]]
*/