Search code examples
embeddedubuntu-14.04msp430toolchain

MSP430 toolchain in linux


Can anybody please guide procedure to setup tool-chain for MSP430 in Linux (particularly Ubuntu) ? I am using MSP430 launchpad (MSP-EXP430G2), and I need to setup compiler/build tools and debugger drivers.


Solution

  • If you install Texas Instruments' CCS IDE, Linux version, it will install the tool-chain. There are, however, other problems in developing for MSP430 in Linux. The bugs and fixes are detailed in my post here:

    MSP430 / eZ430-RF2500 Linux support Guide

    "Compile code using Code Composer Studio (CCS)
    
    Download CCS for Linux.
    Create a new CCS project with a Custom MSP430 Device or any other.
    Compile the code. The result binary image will be in the workspace. The workspace path can be found in “File” / “Switch workspace”.
    The file that should be programmed to the device is the project-name.out file.
    Program and run device using mspdebug
    
    Download and Install mspdebug
    From the directory with the file project-name.out run:
    $ sudo mspdebug rf2500
    Now you are in mspdebug’s command line shell. Run the following to program and run the device:
    (mspdebug) prog project-name.out
    (mspdebug) run
    Use Ctrl+c to pause run and get command line back.
    Fix a Linux Kernel bug that prevents Minicom to communicate with device
    
    The device path in /dev is /dev/ttyACM0. Currently, connecting to it
    serially using utilities such as minicom is not possible, and you get the message “/dev/ttyACM0: No such file or directory”.
    
    The bug is in Kernel module “cdc_acm”. The solution is to fix the bug in the source code, recompile the module and plug it instead of the existing one.
    
    Find out Linux version:
    $ uname -r
    cdc_acm’s source is the files cdc-acm.c and cdc-acm.h. They are under the Linux path drivers/usb/class/.
    Download these two files from a repository that matches your Linux version. Such repos are available in lxr.free-electrons.com and www.kernel.org.
    Create a new directory and move the files to it.There are two code segments need to be removed or commented out:
    The next lines appear in function “acm_port_activate()” on newer versions and in “acm_tty_open()” in older ones:
    // if (0 > acm_set_control(acm, acm->ctrlout = ACM_CTRL_DTR | ACM_CTRL_RTS) &&
    // (acm->ctrl_caps & USB_CDC_CAP_LINE))
    // goto bail_out;
    The next line appears in function “acm_port_shutdown()” on newer versions “acm_port_down()” in older ones:
    // acm_set_control(acm, acm->ctrlout = 0);
    Create a Makefile and compile:
    $ echo 'obj-m += cdc-acm.o' > Makefile
    $ make -C /lib/modules/`uname -r`/build M=$PWD modules
    You should have a new cdc-acm.ko file in the directory
    Replace the existing module (This change will be discarded after boot):
    $ sudo rmmod cdc-acm
    $ sudo insmod ./cdc-acm.ko
    Communicate via the serial port using Minicom
    
    Launch minicom setup from command line:
    $ minicom -s
    In the menu, choose:
    Serial port setup
    Press ‘A’ (for “Serial Device”).
    Replace Current device path with:
    /dev/ttyACM0
    Press ‘E’ (for “Bps/Par/Bits”).
    Set the correct data rate for your device.To lower the rate (to 1200, for instance), keep pressing ‘B’ (for “previous”) until the top line shows:
    Current: 1200 8N1
    Press “Enter” until returning to main menu, there, press “Exit”.This will exit the setup menu and start running on the device. From now on you should see messages over the serial connection: It is up to you to program the device with such messages."