2011-02-06 22:01:10 +00:00
|
|
|
=======================================
|
|
|
|
The Black Magic Debug Project -- README
|
|
|
|
=======================================
|
|
|
|
|
|
|
|
The Black Magic Debug Probe is gadget providing an in-application
|
2013-03-16 21:33:19 +00:00
|
|
|
debug capability for ARM Cortex-M microcontrollers. It interfaces
|
|
|
|
with the GDB, the GNU source level debugger over the USB bus, and
|
|
|
|
communicates with the target microcontroller over either a JTAG or
|
|
|
|
Serial Wire debug port.
|
2011-02-06 22:01:10 +00:00
|
|
|
|
|
|
|
Currently supported microcontrollers:
|
|
|
|
|
|
|
|
- ST STM32 Family
|
|
|
|
- TI/LMI Stellaris Family
|
2011-12-26 10:56:10 +00:00
|
|
|
- NXP LPC11xx Family
|
2013-03-16 21:33:19 +00:00
|
|
|
- Atmel SAM3X
|
2011-02-06 22:01:10 +00:00
|
|
|
|
2011-02-09 03:56:42 +00:00
|
|
|
|
|
|
|
Getting started
|
|
|
|
===============
|
|
|
|
The Black Magic Probe is available as a built-up product form Black
|
|
|
|
Sphere Technologies. Contact <sales@blacksphere.co.nz> should
|
|
|
|
you wish to order one. If you would like to work on the project see
|
|
|
|
the file HACKING for developer's info.
|
|
|
|
|
|
|
|
When connected via USB, the Black Magic probe will enumerate as a CDC-ACM
|
|
|
|
device which the OS should present as a tty device or serial port. The
|
|
|
|
GDB remote debugging protocol is implemented over this virtual character
|
|
|
|
stream. To connect your ARM GDB to the target device use the following
|
|
|
|
commands:
|
|
|
|
|
|
|
|
(gdb) target extended-remote /dev/ttyACM0
|
|
|
|
(gdb) mon jtag_scan
|
|
|
|
(gdb) attach 1
|
|
|
|
|
|
|
|
The command 'mon swdp_scan' may be used to use the Serial-Wire Debug Protocol
|
|
|
|
instead of JTAG to connect to the target.
|
|
|
|
|
|
|
|
Once attached, all the standard GDB commands may be used to start and control
|
|
|
|
the execution of the embedded application.
|
|
|
|
|
2013-01-21 10:01:44 +00:00
|
|
|
The peripheral registers are not included in the memory map provided to GDB.
|
|
|
|
I suggest you add the command "set mem inaccessible-by-default off' to
|
|
|
|
your '.gdbinit'. That will allow you to access addresses outside of
|
|
|
|
the memory map. It will treat anything outside of the memory map as
|
|
|
|
RAM.
|
2011-02-09 03:56:42 +00:00
|
|
|
|
2013-04-14 17:58:49 +00:00
|
|
|
Semihosting support
|
|
|
|
===================
|
2013-04-15 17:42:46 +00:00
|
|
|
Standard ARMv6-M/ARMv7-M semihosting is supported, i.e. you can build
|
|
|
|
your application in a special way to have calls to certain functions
|
|
|
|
(open(), close(), read(), write(), lseek(), rename(), unlink(),
|
|
|
|
stat(), isatty(), system()) executed on the debugging host itself. To
|
|
|
|
make use of these facilities, add --specs=rdimon.specs and -lrdimon to
|
2013-04-14 17:58:49 +00:00
|
|
|
the linker flags for your firmware.
|
|
|
|
|
2013-04-15 17:42:46 +00:00
|
|
|
If you're going to use stdin, stdout or stderr (e.g. via
|
|
|
|
printf()/scanf()) and you're not using newlib's crt0 (by specifying
|
|
|
|
-nostartfiles), you need to add this to your initialisation:
|
|
|
|
|
|
|
|
void initialise_monitor_handles(void);
|
|
|
|
initialise_monitor_handles();
|
2013-04-14 17:58:49 +00:00
|
|
|
|
2011-02-06 22:01:10 +00:00
|
|
|
Project layout
|
|
|
|
==============
|
2013-03-16 21:33:19 +00:00
|
|
|
driver/ - Windows drivers for the Black Magic probe hardware.
|
2011-02-06 22:01:10 +00:00
|
|
|
flashstub/ - Source code for flash programming stubs in target drivers.
|
2012-01-28 00:17:15 +00:00
|
|
|
hardware/ - Schematic (gschem) and PCB layout for the Black Magic Probe
|
2013-03-16 21:33:19 +00:00
|
|
|
hardware/contrib/ - User contributed hardware variants.
|
|
|
|
libopencm3/ - Submodule for the libopencm3 library needed for stm32 platforms.
|
2011-02-06 22:01:10 +00:00
|
|
|
scripts/ - Python scripts useful for programming devices.
|
|
|
|
src/ - Firmware source code for the Black Magic debug probe.
|
2013-03-16 21:33:19 +00:00
|
|
|
upgrade/ - Alternate firmware upgrade tool written in C.
|
2011-02-06 22:01:10 +00:00
|
|
|
|