This post will document one possible way of getting an LED blinking with the tm4c123g microcontroller. I’ll be using the TIVA C Launchpad for this example:
A toolchain is needed to compile and link our code. I used this one: https://launchpad.net/gcc-arm-embedded
I’m running windows atm so to install this just download and run the .exe and add the bin folder to the path directory and it’s good to go.
For this example I downloaded the TivaWare peripheral driver C library which contains functions for things like setting the clock speed and accessing GPIO pins etc. Download it here
A program to flash the micro is also needed. I went with the LMFLASH PROGRAMMER utility made by TI. It comes with a GUI or you can use the command line. Download it here: http://www.ti.com/tool/lmflashprogrammer
The GUI is nice and simple – pretty similar to the standalone pickit programmer gui.
There is a really handy github repo available here that has a basic blink led example and a makefile. You’ll need the TivaWare library mentioned above to use it.
clone/download the example git repo to your computer. Some slight modification of the makefile is needed, mainly change the TIVAWARE_PATH variable to wherever you installed the TivaWare library. On my computer it’s C:\ti\TivaWare_C_Series-126.96.36.199
Compile the example code to make a .bin file, ready to be flashed to the uC. To do this, go to the example just downloaded from github and run ‘make’. It will compile and link the code and store the .bin file in a folder called ‘build’
Open up the LMFLASH programmer utility. Under the ‘configuration’ tab select the TM4C123G Launchpad and then go to the ‘program’ tab where you will be asked to select the .bin file we just made. Hit program and if all goes well you should see the red led on the board flashing! (you may need to hit the reset button first)
2 thoughts on “Bare bones programming of the TM4c123G ARM Cortex m4 microcontroller”
Nice work Shane! Next step: openocd for debugging!
Cheers Frank I saw your post about the ws2812bs with the spi and dma – thought i’d give it a go. The tiva c has spi and dma also. Right now everything arm related looks like klingon to me!!