PlatformIO Community

Help Creating Custom STM32F405 Board

I’ve tried to find some general instructions on creating a new board. It’s not meant for mass production but I wanted to run some quick tests. I was able to create a boards folder in my project directory and create a JSON file but I’m stumbling a bit after that to get everything working as expected.

I’m following the STM32F4STAMP board as an example as it uses the same STM32F405 processor as I am. In it’s JSON I find the following section:
“build”: {
“core”: “maple”,
“cpu”: “cortex-m4”,
“extra_flags”: “-DMCU_STM32F406VG -DBOARD_discovery_f4 -DARDUINO_STM32F4StampF405 -DSTM32F405xx”,
“f_cpu”: “168000000L”,
“hwids”: [
[
“0x0483”,
“0xDF11”
]
],

I’m a little unclear about the extra_flags line and what they actually do but the -DBOARD_discovery_f4 statement appear to be where it pulls the pin definitions (I found this located at C:\Users\george.platformio\packages\framework-arduinoststm32-maple\STM32F4\variants\discovery_f407).

One of my issues was that the discovery_f4.h header file didn’t define PH0 so I had to add it. Now I want to define what hardware SPI and I2C pins I’m using but I’d like to have all of this contained in project file folder so when PIO gets updated my changes aren’t overwritten.

I’m using the Arduino framework.

I’ve been searching for instructions on how to do this easily and haven’t found it so any help would be greatly appreciated.