When I run ledControl example of ArduinoBLE library, is OK.
But when I debug, it stops at BLE.begin() with an exception.
Any idea about a solution?
When I run ledControl example of ArduinoBLE library, is OK.
But when I debug, it stops at BLE.begin() with an exception.
Any idea about a solution?
Please file an issue at Issues ¡ platformio/platform-atmelsam ¡ GitHub, maybe the devs know more.
I bought the business support but I havenât received an access yet. How do I ask for the access?
BTW the âstop the warâ banner is hiding the send button and I have to close the window and resume the topic to be able to press the Reply button. Not convenient.
CC @ivankravets
Indeed. Reloading the page a 3times fixes it ("Stop the war" banner makes it difficult to Reply to messages - #4 by ivankravets).
Sorry, we will finally fix it
Do you have custom breakpoints in IDE?
No custom breakpoints
Letâs start with something simple:
pio debug --interface=gdb pio debug --interface gdb -x .pioinit
Where does it stop now?
The crash is somewhere related to the USB serial problem. I find a workaround:
Ah indeed, actually that was noticed 2 years ago too: Problems starting debug session with jlink on feather M0 - #6 by RoSchmi
But noone ever found the cause.
Removing the bootloader in the topic above helped though.
Interestingly, the official Arduino guide does not include any steps with removing the bootloader. Could someone try Arduino IDE 2.0 and their simple example? Do you experience the same problems?
It seems like a board-related issue, not J-Link or PlatformIO.
I try on Arduino 2.0 rc6 with a simple loop. USB connection is OK if I put my breakpoint after the 1 sec delay. With platformio, it do not work with the same breakpoint.
If I put the breakpoint before the 1 sec delay, Arduino 2.0 loose USB connection also.
Looks like USB connection is reseted after debug start, then it needs some time to set up wit the target running. If a bkp is met before, the USB is not finalized in time and Window threw âUSB not recorgnizedâ
Did you also disable the initial breakpoint in PlatformIO? See Redirecting...
So, you can remove all breakpoints in IDE and set just the initial breakpoint to the loop
:
debug_init_break = tbreak loop
Same problem is happening with ozone debugger from Segger. Segger support proposes a solution that is working. See https://wiki.segger.com/Debug_on_a_Target_with_Bootloader#ROM_bootloader
"Should your setup be that you have a bootloader in ROM that needs to be executed first simply leave the functions AfterTargetDownload() and AfterTargetReset() empty (but not commented out!). This will override Ozoneâs default and nothing will be executed so the ROM bootloader can run without interference and jump to the application space where per default Ozone will then stop at main "
Is it possible to do the same with platformIO? (âPIO Debug with bootloader initâ in launch.json)
Where are these functions implemented? It looks like docs about how to use Seggerâs DLL.
Which steps/operations should be performed in this case? Is it possible to configure Ozon using âinitâ commands? See default commands for JLink platformio-core/platformio/debug/config/jlink.py at develop ¡ platformio/platformio-core ¡ GitHub
Yes, it is a script *.jdebug called by the debugger Segger Ozone. It sets the vector table,SP, PC from application elf file. I want to be set to the bootloader vector table, SP, PC have a proper HW initialization.
In Ozone, the functions AfterTargetDownload() and AfterTargetReset() shall be empty to do this.
I mean with VCS and debug_server jlink.Similar to the above script, VSC should have a script given to jlink debugger when started.
You already declared custom debug_server
in the platformio.ini
. So, use -jlinkscriptfile
option as described in J-Link GDB Server - SEGGER Wiki
[env:mkrwifi1010]
platform = atmelsam
board = mkrwifi1010
framework = arduino
debug_tool = jlink
debug_server =
C:/Program Files (x86)/SEGGER/JLink/JLinkGDBServerCL
-singlerun
-if
SWD
-select
USB
-port
2331
-device
ATSAMD21G18
-jlinkscriptfile
path/to file/demo.JLinkScript
Does this work for you?