Saturday, 25 April 2015

Installing the official Texas Instruments Red Hat Toolchain

I'm getting back into embedded firmware development by returning to my favourite chipset, the MSP430 series from Texas Instruments. Setting up the tool chain always used to be a challenge but has steadily improved to the point where you can run a single installer to get everything you need. TI provide a linux .run installer which you can download from  this page: http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/latest/index_FDS.html. You have to register and confirm that you are not a terrorist before you can download the following file:


If you are lucky you can just make this file executable and run it. I was not so lucky. When I tried to run the installer it did nothing and returned immediately without any error messages or debug.

The problem

The TI full linux installer is a 32-bit binary and therefore requires 32-bit libraries. If you are running 64-bit Fedora 21 or similar you may not have the 32-bit C libraries installed - they are not installed by default. To fix this it was necessary to install glibc:

 sudo yum install glibc.i686

With this installed you should be able to run the installer.

You will also probably need to install the 32-bit C++ library libstdc++:
sudo yum install libstdc++.i686
This library is necessary for the gdb_agent_console (a.k.a. gdbproxy). Without it you will probably get an error like the one below:

./bin/gdb_agent_console: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
 

How I figured this out

I was fortunate that my old Fedora laptop was able to run the installer so I knew it could work! I found out about the pmap command which takes a process id as an argument and outputs all the libraries being used by the given process. I ran the installer and then ran pmap on its process and noticed that it was pulling in libraries from /usr/lib/ which I didn't have on my new machine. Then it was a case of googling to learn that glibc provides the 32bit loader which is responsible for finding 32bit libraries on required by 32bit applications. Once this is installed it is a lot easier to figure out which libraries are missing because the loader will print messages like the one above about not being able to open shared object files.

Notes on MSP430 GCC Official Red Hat version

I chose to build the msp430-elf-gcc from source using the source tarball download from the TI site linked above. I followed these instructions from Amrita Mazumdar without which I wouldn't have got anywhere:


Thanks Amrita Mazumdar

In order to program an MSP430 you will need to install the closed source gdbproxy (gdb_agent_console) application which I found easiest to obtain by running the full installer referenced above. This will also install the compiler if you choose not to bother building from source.

No comments: