Unable to create new board referencing STM32 core. Arduino-builder throws panic

Hi everyone!

I am trying to create Arduino support for a new board that references the STM32 core, as documented here:

I am following the (old) instructions described here:


  • Windows 10- Arduino 1.8.10- STM32 Arduino Core 1.7.0

When I follow the steps using the files provided on that repo and compile an empty example, arduino-builder throws a panic. Here is the full error output:

Arduino: 1.8.10 (Windows 10), Board: "BluePill (vendor), BluePill F103C8, 64k (default), Smallest (-Os default), Newlib Nano (default), Enabled with generic Serial, STLink w/openocd"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Pieter\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Pieter\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Pieter\Documents\Arduino\libraries -fqbn=vendor:stm32:bluepill:pnum=BLUEPILL_F103C8,flash=C8,opt=osstd,rtlib=nano,xserial=generic,upload_method=openocd -vid-pid=0403_6015 -ide-version=10810 -build-path C:\Users\Pieter\AppData\Local\Temp\arduino_build_432218 -warnings=all -build-cache C:\Users\Pieter\AppData\Local\Temp\arduino_cache_196316 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.CMSIS.path=C:\Users\Pieter\AppData\Local\Arduino15\packages\STM32\tools\CMSIS\5.5.1 -prefs=runtime.tools.CMSIS-5.5.1.path=C:\Users\Pieter\AppData\Local\Arduino15\packages\STM32\tools\CMSIS\5.5.1 -prefs=runtime.tools.STM32Tools.path=C:\Users\Pieter\AppData\Local\Arduino15\packages\STM32\tools\STM32Tools\1.3.1 -prefs=runtime.tools.STM32Tools-1.3.1.path=C:\Users\Pieter\AppData\Local\Arduino15\packages\STM32\tools\STM32Tools\1.3.1 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\Pieter\AppData\Local\Arduino15\packages\STM32\tools\arm-none-eabi-gcc\8.2.1-1.7 -prefs=runtime.tools.arm-none-eabi-gcc-8.2.1-1.7.path=C:\Users\Pieter\AppData\Local\Arduino15\packages\STM32\tools\arm-none-eabi-gcc\8.2.1-1.7 -verbose C:\Users\Pieter\AppData\Local\Temp\untitled2045930537.tmp\sketch_nov15a\sketch_nov15a.ino
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x18 pc=0x6fc523]

goroutine 1 [running]:
github.com/arduino/arduino-cli/arduino/cores.(*Platform).GetAllInstalled(0x0, 0x11c126e8, 0x11d9a200, 0x7)
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/arduino/cores/cores.go:174 +0x33
github.com/arduino/arduino-cli/arduino/cores/packagemanager.(*PackageManager).GetInstalledPlatformRelease(0x11cecc40, 0x0, 0x11c0030d)
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/arduino/cores/packagemanager/package_manager.go:318 +0x25
github.com/arduino/arduino-cli/arduino/cores/packagemanager.(*PackageManager).ResolveFQBN(0x11cecc40, 0x11cecba0, 0x95723f, 0x4, 0x95cf47, 0xc, 0x11c07fc0, 0x1, 0x1)
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/arduino/cores/packagemanager/package_manager.go:187 +0x393
github.com/arduino/arduino-cli/legacy/builder.(*TargetBoardResolver).Run(0xdebc68, 0x11cd05a0, 0xdebc68, 0x0)
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/target_board_resolver.go:45 +0x4c
github.com/arduino/arduino-cli/legacy/builder.(*ContainerSetupHardwareToolsLibsSketchAndProps).Run(0xdebc68, 0x11cd05a0, 0xdebc68, 0xdda500)
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/container_setup.go:60 +0x266
github.com/arduino/arduino-cli/legacy/builder.runCommands(0x11cd05a0, 0x11c6bf0c, 0x2, 0x2, 0xffffff01, 0x0, 0x4)
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/builder.go:210 +0xbd
github.com/arduino/arduino-cli/legacy/builder.(*ParseHardwareAndDumpBuildProperties).Run(0x11c6bf40, 0x11cd05a0, 0xdebbb4, 0x11c06ca0)
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-cli/legacy/builder/builder.go:198 +0xbc
/home/jenkins/workspace/arduino-builder-all-cross-cli-inception/src/github.com/arduino/arduino-builder/main.go:388 +0x772
C:\Program Files (x86)\Arduino\arduino-builder returned 2

Error compiling for board BluePill (vendor).

I tried, but can't figure out what is causing the "panic: runtime error: invalid memory address or nil pointer dereference" error message.

Any advice / tips / hints would be much appreciated! Are there any example board packages that refer to an existing installed core that I can follow? Is this feature broken and would you rather advise me to submit my custom board to the STM32Duino board library?

Thanks in advance,

Hi. Do you have your project published online so I can give it a try and take a look to see whether I can find the problem?

Hi @pert,

Thanks for the kind offer :slight_smile:

You can try the project that is published here:

To summarize the steps (if you are working on Windows):

  1. Use Arduino Board Manager and Install STM32 Core (JSON file is HERE)
  2. Stop Arduino IDE
  3. cd "c:\Program Files (x86)\Arduino\hardware" (as administrator)
  4. git clone GitHub - RickKimball/vendor: Custom STM32 bluepill Arduino core using STM32Duino vendor (as administrator)
  5. From Board Manager, select "BluePill (vendor)"
  6. Try to build empty sketch

You can also try my (alpha) project:

  1. Use Arduino Board Manager and Install STM32 Core (JSON file is HERE)
  2. Use Arduino Board Manager and Install "Piconomix STM32 Boards" (JSON file is HERE)
  3. From Board Manager, select "PX-HER0"
  4. Try to build an empty sketch

If using my project, the pertinent file is here:


Thanks in advance,

Hi @pert,

Minor update: I found this GitHub repo that is successfully able to add a hardware variant based on an existing core:

Important difference is that it is for the AVR and SAMD built-in Arduino cores and uses "build.core=arduino:arduino" to refer to the existing core.

In my case I am trying to refer to a 3rd party core (STM32) using "build.core=STM32:arduino".

Best regards,

P.S. Please let me know if you need more info. I am trying to figure out the problem by experimentation, but could not narrow down cause yet.

This seems to be caused by a bug in the version of arduino-builder (1.4.7) used by Arduino IDE 1.8.10. If I use Arduino IDE 1.8.9 (which uses arduino-builder 1.4.4) or the hourly build of the Arduino IDE (which uses arduino-builder 1.5.0) then the error doesn't occur. Compilation still does fail, but I think that's caused by a legitimate bug in your code, rather than an IDE glitch, and will likely be easy for you to fix.

Unfortunately, I am not familiar enough with arduino-builder to know exactly what the problem is. The next step in that investigation would probably be to bisect the versions between 1.4.7 and 1.5.0 to see exactly where it started working and then check the commit history to see if it will show what was changed to fix it. Your best approach might just be to document that Arduino IDE 1.8.10 can't be used. Hopefully there will be a new release of the IDE soon.

Hi @pert,

Thanks so much for your valuable time spent to investigate the issue! It's a relief that the bug has already been fixed and will work correctly with the next release :slight_smile: In the mean time it's also good to know that I can downgrade to continue my development.

Best regards,

You're welcome. I'm glad if I was able to be of assistance. Enjoy!