Jan 21, 2014

Setting the ARM enviroment on Linux with Cortex M4F - Stellaris


Specification:
Target: LM4F120 Series of ARM Cortex-M4 (Texas Instruments)
OS Platform: Linux Ubuntu 13.1 (saucy)
Advice:The Toolchain used in this post isn't supported in Ubuntu 12.10
LM4F120 internal block diagram

Hi, this is the first post and i will show how to develop a complete linux enviroment to program ARM Cortex M4F with StellarisWare Library, this can help you to develop in a open source enviroment without code size limitations of and many other IDEs selling.


Step 1. Installing arm-none-eabi-gcc:


In the terminal put the code below to add the PPA repositories to your system:
sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
sudo apt-get update

And just install the package:
sudo apt-get install gcc-arm-none-eabi

Obs.: if you have this error:
E: Unable to locate package gcc-arm-none-eabi
don't give up, just do this:
cd /etc/apt/sources.list.d/
sudo gedit terry_guo-gcc-arm-embedded-saucy.list
and edit the file with:
deb http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu raring main
# deb-src http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu raring main

After you just need to put again:
sudo apt-get update
sudo apt-get install gcc-arm-none-eabi



Step 2. Installing Stellaris Ware:


Download the StellarisWare Library (SW-EK-LM4F120XL-9453.exe), create the folders in your home and unzip:
mkdir -p ~/stellaris/
unzip ~/Downloads/SW-EK-LM4F120XL-9453.exe -d ~/stellaris/
cd ~/stellaris/
make



Step 3. Installing the lm4tools:


First install some tools that you may need to download the bin:
sudo apt-get install libusb-1.0-0-dev
And then clone the repository into your folder:
mkdir -p ~/lm4flash_dev/
cd ~/lm4flash_dev/
sudo apt-get install git
git clone https://github.com/utzig/lm4tools.git
After the repository ready, just make the library:
cd lm4tools/lm4flash
make
Now, add the lm4flash to you path in .profile:
sudo gedit ~/.profile

and in the end line of the file just paste this:
export PATH=$PATH:$HOME/lm4flash_dev/lm4tools/lm4flash



In this step, restart your session to load the path of lma4flash... All right you are almost just finishing, you just need to adjust the permissions to other users download the firmware to the ARM and for this just put:
echo 'ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", GROUP="users", MODE="0660"' | \
 sudo tee /etc/udev/rules.d/99-stellaris-launchpad.rules
sudo usermod -aG users (Put here the other user, not root)
And finally, just download the sample of blinky:(Remember to put the switch PWR_SELECT in DEBUG mode, and sure connect the board to the usb -> pc)
lm4flash stellaris_test/boards/ek-lm4f120xl/blinky/gcc/blinky.bin

If the led blinky in green color you did all right and you can do the next tutorial. ^^
Tks All.