Source level debug - IDE2 - GIGA R1

Sorry I know it I am probably missing where it is already described. But I did not find any complete set of instructions.

Suppose I ran some sketch like the DirList example, and I know, that the system crashed, somewhere in this code.

void setup() {

  pinMode(PA_15, OUTPUT);
  digitalWrite(PA_15, HIGH);
  Serial.begin(115200);
  while (!Serial)
    ;

  Serial.println("Starting USB Dir List example...");

  // if you are using a Max Carrier uncomment the following line
  // start_hub();

  while (!msd.connect()) {
    //while (!port.connected()) {
    delay(1000);
  }

  Serial.print("Mounting USB device... ");

More specifically, the Serial monitor shows the line: Starting USB Dir List example...
Although not the line ending

And I don't see the line Mounting USB device... And the board goes into the blinking Red state of a crash...

Now what?

Can I source level debug this?

I downloaded the source tree, into the /hardware/... directory. patched the API link, etc. So the board now shows up twice in the boards list. Similar for UNO R4 stuff...

A friend pointed me to the website:
Arduino Giga R1 WiFi - SEGGER Wiki

Which I looking through.

Note: I have a ST_LINK/V2 as well as a J-LINK EDU Mini, as well as another small debugger that I think it was @ptillisch suggested for another board.
Suggestion on which JTAG unit is best for this?

Do you use the Debugger that is part of IDE2? If so how do you enable it.
If I remember correctly, there needs to be something like a debug section in platform.txt?

Or do you use an external debug window?

Sorry I know this probably could be better organized.

Kurt

1 Like

Hi Kurt,

I guess you are using the Arduino IDE?

You have a couple of options as I couldn't get the Arduino IDE to debug the giga, it just looks like it is not supported:

  1. Use PlatformIO and the jlink using cortex-debug.

  2. Use Arduino but use the Segger Ozone debugger: https://docs.arduino.cc/tutorials/portenta-breakout/breakout-jlink-setup

The Giga R1 is not a supported board in PlatformIO, I have a PR put in to add it but who knows if that will ever happen.

If you want to get PlatformIO setup up let me know, the easiest bet may be to use Ozone though if you are using the Arduino IDE.

Cheers

Andy

1 Like

Thanks,

I now have Ozone setup. It complains each time saying the MINI EDU version does not come with a license for it but you can use for evaluation purposes....

The Dir List had a hard crash yesterday. This mornign I tried setting breakpoints and Walk over the section of code where the crash was happening. And this time it actually completed the directory list.

Starting USB Dir List example...
Mounting USB device... done.
Opening the root directory... Done
done.
Root directory:
    System Volume Information
    P1000391.JPG
    P1000392.JPG
    P1000393.JPG
    P1000394.JPG
    P1000395.JPG
...
    P1000386.JPG
    P1000387.JPG
    P1000388.JPG
    P1000389.JPG
    P1000390.JPG
53 files found!
Closing the root directory... OK

So maybe a timing issue?

Would still be nice to get it to work directly in the IDE, but...

Sounds like a timing issue.

If you fancy using Visual Code and PlatformIO and debugging from in there then there is an example project you can use for the moment: GitHub - Haschtl/pio-arduinogiga: Platformio configuration for Arduino GIGA R1

From:

If you are just using the M7 the built in platformio debugger will work with that project with platformio.ini like this:

[env:giga]
platform = ststm32
board = giga
framework = arduino
extra_scripts = pre:fix_link.py
debug_tool = jlink
upload_protocol = jlink
build_type = debug

PlatformIO/VSCode for me is about a million times better than the Arduino IDE :wink:

1 Like

I did this and modified platform.py but it says it can't recognize the giga.

I have just put in a couple of PRs to add the Giga to platformio, this is now based on the recent 4.0.10 version for ArduinoCore-mbed where the Arduino guys spent time making this possible.

You can find details here: Add board Arduino Giga R1 Wifi · Issue #702 · platformio/platform-ststm32 · GitHub

If you look at the bottom there is a zip file with the changes needed and instructions.

1 Like