Pio-arduinogiga does not build

I have problems building the example code for the pio-arduinogiga, there seem to be a problem with finding header files from the Arudino framework. Here is what I have done

-Cloned GitHub - Haschtl/pio-arduinogiga: Platformio configuration for Arduino GIGA R1 locally.
-Open the cloned folder in VSCODE, and saved as workspace. Note that platformio is already installed, and I have succeeded earlier in working on a Arduino Due project.
-Edited the relevant sections in the local platform.py file as instructed
-Copied the giga.json file to the local board folder

When I building the solution -specifically for the env:giga environment- I get the following erros

******************************************************************************************
platformio.exe run --environment giga -vvv
Processing giga (platform: ststm32; board: giga; framework: arduino; extra_scripts: pre:fix_link.py)
--------------------------------------------------------------------------------------------------------------------------
TypeError: expected str, bytes or os.PathLike object, not NoneType:
  File "C:\Users\xxx\.platformio\penv\Lib\site-packages\platformio\builder\main.py", line 167:
    env.SConscript(env.GetExtraScripts("pre"), exports="env")
  File "C:\Users\xxxr\.platformio\packages\tool-scons\scons-local-4.7.0\SCons\Script\SConscript.py", line 612:    
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\xxxr\.platformio\packages\tool-scons\scons-local-4.7.0\SCons\Script\SConscript.py", line 279:    
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "G:\Shared drives\Technical Development\Engineering\Feasibility Work\Z1067\Arduino Giga VSCODE Template\pio-arduinogiga\fix_link.py", line 15:
    target_file = join(FRAMEWORK_DIR, "libraries", "rpclib" , "library.json")
  File "<frozen ntpath>", line 108:

=============================================== [FAILED] Took 1.20 seconds ===============================================
PS G:\Shared drives\Technical Development\Engineering\Feasibility Work\Z1067\Arduino Giga VSCODE Template\pio-arduinogiga>
************************************************************************************************

When I look at the “problems” tab I can see that Arduino.h header files are obviously missing, but the arduino framework should take care of that, right? I could add the header files manually on the , but I am sure that this should be automatically taken care of by the framework instruction.

I am sure that there must be a simple project specific setting to in order to set the paths right.

Many thanks

The script assumes the packages were predownloaed. You can trigger that by creating a regular STM32 project that uses ArduinoCore-mbed, e.g. create a Portenta C33 + Arduino project.

Alternatively, PIO CLI

pio pkg install -g -t "framework-arduino-mbed"

Hi Maxgerhardt,

thank your quick reply. However, I have installed the pio pkg install… command and the paths are still broken. Although this time it seems to be a missing linker script for the target…

********************************************************************************************
Executing task in folder pio-arduinogiga: C:\Users\xxx\.platformio\penv\Scripts\platformio.exe run --environment giga 

Processing giga (platform: ststm32; board: giga; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/giga.html
PLATFORM: ST STM32 (17.4.0) > Arduino Giga R1 Wifi
HARDWARE: STM32H747XIH6 480MHz, 511.35KB RAM, 1.88MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-arduinoststm32 @ 4.20701.0 (2.7.1) 
 - framework-cmsis @ 2.50900.0 (5.9.0) 
 - tool-dfuutil-arduino @ 1.11.0 
 - toolchain-gccarmnoneeabi @ 1.120301.0 (12.3.1)
Warning! Cannot find linker script for the current target!

LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 12 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
KeyError: 'tool-dfuutil':
  File "C:\Users\xxx\.platformio\penv\Lib\site-packages\platformio\builder\main.py", line 173:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\xxx\.platformio\packages\tool-scons\scons-local-4.7.0\SCons\Script\SConscript.py", line 612:    
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\xxx\.platformio\packages\tool-scons\scons-local-4.7.0\SCons\Script\SConscript.py", line 279:    
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\xxx\.platformio\platforms\ststm32\builder\main.py", line 221:
    _upload_tool = '"%s"' % join(platform.get_package_dir(
  File "C:\Users\xxx\.platformio\penv\Lib\site-packages\platformio\platform\_packages.py", line 32:
    pkg = self.get_package(name)
  File "C:\Users\xxx\.platformio\penv\Lib\site-packages\platformio\platform\_packages.py", line 29:
    return self.pm.get_package(spec or self.get_package_spec(name))
  File "C:\Users\xxx\.platformio\penv\Lib\site-packages\platformio\platform\_packages.py", line 21:
    owner=self.packages[name].get("owner"),
=============================================== [FAILED] Took 1.38 seconds ===============================================
********************************************************************************************

You found a bug in platform-ststm32, it should not be accessing tool-dfuutil if it has decided that it should use tool-dfuutil-arduino. You can work around it by also installing that package (that just ends up unused).

pio pkg install -g -t "tool-dfuutil"

The tool is already installed. Maybe it looks for a different version? I think that I am missing something fundamentally here. I have not chosen to open a new project, I have just open the git-cloned folder. But it should have all the files needed, right? Did I miss a crucial step?


PS G:\Shared drives\Technical Development\Engineering\Feasibility Work\Z1067\Arduino Giga VSCODE Template\pio-arduinogig> pio pkg install -g -t “tool-dfuutil”
Tool Manager: tool-dfuutil@1.11.0 is already installed

Add

platform_packages = tool-dfuutil

in the platformio.ini to force the inclusion.

Almost, just need the variant_GIGA.h header which the LDF missed for some reason. I guess that this can be installed as a package as well?

************************************************************************************

Executing task in folder pio-arduinogiga: C:\Users\Clemens Eder\.platformio\penv\Scripts\platformio.exe run --environment giga 

Processing giga (platform: ststm32; board: giga; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/giga.html
PLATFORM: ST STM32 (17.4.0) > Arduino Giga R1 Wifi
HARDWARE: STM32H747XIH6 480MHz, 511.35KB RAM, 1.88MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-arduinoststm32 @ 4.20701.0 (2.7.1) 
 - framework-cmsis @ 2.50900.0 (5.9.0) 
 - tool-dfuutil @ 1.11.0 
 - tool-dfuutil-arduino @ 1.11.0 
 - toolchain-gccarmnoneeabi @ 1.120301.0 (12.3.1)
Warning! Cannot find linker script for the current target!

LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 12 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal.c.o
Compiling .pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_adc.c.o
Compiling .pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_adc_ex.c.o
Compiling .pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_can.c.o
Compiling .pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_cec.c.o
Compiling .pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_comp.c.o
Compiling .pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_comp_ex.c.o
Compiling .pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_cordic.c.o
Compiling .pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_cortex.c.o
Compiling .pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_crc.c.o
Compiling .pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_crc_ex.c.o
Compiling .pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_cryp.c.o
<command-line>: fatal error: variant_GIGA.h: No such file or directory

**********************************************************************
* Looking for variant_GIGA.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:variant_GIGA.h"
* Web  > https://registry.platformio.org/search?q=header:variant_GIGA.h
*
**********************************************************************

compilation terminated.
*** [.pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal.c.o] Error 1
<command-line>: fatal error: variant_GIGA.h: No such file or directory

**********************************************************************
* Looking for variant_GIGA.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:variant_GIGA.h"
* Web  > https://registry.platformio.org/search?q=header:variant_GIGA.h
*
**********************************************************************

compilation terminated.
*** [.pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_adc.c.o] Error 1
<command-line>: fatal error: variant_GIGA.h: No such file or directory

**********************************************************************
* Looking for variant_GIGA.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:variant_GIGA.h"
* Web  > https://registry.platformio.org/search?q=header:variant_GIGA.h
*
**********************************************************************

compilation terminated.
*** [.pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_adc_ex.c.o] Error 1
<command-line>: fatal error: variant_GIGA.h: No such file or directory

**********************************************************************
* Looking for variant_GIGA.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:variant_GIGA.h"
* Web  > https://registry.platformio.org/search?q=header:variant_GIGA.h
*
**********************************************************************

compilation terminated.
<command-line>: fatal error: variant_GIGA.h: No such file or directory

**********************************************************************
* Looking for variant_GIGA.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:variant_GIGA.h"
* Web  > https://registry.platformio.org/search?q=header:variant_GIGA.h
*
**********************************************************************

compilation terminated.
<command-line>: fatal error: variant_GIGA.h: No such file or directory

**********************************************************************
* Looking for variant_GIGA.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:variant_GIGA.h"
* Web  > https://registry.platformio.org/search?q=header:variant_GIGA.h
*
**********************************************************************

compilation terminated.
*** [.pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_cec.c.o] Error 1
*** [.pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_comp.c.o] Error 1
*** [.pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_cordic.c.o] Error 1
<command-line>: fatal error: variant_GIGA.h: No such file or directory

**********************************************************************
* Looking for variant_GIGA.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:variant_GIGA.h"
* Web  > https://registry.platformio.org/search?q=header:variant_GIGA.h
*
**********************************************************************

compilation terminated.
<command-line>: fatal error: variant_GIGA.h: No such file or directory

**********************************************************************
* Looking for variant_GIGA.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:variant_GIGA.h"
* Web  > https://registry.platformio.org/search?q=header:variant_GIGA.h
*
**********************************************************************

compilation terminated.
<command-line>: fatal error: variant_GIGA.h: No such file or directory

**********************************************************************
* Looking for variant_GIGA.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:variant_GIGA.h"
* Web  > https://registry.platformio.org/search?q=header:variant_GIGA.h
*
**********************************************************************

compilation terminated.
<command-line>: fatal error: variant_GIGA.h: No such file or directory

**********************************************************************
* Looking for variant_GIGA.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:variant_GIGA.h"
* Web  > https://registry.platformio.org/search?q=header:variant_GIGA.h
*
**********************************************************************

compilation terminated.
*** [.pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_cryp.c.o] Error 1
*** [.pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_crc.c.o] Error 1
*** [.pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_cortex.c.o] Error 1
*** [.pio\build\giga\SrcWrapper\src\HAL\stm32yyxx_hal_crc_ex.c.o] Error 1
============================================== [FAILED] Took 10.16 seconds ==============================================

Mhm no, it selects the completely wrong STM32 Arduino core here. It seems to me that you didn’t do the manual modifications to the platform.py as described in https://github.com/Haschtl/pio-arduinogiga/tree/main?tab=readme-ov-file#important-modify-platform-ststm32. I think that’s gonna solve the wrong selection of tool-dfuutil vs tool-dfuutil-arduino too (and is required for uploading correctly anyways).

There are two places that must be expanded with , "giga".

Thank you, that did the job. Please note that the instructions in the link only contain the change of the tool-dfuutil line -which I had done before- but not the change in the framework section. I would highly recommned to get that updated.

Thanks for your very efficient help, which is always highly appreciated.


mportant: Modify platform-ststm32

The GIGA board requires a modification of the platform-ststm32 platform in the platform.py file.

Change the line

if board.startswith(("portenta", "opta", "nicla_vision"))

to

if board.startswith(("portenta", "opta", "nicla_vision", "giga"))

The platform.py file can be found in ~/.platformio/platforms/ststm32/platform.py on linux.

I think the https://github.com/platformio/platform-ststm32/pull/747 pull request is more complete in this regard. It also fixes up places in ststm32/builder/main.py that have to do with selecting the tool-dfuutil-arduino again.

Try using https://github.com/maxgerhardt/pio-arduinogiga instead. No manual modifications of anything required.

Oh, I did not know about the fork. Can be tricky to navigate around the “correct” or most up to date repository as they all have the same name. Is there a way to make an repository obsolete or refer to the new one, or is this up the original contributor (like Haschtl)?

I have already opened the issue on the old repository to change the instructions in order to avoid others to fall into the same trap. But it would be probably better to refer to your folk…

Every Github repo lives on its own, there is no authoritative source for these projects. The best course of action would be for PlatformIO staff to merge PR 747 so that official Giga R1 support is gained in platform-ststm32. I think my fork above is the best no-modifications-needed solution until then.

Thank you, I understand. I just want to confirm that I have cloned your repository after un-doing the platform.py settings, and it builds staright out of the box!

Is there a way to connect an (ST-LINK) debugger instead of relying on DFU?

Mhm, not sure. The board definition definitely supports it:

So it will try to invoke OpenOCD with the ST-Link config to connect to it. However, the STM32H747XIH6, being a 2-core microcontroller (one Cortex M7, one Cortex M4), might need an adapter that supports “SWD Multi Drop”. The ST-Link V2 clones famously don’t support it, but an ST-Link V3 would. So I guess: Try it out. The SWD pins (SWDIO, SWCLK, Reset) are listed in the pinout.

You would need to set

upload_protocol = stlink
debug_tool = stlink

in the platformio.ini.

Thank you. I’ll have to try that. The Link V3 has four channels to select from, where two of them are dedicated to each core. It should be therfore possible to select either. At the end I should be upload the code using the ST-Programmer software.