eclipse+gcc compiler and debugging micropython

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
User avatar
fkeujjpdc
Posts: 13
Joined: Thu Mar 23, 2017 3:17 am
Location: china

eclipse+gcc compiler and debugging micropython

Post by fkeujjpdc » Fri Mar 24, 2017 9:17 am

i want add the micropython to my exist project.my project develop by MDK,i must change to gcc,buf i want have a human debug environment. eclipse + gcc can develop STM32,but i have no idea add micropython to eclipse.

flindt
Posts: 11
Joined: Tue Jun 20, 2017 8:51 am

Re: eclipse+gcc compiler and debugging micropython

Post by flindt » Tue Jun 20, 2017 10:08 am

Assuming you are running eclipse-cdt, you need just a few steps for this.

1) Import the code as "existing makefile project" (Im using the sthal build to run on a STM32F429DISC board)
2) define a new build variable "BOARD" = "STM32F429DISC" in the project properties.
3) Build the project
4) Create an external tool config to run "st-util". Im running linux, so mine is in /usr/local/bin/st-util. Set the working directory to ${workspace_loc:/stmhal/build-STM32F429DISC}
5) Run the tool. In the console it should say : "src/gdbserver/gdb-server.c: Listening at *:4242..."
6) Setup a debug configuration and change the "startup" tab to this:
- use file : ${workspace_loc:/stmhal/build-STM32F429DISC/firmware.elf}
- load file : ${workspace_loc:/stmhal/build-STM32F429DISC/firmware.elf}
- enable "set breakpoint at : main" + "Resume"

And run the debug :)
Let me know if you get stuck - most problems here are easy, once you know the solution.

ajie_dirgantara
Posts: 81
Joined: Fri Sep 02, 2016 9:26 am

Re: eclipse+gcc compiler and debugging micropython

Post by ajie_dirgantara » Thu Jun 29, 2017 4:05 pm

flindt wrote:Assuming you are running eclipse-cdt, you need just a few steps for this.

1) Import the code as "existing makefile project" (Im using the sthal build to run on a STM32F429DISC board)
2) define a new build variable "BOARD" = "STM32F429DISC" in the project properties.
3) Build the project
4) Create an external tool config to run "st-util". Im running linux, so mine is in /usr/local/bin/st-util. Set the working directory to ${workspace_loc:/stmhal/build-STM32F429DISC}
5) Run the tool. In the console it should say : "src/gdbserver/gdb-server.c: Listening at *:4242..."
6) Setup a debug configuration and change the "startup" tab to this:
- use file : ${workspace_loc:/stmhal/build-STM32F429DISC/firmware.elf}
- load file : ${workspace_loc:/stmhal/build-STM32F429DISC/firmware.elf}
- enable "set breakpoint at : main" + "Resume"

And run the debug :)
Let me know if you get stuck - most problems here are easy, once you know the solution.
I've done all, except after flashing the firmware, it detect 6 HW breakpoint, raised error can't set hardware breakpoint and then stop debug process. why is this?

flindt
Posts: 11
Joined: Tue Jun 20, 2017 8:51 am

Re: eclipse+gcc compiler and debugging micropython

Post by flindt » Mon Jul 24, 2017 7:24 am

First check the output of the st-util. The easiest way to do this is to run it in a separate terminal.

Then try the same thing "manually" by using gdb directly - this will let you know whether it is an eclipse problem or not.
The gdb commands you need are:

Code: Select all

arm-none-eabi-gdb

target remote localhost:4242
load yourBinaryFile.elf
break main.c
continue
Post the output here.

Post Reply