Jump to content

  •  

Photo

Black Magic Probe for Stellaris Launchpad

black magic probe gdb

  • Please log in to reply
5 replies to this topic

#1 xpg

xpg

    Advanced Member

  • Members
  • PipPipPip
  • 101 posts


Posted 22 May 2013 - 05:28 PM

I got a bit tired of not being able to debug on the NXP LPC1114, which supports SWD only (no JTAG). I discovered Black Magic Probe (http://www.blacksphe...main/blackmagic), which is an open source project that uses an STM32 to export a GDB server via an USB serial device. It support both JTAG and SWD and should support a wide range of Cortex-M0, M3, and M4 targets. It can be used both for debugging and flashing of the target device.
There is dedicated hardware for this, and it can be run on the F4-discovery boards as well. Unfortunately, I do not have any F4-discovery boards lying around. But I do have a couple of Stellaris Launchpads that do nothing but sit in their box. So I added the necessary code to allow the Black Magic Probe firmware to be flashed on the Stellarpad (which really wasn’t that much).
 
Currently, UART0 on the LM4F is used, which is connected to the on-board debugger module that exports it via USB as a CDC ACM serial device.
 
The pinout is as follows:
JTAG TMS / SWD IO  - PB5
JTAG TCK / SWD CLK - PB0
JTAG TDI           - PB1
JTAG TDO           - PE4
TRST               - PA5
SRST               - PA6

IDLE LED           - PF2 / Blue LED
ERROR LED          - PF3 / Green LED
You can grab the code from GitHub and try it out yourself: https://github.com/x...laris_launchpad
 
Please try it out, and let me know if there are any issues.
 
The quick build instructions (for Linux) are:
src$ git clone https://github.com/xpgdk/blackmagic.git
Cloning into 'blackmagic'...
remote: Counting objects: 1858, done.
remote: Compressing objects: 100% (763/763), done.
remote: Total 1858 (delta 1230), reused 1704 (delta 1084)
Receiving objects: 100% (1858/1858), 610.80 KiB | 324 KiB/s, done.
Resolving deltas: 100% (1230/1230), done.
src$ cd blackmagic
src/blackmagic$ git checkout stellaris_launchpad
Branch stellaris_launchpad set up to track remote branch stellaris_launchpad from origin.
Switched to a new branch 'stellaris_launchpad'
src/blackmagic$ git submodule init
Submodule 'libopencm3' (https://github.com/xpgdk/libopencm3.git) registered for path 'libopencm3'
src/blackmagic$ git submodule update
Cloning into 'libopencm3'...
remote: Counting objects: 12626, done.
remote: Compressing objects: 100% (6494/6494), done.
remote: Total 12626 (delta 6511), reused 11757 (delta 5726)
Receiving objects: 100% (12626/12626), 3.25 MiB | 733 KiB/s, done.
Resolving deltas: 100% (6511/6511), done.
Submodule path 'libopencm3': checked out 'f5c15fe74e438dc9cceac6543d2c180957a3dd9b'
src/blackmagic$ cd libopencm3
src/blackmagic/libopencm3$ make
…
src/blackmagic/libopencm3$ cd ../src
src/blackmagic/src$ make PROBE_HOST=stellaris-launchpad
…
src/blackmagic/src$ lm4flash blackmagic.bin
Now, you should be able to connect to the GDB server:
$ arm-none-eabi-gdb
(gdb) target extended-remote /dev/ttyACM0
(gdb) monitor swdp_scan
Target voltage: not supported
Available Targets:
No. Att Driver
 1      lpc11xx
(gdb) attach 1
Attached to Remote target
0x00001066 in ?? ()

  • bluehash, Rickta59, oPossum and 2 others like this

#2 bluehash

bluehash

    Administrator

  • Administrators
  • 861 posts
  • LocationWaltham, MA

Posted 22 May 2013 - 10:09 PM

Thanks xpg!


C2KCentral - C2000 News, Projects and Forums | 43oh - MSP430 Discussion, News and Projects. | Stellarisiti - Stellaris ARM Forums, Projects and News.

#3 spirilis

spirilis

    Advanced Member

  • Members
  • PipPipPip
  • 205 posts


Posted 06 May 2014 - 01:40 AM

Sweet, just got this rolling on a Tiva-C LaunchPad pretty much as your directions stated!  Trying to connect to an LPC810 (crossing fingers)...

Step in the middle I forgot under Linux:

 

stty -F /dev/ttyACM0 115200

 

Then arm-none-eabi-gdb detects it:

(gdb) target extended-remote /dev/ttyACM0
Remote debugging using /dev/ttyACM0
(gdb) monitor swdp_scan
Target voltage: not supported
Available Targets:
No. Att Driver
 1      ARM Cortex-M
(gdb) attach 1
Attaching to Remote target
0x1fff00c4 in ?? ()

Also, leave the TRST/SRST lines disconnected or else it'll fail to find the chip.

Time to try writing something to this baby!

edit: hmm, load fails.

(gdb) load
Loading section .text, size 0x4c lma 0x8000
Load failed

LPC800 series isn't officially supported by BMP from what I can tell so maybe that's why.



#4 spirilis

spirilis

    Advanced Member

  • Members
  • PipPipPip
  • 205 posts


Posted 06 May 2014 - 02:21 AM

@xpg Is there any chance you could re-port your target to the current BMP code?  I noticed the lpc driver was split out to a separate lpc11xx vs lpc43xx and would like to experiment with it... (and maybe add lpc810 support once I figure out the innards, which actually don't look all that frightening after having some OpenOCD hacking experience)

 

The platforms/stellaris-launchpad code does compile when dropped in the new ver with a minor change (add "bool assert" to jtagtap_srst() as an argument) but I'm not able to attach to the chip at all unlike your version of BMP+stellaris-launchpad platform... something else may have changed in the base API for bmp that I'm not aware of.  The blue LED does light at least though.



#5 xpg

xpg

    Advanced Member

  • Members
  • PipPipPip
  • 101 posts


Posted 09 May 2014 - 08:45 AM

@xpg Is there any chance you could re-port your target to the current BMP code?  I noticed the lpc driver was split out to a separate lpc11xx vs lpc43xx and would like to experiment with it... (and maybe add lpc810 support once I figure out the innards, which actually don't look all that frightening after having some OpenOCD hacking experience)

 

Sure, I'll have a look at it as soon as I have some time on my hands. Actually I had plans to get the code merged into BMP, but I got sidetracked by other projects. Maybe it is time to restart that work :-)

 

I can't give you a timeline, but it's on my todo list :-)



#6 spirilis

spirilis

    Advanced Member

  • Members
  • PipPipPip
  • 205 posts


Posted 09 May 2014 - 01:34 PM

Sure, I'll have a look at it as soon as I have some time on my hands. Actually I had plans to get the code merged into BMP, but I got sidetracked by other projects. Maybe it is time to restart that work :-)

 

I can't give you a timeline, but it's on my todo list :-)

I think it'll be worthwhile.. Thanks again!







Also tagged with one or more of these keywords: black magic probe, gdb

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users