Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Wojtek on August 25, 2017, 07:10:41 pm

Title: How to debug .elf file with a code::blocks GDB/CDB debugger
Post by: Wojtek on August 25, 2017, 07:10:41 pm
Hi,
I have compiled an ARM project with gcc compiler and got .elf file.
However, I do not know how to debug this project.
Any help would be appreciated.
Thanks.
Title: Re: How to debug .elf file with a code::blocks GDB/CDB debugger
Post by: Wojtek on August 25, 2017, 07:12:35 pm
I get the following error:

[debug]Error creating process D:/wj_CCode/wj_ARM_SAMA5/wj_Test1/default/wj_Test1.elf, (error 193).
[debug]Starting program: D:/wj_CCode/wj_ARM_SAMA5/wj_Test1/default/wj_Test1.elf
[debug]>>>>>>cb_gdb:
Title: Re: How to debug .elf file with a code::blocks GDB/CDB debugger
Post by: BlueHazzard on August 25, 2017, 07:37:06 pm
What debugger are you using?
You can not debug arm binaries on the development machine...
Title: Re: How to debug .elf file with a code::blocks GDB/CDB debugger
Post by: Wojtek on August 25, 2017, 08:16:47 pm
Thank you for reply.
What debugger do I need for working with ATMEL-ICE and code::blocks?
Title: Re: How to debug .elf file with a code::blocks GDB/CDB debugger
Post by: BlueHazzard on August 25, 2017, 09:08:07 pm
this can be a bit complicated:
# You have to add the debugger to the settings:
1) Settings->Debugger->GDB/CDB->Create Config-> Enter a usefull name like ARMGDB
2) Switch to the new configuration
3) Executable path-> Set the path to the the gdb in your arm toolchain folder
4) Untick "Enable watch scripts", "Disable startup scripts"
5) Ok
# Set up the project
1) Project->Properties->Debugger->Select target:<Project> ->Remote connection:
Ip address: 127.0.0.1 Port: 2331
2) Additional GDB commands:
Code
monitor reset
load
3) Ok
Now you have to start the gdb server for the ATMEL-ICE. Then you can run the debugger...
Title: Re: How to debug .elf file with a code::blocks GDB/CDB debugger
Post by: BlueHazzard on August 25, 2017, 09:43:32 pm
ok, i have read into this and you probably won't find an easy gdb server for the amtel-ice. It is a shame that atmel does not support opens source any more....
You have two possibilities:
* AVaRICE
* OpenOCD

For ACaRICE you probably need cygwin and have to compile it by yourself....

#For OpenOCD:
you can get a ready build binary via pacman from here http://www.msys2.org/
After this you can follow this guide: http://omzlo.com/articles/programming-samd21-using-atmel-ice-with-openocd It is for mac, but just use the steps to configure openocd...