t, Hack! search The complete tutorial for Stellaris LaunchPad development with GNU/Linux (I) [http://4.bp.blogspot.com/dIsfUg8tlaE/UK1DB8EA49I/AAAAAAAAAPE/r77VWN8nT3E/s1600/stlp.jpg] So you bought the Stellaris LaunchPad, this powerful and cheap development board. Maybe you are even one of the lucky ones that bought it for only $4.99. You received it, grabbed a breadboard, some wires, resistors, capacitors and ICs, mixed all together and are ready to start writing software, but... what options do you have for developing software for this platform? Let's see what TI has to offer on the Stellaris LaunchPad web page [http://www.ti.com/ww/en/launchpad/stellaris_head.html? DCMP=stellaris-launchpad&HQS=stellaris-launchpad-b] : Code Composer Studio (CCS) is the IDE from Texas Instruments. It's Eclipse based and you can use it with the Stellaris Launchpad without any limit on the code size. Keil RealView MDK-ARM: This is a popular IDE supporting several chip architectures, including the ARM Cortex M4 in your Stellaris LaunchPad. You can freely download an evaluation version, which is 32 kiB code size limited. IAR Embedded Workbench. Another popular IDE. It has also an evaluation version, with a 32 kiB code size limit. Sourcery Codebench. An IDE by Mentor Graphics. You can download a 30-day evaluation version. If you want to stick to non-limited non-pay options, you can use Code Composer Studio. End of story. See you in Hack a Day when you finish your neat gadget! Are you still reading? If that's the case, maybe you don't like/have a Windows box for developing, and all the four IDEs I have mentioned are Windows only. But don't worry, of course you can develop for this board using GNU/Linux. Don't forget GNU/Linux is the best OS for software developing ;-). I'll write some entries detailing all the process needed to set up the toolchain, build the StellarisWare libraries, build your project, flash and debug it and set up an Eclipse project. In the end, we will have a completely FOSS have a completely [http://en.wikipedia.org/wiki/Free_and_open_source_software] IDE without any time/code size restrictions! But enough talk, let's get our hands dirty! Building the toolchain In these tutorials, I'll put all the tools for Stellaris development in a directory called src/stellaris under my home. The first step is to build the toolchain containing the assembler, C compiler and libraries, linker, etc. To build it I followed the steps posted in Recursive Labs Blog [http://recursivelabs.com/blog/2012/10/28/stellaris-launchpad-gnu-linux-gettingstarted/] , almost unmodified. 1. Create working directory and change to it: mkdir -p ~/src/stellaris cd ~/src/stellaris 2. Install the compiler and dependencies required to build the toolachain. In Ubuntu (and hopefully in most Debian based distros): apt-get install flex bison libgmp3-dev libmpfr-dev libncurses5-dev libmpc-dev \ autoconf texinfo build-essential libftdi-dev git 3. Download the script for building the toolchain and run it. This step will take some time to complete, but when it finishes, you should have the toolchain ready to use, in the sat/ directory under your home: git clone https://github.com/esden/summon-arm-toolchain cd summon-arm-toolchain ./summon-arm-toolchain Once the build is successfully completed, your toolchain will be ready for building programs for the Stellaris Launchpad. For convenience don't forget to add ~/sat/bin to your PATH variable. For example edit .profile file in your home, and add the following line at its end: export PATH=$PATH:$HOME/sat/bin You will have to restart your session for this change to take effect. Building StellarisWare library The easiest way to configure the Stellaris MCU and its peripherals is to use the StellarisWare library. This library is really complete and easy to use, and has another cool advantage: it's also included in the ROM inside the LM4F120 MCU (you just have to add the ROM_ prefix to the function calls to use the ROM software). This can help saving Flash memory space. Fortunately the library uses a BSD license, the sources are available and come with gcc friendly makefiles. Building this library is as easy as: 1. Download the library sources package. You can find it here [http://www.ti.com/tool/sw-lm3s] . You'll need a my.TI account, so if you have not one, you'll have to register. 2. Unpack and build the library. Make sure you change the path to the library package, in case you don't download it to the Downloads directory of your home: mkdir -p ~/src/stellaris/stellarisware cd ~/src/stellaris/stellarisware unzip ~/Downloads/SW-EK-LM4F120XL-9453.exe make These steps will build StellarisWare library and also the examples. These steps will build StellarisWare library and also the examples. StellarisWare example files are not BSD licensed. They have some obscure license terms, including the startup code files, the linker scripts and the Makefiles for building them. This can be a problem for some users, so be warned. Building and using lm4flash lm4flash is a tool for flashing binaries to the MCU. This step is not strictly required, because you can flash programs to the MCU using gdb + openocd, but it's easy to do, fast, and sometimes using lm4flash tool is more convenient. Just follow these steps: 1. Download lm4tools and build lm4flash: cd ~/src/stellaris git clone https://github.com/utzig/lm4tools.git cd lm4tools/lm4flash make 2. If everything went OK, you should have the lm4flash binary sitting in the current working directory. Maybe this is not the cleanest installation method, but I moved lm4flash to ~/sat/bin for it to stay in the PATH: mv lm4flash ~/sat/bin/ 3. Before flashing anything to the board, it's recommended to create a new udev rule so you can use lm4flash (and openocd later) without superuser permissions (i.e. without being root or using sudo). You will also have to add your user to the "users" group if it's not in it already. So only execute the last sentence if you need to do so, and if you do it, replace <username> with your user name: 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 <username> 4. If the board was plugged to the USB debug port, unplug it. Make sure the PWR SELECT switch is at the DEBUG position and connect the USB debug port to a USB port in the PC. If the rule is working, you will have permission to access the /dev/ttyACM* device created when you plug the board. Now you can test everything you have done until now, by flashing one of the examples, like this: cd ~/src/stellaris/stellarisware/boards/ek-lm4f120xl/blinky/gcc/ lm4flash blinky.bin The program should be successfully flashed to the MCU, and you should see a green LED blinking in the board. If that's the case, congratulations, your toolchain is working perfect! In the next chapter we will learn how to set-up OpenOcd and GDB for debugging programs. We will also see how to avoid problems with the clunky license that comes with the examples in the StellarisWare package. Happy hacking, and stay tuned! Posted 21st November 2012 by doragasu 9 View comments James Kemp December 24, 2012 at 3:36 AM Step #3, under "Building and using lm4flash", should have the second command say: sudo usermod -aG users my_username Otherwise, this is Awesome! Thanks so much for a great step-by-step. Jim Reply Replies doragasu December 24, 2012 at 12:25 PM Blogger took as an HTML tag and ate it :-P. Thanks for the correction, it's fixed now. Reply Andy Robson March 15, 2013 at 2:18 PM thanks seems to work, its blinking good. Reply janisozaur April 7, 2013 at 10:29 PM you don't have to deal with windows binaries at all, you can clone stellarisware from https://github.com/yuvadm/stellaris/ Reply an.schall April 15, 2013 at 4:48 PM I always get 'error: bad value (cortex-m4) for -mcpu= switch' and 'error: invalid floating point option: -mfpu=fpv4-sp-d16' when invoking 'make' in the stellaris dir: $ make make[1]: Betrete Verzeichnis '/home/andre/Dokumente/DevBoards/stellarislm4f/dev/stellarisware/driverlib' CC adc.c adc.c:1: error: bad value (cortex-m4) for -mcpu= switch adc.c:1: error: invalid floating point option: -mfpu=fpv4-spd16 make[1]: *** [gcc-cm4f/adc.o] Fehler 1 make[1]: Verlasse Verzeichnis '/home/andre/Dokumente/DevBoards/stellarislm4f/dev/stellarisware/driverlib' make: *** [all] Fehler 2 $ uname -a Linux an 3.5.0-27-generic #46-Ubuntu SMP Mon Mar 25 20:00:05 UTC 2013 i686 i686 i686 GNU/Linux Reply Ludo6431 April 25, 2013 at 11:17 PM You may need libusb developpement files to build lm4flash : apt-get install libusb-1.0-0-dev Reply Replies Ludo6431 April 26, 2013 at 12:54 AM You may also need python-yaml module: apt-get install python-yaml Reply Unknown May 8, 2013 at 6:51 AM Whe i was compiling it I got the following error: checking for arm-none-eabi-gcc... ~/lm4tools/summon-armtoolchain/build/./gcc/xgcc -B/~/lm4tools/summon-armtoolchain/build/./gcc/ -nostdinc -B/~/lm4tools/summon-armtoolchain/build/arm-none-eabi/newlib/ -isystem /~/lm4tools/summon-arm-toolchain/build/arm-noneeabi/newlib/targ-include -isystem /~/lm4tools/summon-armtoolchain/gcc-linaro-4.7-2013.01/newlib/libc/include B/~/lm4tools/summon-arm-toolchain/build/arm-noneeabi/libgloss/arm -L/~/lm4tools/summon-armtoolchain/build/arm-none-eabi/libgloss/libnosys L/~/lm4tools/summon-arm-toolchain/gcc-linaro-4.72013.01/libgloss/arm -B/root/sat/arm-none-eabi/bin/ B/root/sat/arm-none-eabi/lib/ -isystem /root/sat/arm-noneeabi/include -isystem /root/sat/arm-none-eabi/sys-include checking for suffix of object files... configure: error: in `~/lm4tools/summon-arm-toolchain/build/arm-noneeabi/libgcc': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. make[1]: *** [configure-target-libgcc] Error 1 make[1]: Leaving directory `~/lm4tools/summon-armtoolchain/build' Could somebody help me? the directory /sat has been created but i don't know what does this error means Reply Replies doragasu May 8, 2013 at 8:32 AM It looks like you are building as root. Maybe that's not related to this problem, but usually it's not a good idea to build stuff as root. Reply