Eclipse + debug user-part.elf problem

I have now get the local compile up and running with out any problem with the latest branch of Photon smile
When I upload the compiled (default tinker) *.bin file with dfu both direct from compile or later everything works great.

Problem is when it comes to the *.elf file. I get the STLinkV2 to download it and Photon boot up correct.
But STLink don’t stop at the first breakpoint at setup() and then Particle Android app says that the unit is online but not with the tinker app. If I leave the debugger connected to the target and choose to flash it from the Android app with the tinker code then after the reboot after flash debugger halt at the breakpoint and I could do stepping.

I have checked the user-part.map and .module_start 0x080a0000 it seems right. Bootloader works correct so it looks like the debugger flash the right address area.

Any ideas anyone ?

I usually don’t download .elf files - just flash via DFU the .bin file and then just point the debugger to the elf file (so it has mapping from source code to device address.)

Hope that helps!
mat.

Also you might want to consider upgrading the version of st-link firmware.

Hi Mat !
Thanks for your replay!
I think I have the latest st-link fw but I will check.

Only option I found around this problem was to build with MODULAR=n . Then my debugger jumped to the right address.
I’m not any expert on GDB, but I think I have to put any command in the GDB startup commands that tell GDB to not upload *.elf just to map it to the *.bin file ? Do I have to put any address offset to 0x80A0000 in GDB or it take this info from the *.elf ?

My Startup Initialization commands for GDB:

set remotetimeout 20
monitor reset init
monitor sleep 50

BR /Martin

For modular=n, the base address is 0x8020000.

There’s a discussion here about loading the various .elf files without using modular=n, and that might help too. 5 steps to setup and use a debugger with the Photon

Yes, start address of the flash. Because of that and hole code is known for the debugger and in the *.elf MODULAR=n works.

But I don’t wan’t be forced using MODULAR=n, Want to be able to do modular build and debug as you.
Thanks for the link to the discussion , will take a look.

fwiw, I tend to either use modular=n if the problem is truly cross-modular, or debug individual modules.