OpenOCD and SIMtrace

OpenOCD and SIMtrace

This is just a short note to myself (and then copied into our SIMtrace wiki).

This is working for OpenOCD (74558296d1e185fc4a7522f08832eceed460cbd7) and the Amontec JTAGKey (but should work with any JTAG adapter). The easiest way is to start OpenOCD with default config files.

The SIMtrace v1.0 hardware is powered by the Atmel SAM7S microcontroller and the closest match for this platform is the atmel_at91sam7s-ek.cfg board configuration file.

First try

$ sudo openocd -f interface/jtagkey.cfg -f board/atmel_at91sam7s-ek.cfg

Error: An adapter speed is not selected in the init script. Insert a call to adapter_khz or jtag_rclk to proceed…

Second try

You can patch one of the two files, create a new config file and load it with -f
or specify the command. The below example specifies it on the command line.

$ sudo openocd -f interface/jtagkey.cfg -f board/atmel_at91sam7s-ek.cfg -c “adapter_khz 30”

Final config

$ echo “adapter_khz 30
> arm7_9 dcc_downloads enable
> init
> reset init
> ” > myinit.cfg

$ sudo openocd -f interface/jtagkey.cfg -f board/atmel_at91sam7s-ek.cfg -f myinit.cfg

One of the calls appear to fix ‘halt’ not really halting the SoC, I have not investigated which of the options is doing it.

Flashing First try

$ telnet 127.0.0.1 4444
> flash write_image /tmp/main_simtrace.samba 0 bin
wrote 0 bytes from file /tmp/main_simtrace.samba in 0.238727s (0.000 KiB/s)

With a quick look into the NOR Flash code, it appears to fail as it does not
find a flash region at the address it is looking for one and then reports to
you the success of 0 bytes (instead of a failure).

Flashing Working

$ telnet 127.0.0.1 4444
> flash write_bank 0 /tmp/main_simtrace.samba 0
wrote 37020 bytes from file /tmp/main_simtrace.samba to flash bank 0 at offset 0x00000000 in 39.175068s (0.923 KiB/s)
> reset init
> resume

Creating a small GUI for the SIMtrace application

Creating a small GUI for the SIMtrace application

Earlier this year I created a Hardware company with a friend to supply to our GSM community and beyond. One of our first products is the SIMtrace Hardware (CC Licensed, actually it should work with any Smartcard). Today I had to wait a bit and decided to convert the CLI application that talks to the firmware to a GUI application. I did this by running the CLI part in a QThread and using QMetaObject::invokeMethod to callback to my GUI.

I started off creating the Qt application with VIM and a browser to help me to remember some function names. After a while I had enough of this and used Qt Creator and enjoyed the auto completion, it had no problem reading our C header files of libosmocore and provided auto completion for these too. Once again I am amazed how nice Qt Creator is and how little code I needed to create the below.

From October 13, 2011