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 🙂