September 22, 2017

Stellaris LM4F120 LaunchPad Compiling in Ubuntu 12.04

For compiling the StellarisĀ EK-LMF120XL LaunchPad Evaluation Kit with Linux, ie Ubuntu 12.04 LTS

mkdir /TI, mkdir /TI/tools, mkdir /TI/ARM

  1. Download the gcc arm from the below path
    https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q1-update/+download/gcc-arm-none-eabi-4_7-2013q1-20130313-linux.tar.bz2
  2. Unzip to the folder cd /TI/tools , tar xjvf gcc-arm-none-eabi-4_7-2013q1-20130313-linux.tar.bz2
  3. export the path for compilation(every time you have to do this when u open the terminal for compilation)
    export PATH=$PATH:/TI/tools/gcc-arm-none-eabi-4_7-2013q1/binor
    export PATH=$PATH:/TI/tools/gcc-arm-none-eabi-4_7-2013q1/bin
    add it to the ~/.bashrc, then type
    prompt > . ~/.bashrc
  4. sudo apt-get install libusb-1.0
  5. Installing the lm4flash tool
    1. cd /TI
    2. git clone https://github.com/utzig/lm4tools.git
    3. cd /TI/lm4tools/lm4flash
    4. make
    5. sudo cp lm4flash /usr/bin/
  6. Installing OpenOCD with ICDI support
    1. download openocd-0.7.0.tar.bz2
    2. cd /TI/ARM
    3. tar xjvf openocd-0.7.0.tar.bz2
    4. cd openocd-0.7.0
    5. ./configure –prefix=/usr –enable-maintainer-mode –enable-stlink –enable-ti-icdi
    6. make
    7. sudo make install
  7. Download StellarisWare for the Stellaris
    1. cd /TI
    2. git clone https://github.com/yuvadm/stellaris.git
    3. cd stellaris/driverlib/
    4. make clean
    5. make
  8. Adding new udev rule to let normal users access the LaunchPad and program it with OpenOCD for the USB
    1. sudo vim /etc/udev/rules.d/10-local.rules , and paste the below content into the file
    2. ATTR{idVendor}==”15ba”, ATTR{idProduct}==”0004″, GROUP=”plugdev”, MODE=”0660″ #Olimex Ltd. OpenOCD JTAG TINY
      ATTR{idVendor}==”067b”, ATTR{idProduct}==”2303″, GROUP=”plugdev”, MODE=”0660″ #Prolific Technology, Inc. PL2303 Serial Port
      ATTR{idVendor}==”10c4″, ATTR{idProduct}==”ea60″, GROUP=”plugdev”, MODE=”0660″ #USB Serial
      ATTR{idVendor}==”1cbe”, ATTR{idProduct}==”00fd”, GROUP=”plugdev”, MODE=”0660″ #TI Stellaris Launchpad
    3. sudo udevadm control –reload-rules, now insert the stellaris board to the USB port, the belwo messaeg you shoud see when you type dmesg, in the below message ttyACM0 is the interface name we should use in the serial console liek minicom fcor the UART interface to the stellaris board
      [51816.313315] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device
    4. If it still does not work you can try this:
      sudo groupadd plugdev
      sudo usermod -aG plugdev <username> #replace user
      sudo usermod -aG dialout <username>
      sudo reboot
  9. Compiling and loading a program to the board
    1. cd /TI/stellaris/boards/ek-lm4f120xl/project0
    2. Modify the Makefile for adding the rule for flashing, with the below change in the make file , you should be able to flash to the stellaris board. You have add this to any project you want to compile and flash to the board
      flash:
      lm4flash gcc/project0.bin
    3. now type make flash, you should see the below output which confirms the board is detected and flashed
      lm4flash gcc/project0.bin
      Found ICDI device with serial: 0E10512B
      ICDI version: 9270