Downloading images to TI Tiva C Launchpad from Keil in Wine

Posted by on februarie 07, 2014
Fără categorie

I needed to run some programs on my Tiva C Launchpad board from Linux. Normally this is very simple, as shown in a previous post. However, I needed to use the ARM Keil IDE, in order to get credit for my work.

Keil runs fine under Wine, but Wine is not that good with unknown USB devices. However, I managed to find a way around that and download the image using lm4tools instead of the default flasher. The instructions were tested using Tiva C, but work just as well on Stellaris Launchpad.

1. First, we gotta be sure we can run it:

git clone https://github.com/utzig/lm4tools.git
cd lm4tools/lm4flash
make
sudo make install
echo 'ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", GROUP="users", MODE="0660"' | \
  sudo tee /etc/udev/rules.d/99-tiva-launchpad.rules

The last command is optional and ensures the command can be used as a regular user. The Vendor and Product id are obtained by running:

lsusb | grep Luminary

and are the same on Stellaris Launchpad and Tiva C

2. Then, we have to make the script callable from wine. This can be done by creating a shortcut in the fake C:\ drive used by wine:

ln -s /usr/bin/lm4flash ~/.wine/drive_c/windows/system/lm4flash.exe

To check if it works, just start cmd from wine:

$ wine cmd
c:> c:\windows\system\lm4flash.exe

3. lm4flash needs a bin file and Keil ony generates an axf file. To get the bin file, go to project options, user tab and paste the following in the „Run programs after Build/Rebuild” section:

C:\Keil\ARM\ARMCC\bin\fromelf.exe  --bin HelloLaunchPad.axf --output HelloLaunchPad.bin

Ofcourse, you need to customize the paths.

4. The final step is to use lm4flash to download the image. Go to the project options, Utilities tab and select the „Use External tool for Flash programming” radio button from the „Configure Flash Menu Command” section.

Command: C:\windows\system\lm4flash.exe
Argument: HelloLaunchPad.bin
Run Independent checked (this is so the IDE won’t block if the script fails for some reason)

5. That’s it, make a small change to the code (so you know if the new code is active) and click on Flash->Download. Hope this helps someone 🙂

2 Comments to Downloading images to TI Tiva C Launchpad from Keil in Wine

  • Have you been able to run the debugger/grader on Keil?
    I get an ICDI Stellaris Error: Could not find an Cortex-M device in the JTAG chain! Please check the JTAG cable and the connected devices.

    And then

    Error: Target DLL has been cancelled. Debugger aborted!

    Did it work for you at first try?

  • Hi Manuel. Sorry for the late answer. I have not been able to connect to the board from Kyle. I’ve just run the labs without the grader and gave up on those points. The objective is to more to learn to use that board (or any embedded device for that matter) and less to get the passing grade.

Lasă un răspuns

Adresa ta de email nu va fi publicată. Câmpurile obligatorii sunt marcate cu *

Acest site folosește Akismet pentru a reduce spamul. Află cum sunt procesate datele comentariilor tale.