Stellaris Cortex and OpenOCD

I have always had problems with OpenOCD, mainly due to bad documentation out of sync with the code. I got a new evaluation board for the LM3S2965 processor (EK-LM3S2965) last week and gave OpenOCD a new try, and lo, this has become quite simple.
From the page-sized configuration scrips floating around to this two-line openocd.cfg:

source [find interface/jtagkey.cfg]
gdb_flash_program enable
source [find target/lm3s811.cfg]

The first line searches for the programming hardware configuration file, in my case it is an Amontec JTAG key. The second line searches for the CPU configuration file. The LM3S2965 seems to be covered well by the 811- configuration. On my system the configuration files reside under /usr/share/openocd/scripts.

To test the setup I used the blinky program. This comes with the Stellaris source package for the evaluation boards (look here to see how to compile) . I put the opennocd.cfg-file in the StellarisWare/boards/ek-lm3s2965/blinky/gcc directory and typed openocd. From another terminal I ran telnet localhost 4444 which connected me to the openocd-server. To program the device:

# stop the processor
# erase the first sector, enough space for the blinky program
flash erase-sector 0 0 1
# load, the path is relative to where you started openocd
flash write_image blinky.bin

Now the fancy OLED graphical game the evaluation kit was born with is gone. Instead I can watch a blinking LED, somewhat more satisfying.

0 Responses to “Stellaris Cortex and OpenOCD”

  • No Comments

Leave a Reply