Skip to content

implement single step debug on arm cortex core without a gdb or Trace32

Notifications You must be signed in to change notification settings

cheng3100/armdbg

Repository files navigation

About This Project

Maybe you are familiar with debugging armchip with a debugger like J-link or Trace32, which can be use to set break points and step through.

But can you image how to do these ==without any debugger or debug interface== ? This project give you a way to do all these just by a uart !

This demo running on a stm32f103rc, but any cortex-based chip is also adaptable by change the link script and replace the hal lib api.

Getting Started

Setting Environment

This project is running at a Linux environment.It is possible porting it to Windows but I don't like the idea. You had better switch to a Linux system.

You should make sure you have already install these tools before start this project at least:

There are other tools are recommended:

  • picocomm It is my favorite serial client for Linux. You can install it very easily on Ubuntu by : sudo apt install picocomm

Tips: Make sure you have add the install path to system path for all the tools!

Compile

Just type this in the root of project

make

The output file like elf, asm etc can be found at build directory.

Also make clean will clean up all build result.

Debug

Connect the St-link or J-link between your board and computer. Then open one terminal, type:

make gdbserver

Then you should see it set up a 3333 gdb port. Then open another terminal, type:

make gdb

Then it will connect to the gdb server and halt stop. You can type the normal gdb command like c to continue execute it or bt to check the stack frame.

flash

Connect the St-link or J-link as the same way.Then

make flash

It will compile and load the elf file to the chip flash.

Start Shell

Just type:

picocomm /dev/ttyUSB0 -b115200 --omap crcrlf

Note: The /dev/ttyUSB0 is the uart port on my system. You should replace it with yours.

You can type help in the shell to see the available command.

Acknowledgements

This project is inspired by the blog interrupt. I learn a lot from here. Thanks!

About

implement single step debug on arm cortex core without a gdb or Trace32

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages