Sketch uses 14388 bytes (5%) of program storage space. Maximum is 262144 bytes.
Global variables use 2992 bytes (9%) of dynamic memory, leaving 29776 bytes for local variables. Maximum is 32768 bytes.
Open On-Chip Debugger 0.10.0+dev-gf0767a31 (2018-06-11-13:36)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 0
none separate
adapter speed: 400 kHz
cortex_m reset_config sysresetreq
Error: unable to open CMSIS-DAP device 0x3eb:0x2157
Error: No Valid JTAG Interface Configured.
Failed uploading: uploading error: exit status 0xffffffff
There are a couple of posts [1] about it and it seems I have to install something called "Openocd". No idea what that is. Going onto OpenOCD's website, I am linked to a github repo.
The GH repo's instructions are gibberish to me. I get I have to run openocd command but do I have to build this app first? If so how? And when would I run it relative to when I press the debug button on the Arduino 2 IDE?
I followed [1]'s advice but Arduino IDE 2 is still using openocd version 0.10.0 instead of the newer 0.10.2.
The path to the openocd binary has been added to my system and user environment variables (I checked by invoking it in cmd prompt).
My platform.txt file (located in C:\Users\MT\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.14\platform.txt) looks like this:
# Debugger configuration (general options)
# ----------------------------------------
# EXPERIMENTAL feature:
# - this is alpha and may be subject to change without notice
debug.executable={build.path}/{build.project_name}.elf
debug.toolchain=gcc
debug.toolchain.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
debug.toolchain.prefix=arm-none-eabi-
debug.server=openocd
#debug.server.openocd.path={runtime.tools.openocd-0.10.0-arduino7.path}/bin/openocd
debug.server.openocd.path=c:/Users/MT/Desktop/SynologyDrive/Code/Arduino/libraries/OpenOCD-20240916-0.12.0/bin/openocd
debug.server.openocd.scripts_dir={runtime.tools.openocd-0.10.0-arduino7.path}/share/openocd/scripts/
debug.server.openocd.script={runtime.platform.path}/variants/{build.variant}/{build.openocdscript}
The zero is probably the easiest board to get debugging going (I am talking about the original Arduino Zero - clones do not have the onboard debug chip). Nothing else but IDE V2 is needed.
As @Juraj says you need to connect to the Debug USB port. Also you need to select Atmel EDBG programmer in Tools.
I bought it from Amazon, from an "Arduino Store" seller. Here
The back of the Zero I was shipped does not have the half-white silk screen. I just assumed it was a more recent revision of the board - but it sounds like it might be a clone (gdi Amazon).
Can you confirm the back of the zero is suppose look like this (mine is fully blue - will upload a picture of it after work)?
All the sites seem to show those pictures. I think they are from the early versions.
Mine is all blue at the back. It also has single block pin sockets with wrongly labeled PWM pins (it actually matches the pins for the UNO R4 WiFi I also have - that uses the same single pin blocks).
There are also circuit updates. Mine actually matches the latest schematic on the Arduino site and is labeled as Version 4.0, so I assume it is the latest. If you want I can post some pics.
I had absolutely no problem getting it to work with the latest Arduino IDE V2. Did not need to add anything other than installing the Arduino SAMD boards core. Then compiling for the Arduino SAMD boards/Arduino Zero (Programming Port).
Your board is the same as both mine. You will notice the ~ PWM symbol on the board silkscreen and the connector are not the same, and they are both wrong(??)
As @ptillisch mentioned in your above link, the Arduino ∞ symbol is a give away that it is genuine.
The replacement Arduino I received from Amazon and the official Arduino store are the same. I returned the Amazon board and kept the official one (I think they're the same).
Having used it a few days now, I have a better feel for the quirks.
To upload a sketch, I have to connect to the USB "Native Port". To debug, I have to use the USB "Programming Port" (closest to the barrel connector). I must successfully upload the sketch before using the Programming Port to start a debug session.
Serial.prints() do not output immediately to the console while step debugging. Might be a bug of the IDE.
Going by your pictures in post #8 I am sure they are the same. Glad you are sorted on that.
I do not understand why you need to switch to native port to upload. I think the code generated for "native port" and "programming port" are different. So when you program for "programming port" it should upload via that and not via "native port".
I have "Arduino Zero (Programming Port)" selected in board manager and never need to switch ports between upload and debugging. I have not tried to upload to the native port after compiling for the programming port.
The print delay you notice can be roughly explained as follows:
When you single step the clock is stopped after each instruction. The print() instruction placed the output in the serial buffer (assuming you used "Step Over") and now needs clock cycles to move it to the serial output. Hence no output will be seen till you moved on allowing some clock cycles.
Just checked compiling, upload and debug (with the above print delay) needing no port swaps.
A good thread on the debugger is here. Most of the mentioned problems are still there. I find two in particular a problem.
In earlier reviews it was mentioned that hovering over a variable shows its value. This does not happen anymore - only the editor default is shown. Each variable you want to check needs to be added to the "Watch" list. Due to this I find it sometimes still easier to just add prints for debugging.
Checking something in the "Variables" list needs expanding and searching till you find it. Then, when you click to step, it collapses and the search starts again - almost unusable (for me).
Some things it is great for - checking registers etc.
Would like to hear your views after using the debugging feature for a while.
Note: You can only have 4 active breakpoints for the Zero.