Setting up giga R1

I am trying to set up a Giga R1 M7 and Giga R1 M4 with Platformio so I can use the debug, however it dose not work here are the two codes.

[env:giga_r1_m7]
platform = ststm32
board = giga_r1_m7
framework = arduino
debug_tool = cmsis-dap


#include <Arduino.h>

#define LED 6

void setup() {
// put your setup code here, to run once:
debug_int();

pinMode(LED,OUTPUT); //Sets the pinMode to Output
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED, HIGH); //Sets the voltage to high
delay(100); //Waits for 1000 milliseconds
digitalWrite(LED, LOW); //Sets the voltage to low
delay(10000); //Waits for 1000 milliseconds
}

Any help would be appreciated.

So… what’s the error message here when you debug?

And what’s the output of CLI

pio debug --interface=gdb -- -x .pioinit

The board has no on-board debugger (like an ST-Link or a CMSIS-DAP). You are expected to have an external debug probe and connect it to the JTAG/SWD connector of the board.

As documented in

https://docs.arduino.cc/tutorials/giga-r1-wifi/giga-debugging/

I.e. you would need one of

  • ST-Link V3
  • DebugProbe (can be loaded onto a Raspberry Pi Pico, extremely cheap, acts a CMSIS-DAP)
  • J-Link

I am aware of this documentation but,

after reading the PlatformIO i am under the impression that it is acting as the debug.
Debugging — PlatformIO v6.1 documentation

There are examples of boards not supported on the Arduino page that user have used without hardware to give an example:
(Arduino Nano ATmega328 — PlatformIO v6.1 documentation)

can you please help me understand the discrepancy.

PlatformIO offers to use (aka, automatically start and connect to) a suite of debug_tools that are available and suitable for that board. Whether any of those debug tools are actually available, or usable for a particular board, without any additionally hardware, is not something PlatformIO guarantees. Of course it depends on the target board, whether there’s an on-board debugger (and accompanying software) or alternative debugging methods available for it

The Nano ATmega328P’s debug tools are another story: First of all, it correcetly says that that board does not have an on-board debugger.

That doesn’t mean though that it can’t be debugged: The debug tool “simavr” (github) is a AVR simulator and works without hardware. So, the firmware is being run in a simulated environment here. The debug tool “avr-stub” (github) is special: It’s a “gdb stub”. That is code that runs on the target and exposes an interface, usually via UART, that gdb (the debugger client) can connect to. I.e., it implements the GDB Remote Serial Protocol (RSP). This makes it such that the board can actually debug itself (set breakpoints, read and write memory, …) without external debugger hardware. In fact, the ATmega328P does also support external hardware probes via the debugWIRE interface and probes such as an Atmel ICE and software such as avarice, but PlatformIO doesn’t support this at the moment.

GDB Stubs are not unqiue to the AVR architecture. They e.g. exist for ESP8266 and the Teensy, too. In fact, pretty much all ARM Cortex-M cores have a mechanism that allows the implementation of such “self debugging” mechanism, by providing the possiblity to set breakpoints (“ARM FPB”) and react to them (“DebugMonitor” exception / interrupt).

See:

That being said, I don’t know of any “drop in ready” GDB stub library for the Giga R1, which uses the Arduino framework runs a STM32H747XI, which is turn a Cortex-M7 and a Cortex-M4 dual-core chip. Can it be constructed? Sure, with some work. But there will be drawbacks from the chip running a debug stub code directly vs an actual external debug probe which controls everything. Hence why I would absolutely recommend getting a e.g. cheap Raspberry Pi Pico board to use a debugger, or an actual ST-Link V3(Set or Minie). PlatformIO fully supports this debug method with debug_tool = cmsis-dap / stlink.

thanks for the information,
do you know any good step by step guides for setting this up?

My post talked about 10 different things; A step-by-step guide of setting up what debug method exactly?