Programming TI/Luminary with openOCD

I have a Luminary/TI EKK-LM3S9B96 eval board and just got openOCD 0.4.0 from http://www.freddiechopin.info/ (thank you for providing binaries by the way). Initially, I couldn’t get openOCD to find my board although the TI programmer would work. So I tried removing the TI USB driver and installed the USB driver in the openOCD package. Now openOCD is happy and I can debug, but now the TI programmer no longer finds the board! So, I wanted to use openOCD to flash the micro. I used to do this with an old version of openOCD, but the .cfg files appear to be incompatible.

I’ve looked thru the openOCD user guide, and while I could probably get it working in a few days after much frustration, surely someone else has done this already. I just want to execute a command, and have it program a .bin file hardcoded in the .cfg file. Can anyone help me out with this? Whether I use the TI programmer or openOCD I don’t care.

write a basic script which would look something like this:

reset halt
flash write_image erase filename.bin

There is a chance that you’d need to add a new option to pad the erased area to sector boundary and an offset if the flash in your microcontroller does not start at address 0.

4/3!!

Freddie Chopin:
write a basic script which would look something like this:

reset halt

flash write_image erase filename.bin




There is a chance that you'd need to add a new option to pad the erased area to sector boundary and an offset if the flash in your microcontroller does not start at address 0.



4\/3!!

Thanks for replying. I’m a little confused…what else would I need in the .cfg file? I tried putting the two lines you gave me into the existing ek-lm3s9b9x.cfg, and upon running it it says "

invalid command name “reset”

I also tried “flash info 0” and “flash erase_address 0 0 255”, but every command that requires arguments complains “command requires more arguments”.

I assume I have to use “flash bank” first to configure it, which is in the included .cfg files. The other thing is, I already have scripts from an older version of openOCD that worked with a different Luminary micro, but not this one, and those old scripts have commands that 0.4.0 doesn’t seem to understand.

I guess what I’m asking is, since I can debug with the included .cfg files, is where would I add flash commands? It doesn’t seem to like them anywhere I add them into the existing .cfg files.

You should not embed any “non-config” commands in the cfg files. You should create your procedure, by enclosing any “non-config” commands like this:

proc name_of_your_procedure {} {
    <commands>
}

Than you can run the procedure:

from gdb with "monitor name_of_your_procedure

from telnet with “name_of_your_procedure”

from command line with openocd "openocd … -c “init” -c “name_of_your_procedure”

you can also just do "openocd … -c “init” -c “command1” -c “command2” …

If you want your procedure to be automatically executed when your configs are parsed you need to add “init” BEFORE any “non-config” commands, but AFTER all “config” commands:

<config commands of the script>
init
name_of_your_procedure # or just various commands

And for future - it you’re talking about some non-working scripts it would be easier for both of us if you’d just post them along with the errors you get when executing those.

4/3!!

Freddie Chopin:
You should not embed any “non-config” commands in the cfg files. You should create your procedure, by enclosing any “non-config” commands like this:

proc name_of_your_procedure {} {
<commands>

}




Than you can run the procedure:

from gdb with "monitor name_of_your_procedure

from telnet with "name_of_your_procedure"

from command line with openocd "openocd ... -c "init" -c "name_of_your_procedure"

you can also just do "openocd ... -c "init" -c "command1" -c "command2" ...



If you want your procedure to be automatically executed when your configs are parsed you need to add "init" BEFORE any "non-config" commands, but AFTER all "config" commands:




init
name_of_your_procedure # or just various commands




And for future - it you're talking about some non-working scripts it would be easier for both of us if you'd just post them along with the errors you get when executing those.



4\/3!!

Ahh, I see, that’s what I was missing. That’s why it wouldn’t take my commands.

I didn’t have any new scripts, I was simply trying to add these commands to the existing ones in openOCD. Thanks for the help!

Dear jrmymllr,

previously I have worked on LM3S8962 Evaluation board with ECLIPSE and OpenOCD to upload and debug all work well but now

I have the DK-LM3S9B96 and I have the same problem you have before openOCD can’t find my board :shock: although the lmflash work

can you explain how did you do ? wich name driver and where

If you have a .cfg file working with B96 it would be great if you can post it :roll:

Regards

What version of openocd are you using?

the following config script is included in openocd already - ek-lm3s9b9x.cfg

http://openocd.git.sourceforge.net/git/ … 3b;hb=HEAD

Cheers

Spen

Hi Spen,

I am using the last version : openocd-0.4.0

indeed the ek-lm3s9b9x.cfg existing in this version but I have the same problem as jrmymllr I can’t find the board ???

perhaps due to USB driver but I don’t know which I have to remove and/or replace.

Regards

Romain

Think i understand now, Freddie Chopin’s build of openocd uses the open source ftdi lib.

Whereas the TI software uses the closed driver from ftdi.

The only way you will be able to use the closed source driver with openocd is to build openocd yourself.

There are instructions on the forum on how todo that.

Cheers

Spen

Hi Spen,

many thanks it works now !!

I build openocd myself following this tutorial : http://wiki.openpilot.org/OpenOCD_Compile_on_x86 but I use FTDI drivers present on the CD provided with the kit TI_software_doc\Tools\FTDI and I modified the ek-lm3s9b9x.cfg file in C:\Program Files\OpenOCD\0.4.0\board folder to create an ek-lm3s9b96.cfg

source [find interface/luminary.cfg]
source [find target/lm3s9b9x.cfg]

# jtag speed
jtag_khz 500

jtag_nsrst_delay 100

#LM3S9B9x Evaluation Board has only srst
reset_config srst_only

Thanks a lot

hi guys

had dk-lm3s9b96 with stellaris icdi.

and got a problem connecting to it with openOCD.

d/ek-lm3s9b9x.cfg
Open On-Chip Debugger 0.4.0 (2010-02-22-19:05)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.berlios.de/doc/doxygen/bugs.html
Warn : Interface already configured, ignoring
500 kHz
jtag_nsrst_delay: 100
srst_only separate srst_gates_jtag srst_open_drain
Error: unable to open ftdi device: device not found
Command handler execution failed

I got OpenOCD 0.4.0 for Windows. An msi installer of complete package and it’s md5 checksum. Due to alleged GPLv2 license incompatibility of using ftd2xx.dll libraries, this version was compiled to use libftdi + libusb-win32 libraries.

from http://www.freddiechopin.info

Then delete previous FTDI driver from Stellaris distribution with FTClean.

Then unpack libusb-win32_ft2232_driver-100223.zip, plug usb on, install Luminary Micro Stellaris LM3S811 Evaluation Kit (Channel A), Second channel is not installed, serial port is not installed.

c:\Program Files\OpenOCD\0.4.0\bin>openocd.exe -f interface/luminary.cfg -f boar

d/ek-lm3s9b9x.cfg

WTF? Please help!

Hello,

I am facing the same problem. :oops: The project is built successfully but the debugging fails saying “Error: unable to open ftdi device: device not found”. I have openOCD v0.4.0…will openOCD v0.5.0 solve my problrm?? I am eager to see the breakpoints and registers…Somebody HELP…!!

Hi

I start play with EK-LM3S9B92 Evaluation Kit.

When I try flash and debug with some version of the OpenOCD. I found that version 0.5.0 can connect to stellaris core and flash binary image.

Open On-Chip Debugger 0.5.0 (2011-12-21-14:30)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.berlios.de/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
500 kHz
Info : clock speed 500 kHz
Info : JTAG tap: lm3s9b9x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
Info : lm3s9b9x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'telnet' connection from 4444
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x21000000 pc: 0x00000174 msp: 0x200000fc
auto erase enabled
wrote 1024 bytes from file /tmp/blinky.bin in 0.454855s (2.199 KiB/s)
500 kHz
cortex_m3 reset_config vectreset
Info : JTAG tap: lm3s9b9x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
Warn : Only resetting the Cortex-M3 core, use a reset-init event handler to reset any peripherals

I get latest git, switch it to v0.5.0 tag. Make and make install.

Right now I didn’t understand work it or not because test source is not working.

Now I try flash it under Windows.

I try verify under Windows test binary it is OK. Try flash under Windows it’s same as result.

  1. Test source is bad.

  2. OpenOCD v0.5.0 can flash it

I executed the program with openocd v0.4.0. It works well…whereas v0.5.0 did not work!! :?

Ok, it’s not just me, then. OpenOCD 0.50 here, and it won’t connect to my Stellaris EK-LM3S3749 board (thankfully LMFlash works and I can watch debug spew in Hyperterminal).

I’ll try dropping back to 0.40 and see if that helps.