A fully self-contained development environment for the Texas Instruments Tiva C Series Launchpads.
The TI TM4C was my introduction to embedded systems. It holds a very special place in my heart. One thing that I always disliked about developing for the TM4C board was having to use old and outdated IDEs. Thus, I wanted to make a modern development environment for the board.
- Docker
- Visual Studio Code
- Remote Extension Pack
You can simply clone the repo and reopen in the development container in Visual Studio Code.
On macOS you unfortunately cannot access USB devices from inside of Docker. You can still build the application in the Docker container but to debug on the TM4C you'll need to install OpenOCD and LM4Flash on macOS. The easiest way to do this is via HomeBrew. You can do so as follows.
- Install OpenOCD
brew install openocd
- Install LM4Tools
brew install lm4flash
- Install GDB
brew install gdb
What I like to do then is keep two VS Code windows open. One is reopened in the
Docker container and another one is open on the macOS host. When I'm ready to
debug on macOS I run the flash.sh
script and then launch the debugger in VS
Code on the host window.
Another issue I had to resolve was that GDB complained that there was no
file or directory for the executable's source file. A quick workaround for it
was to enter directory /path/to/your/source/file
once GDB starts. If you can
find a fix for this please let me know! I used this blog post
to get some ideas of how to fix it.
An issue I encountered on Ubuntu 20.04 was that I needed to run lm4flash
and openocd
as sudo.
This is a problem when using VS Code extensions because you'd either have to hardcode your password
into the JSON file or instead run lm4flash
and openocd
via the terminal (which I did not want to).
If you try to run lm4flash MicroInvaders.bin
from {workspace}/build/src
and get the following error:
Unable to open USB device: LIBUSB_ERROR_ACCESS
Unable to find any ICDI devices
Then this issue is for you. It just means your user account does not have the permissions to open the usb device. In this case the microcontroller we are trying to flash.
So to fix this we need to:
- Create a new rules file as so:
sudo touch /etc/udev/rules.d/tm4c.rules
- In the new
tm4c.rules
file paste
sudo vim /etc/udev/rules.d/tm4c.rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="1234", MODE="0666"
SUBSYSTEM=="usb_device", ATTRS{idVendor}=="1234", MODE="0666"
where you replace idVendor
with the TM4C's vendor ID.
NOTE: If you don't know how to get the vendor ID for the Launchpad, simply run
echo 'ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", GROUP="users", MODE="0660"' | sudo tee /etc/udev/rules.d/99-stellaris-launchpad.rules
- Now, once you have your new rules file setup, you need to reload the rules with
sudo udevadm control --reload-rules
- Last but not least, unplug your Launchpad and plug it back in. You should now
be able to run
lm4flash MicroInvaders.bin