Source code on github.com has been updated (71b06b6) and now it contains very basic firmware code. I don't want to exactly describe every file as the structure of project might change in the future, but in general there is a Makefile, linker script (link.ld), initialization code (startup.c) add main firmware code (main.c). Cortex-M0 processor vector table layout is described here. Processor of the MCU will begin by executing reset handle function, address of which is stored at address 0x4.
I opened OpenOCD session using:
$ openocd -f openocd-swd.cfg
As I described in the previous log entry, OpenOCD exposes port 3333 for GDB remote debugging, let's give it a go, shall we?$ arm-none-eabi-gdb -q main.elf Reading symbols from main.elf...done. (gdb) target remote localhost:3333 Remote debugging using localhost:3333 reset () at startup.c:67 67 { (gdb) b main Breakpoint 1 at 0x80000f0: file main.c, line 12. (gdb) c Continuing. Breakpoint 1, main () at main.c:12 12 fun(0xab, 0xcd); (gdb) list 7 8 int main(void) 9 { 10 while (1) 11 { 12 fun(0xab, 0xcd); 13 } 14 }As you can tell from the listing above, I started gdb and required main.elf to be loaded (you can also use load command at runtime - for example - to reload symbols), after that using command target I connected to port 3333 of OpenOCD, then I created a breakpoint at function main and requested microcontroller to continue execution.
In the next episode, I'll try to communicate with GPIO peripherals, and maybe - just maybe - read data from the accelerometer.
Catch you later.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.