Skip to content
Joel Stanley edited this page Jan 18, 2017 · 2 revisions

Building the firmware

$ sudo apt-get install gcc-arm-none-eabi binutils-arm-none-eabi
$ git clone https://github.com/shenki/micropython/ -b microbit
$ cd micropython/microbit
$ make

Using DAPLINK as a GDB server

Build

$ sudo apt-get install gdb-arm-none-eabi gcc-arm-none-eabi
$ git clone https://github.com/mbedmicro/pyOCD
$ cd pyOCD
$ virtualenv -p python2 --system-site-packages .venv
$ source .venv/bin/activate
$ python setup.py install

Running

$ source .venv/bin/activate
$ python2 pyOCD/tools/gdb_server.py -d debug

In a second window:

$ arm-none-eabi-gdb -q build/firmware.elf -ex "target remote localhost:3333" -ex "load"
Reading symbols from build/firmware.elf...done.
Remote debugging using localhost:3333
HardFault_Handler () at TARGET_MCU_NRF51822/TOOLCHAIN_GCC_ARM/startup_NRF51822.S:196
196	    B       .
Loading section .text, size 0x16d60 lma 0x0
Loading section .ARM.exidx, size 0x8 lma 0x16d60
Loading section .data, size 0x7c lma 0x16d68
Start address 0x1108c, load size 93668
Transfer rate: 16 KB/sec, 1873 bytes/write.
(gdb) info registers 
r0             0x1c8	456
r1             0x104	260
r2             0x40000000	1073741824
r3             0x1	1
r4             0xffffffff	-1
r5             0xffffffff	-1
r6             0xffffffff	-1
r7             0xffffffff	-1
r8             0xffffffff	-1
r9             0xffffffff	-1
r10            0xffffffff	-1
r11            0xffffffff	-1
r12            0xffffffff	-1
sp             0x20003fe0	0x20003fe0
lr             0xfffffff9	-7
pc             0x1108c	0x1108c <Reset_Handler>
xpsr           0x21000003	553648131
msp            0x20003fe0	536887264
psp            0xfffffffc	-4
primask        0x0	0
control        0x0	0
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
HardFault_Handler () at TARGET_MCU_NRF51822/TOOLCHAIN_GCC_ARM/startup_NRF51822.S:196
196	    B       .
(gdb)

Clone this wiki locally