Adding Wio-E5-Mini board

I am starting a development on a board which is not yet in PlatformIO’s board list.
Following this doc page Custom Embedded Boards — PlatformIO latest documentation, I created a .json file for the board.

This however breaks several things in the new project wizard, so it looks like my board definition is wrong or incomplete.
Can anyone help getting this board added ?

Board = Wio-E5 mini - Seeed Wiki (seeedstudio.com)
MCU = Datasheet - STM32WLE5J8 STM32WLE5JB STM32WLE5JC - Multiprotocol LPWAN 32-bit Arm®Cortex®-M4 MCUs, LoRa®, (G)FSK, (G)MSK, BPSK, up to 256KB Flash, 64KB SRAM (seeedstudio.com)

My attempt at board.json is

{
  "build": {
    "core": "stm32",
    "cpu": "cortex-m4",
    "extra_flags": "-DSTM32WLxx -DSTM32WLE5xx",
    "f_cpu": "48000000L",
    "framework_extra_flags": {
      "arduino": "-DUSE_CM4_STARTUP_FILE"
    },
    "mcu": "stm32wle5jx",
    "product_line": "STM32WLE5xx",
    "variant": "stm32wle5xx"
  },
  "debug": {
    "default_tools": [
      "blackmagic"
    ]
  },
  "frameworks": [
    "arduino",
    "stm32cube"
  ],
  "name": "Wio-E5 mini",
  "upload": {
    "maximum_ram_size": 65536,
    "maximum_size": 262144,
    "protocol": "blackmagic",
    "protocols": [
      "stlink"
    ]
  },
  "url": "https://wiki.seeedstudio.com/LoRa_E5_mini/",
  "vendor": "ST / Seeed"
}

Hey PIO-team, I willing to spend some time/effort on this myself, but I need a little help to get started.

I would very much like to do this dev in PlatformIO, currently using STM32Cube and it’s just not the same productivity.

I could set up a remote setup with this board/MCU connected, in case not having the board is the only problem. I have 4 of them.

Do you want to use this with Arduino? Because that’s not a valid variant folder in here. For the STM32WLE5JC I would have expected a value of STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I.

This raises question too, because all other boards have the full chip name (no "x"es) and the package name. Some builder scripts use it to derive additional information from this value. So I would have expected a value of e.g. stm32wle5jci6.

I could start with STM32 framework, and later add Arduino framework.
Most important is I can use VSCode and build/upload to the board from PlatformIO.

Let me try to fix the two remarks you made and I’ll be back with the results.
Thanks Max!

Ok, so now my lora_e5_mini.json board definition, in C:\Users\pasca.platformio\platforms\ststm32\boards looks like

{
  "build": {
    "core": "stm32",
    "cpu": "cortex-m4",
    "extra_flags": "-DSTM32WLxx -DSTM32WLE5xx",
    "f_cpu": "48000000L",
    "framework_extra_flags": {
      "arduino": "-DUSE_CM4_STARTUP_FILE"
    },
    "mcu": "stm32wle5jci6",
    "product_line": "STM32WLE5xx",
    "variant": "STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I"
  },
  "debug": {
    "default_tools": [
      "blackmagic"
    ]
  },
  "frameworks": [
    "stm32cube"
  ],
  "name": "Wio-E5 mini",
  "upload": {
    "maximum_ram_size": 65536,
    "maximum_size": 262144,
    "protocol": "blackmagic",
    "protocols": [
      "stlink"
    ]
  },
  "url": "https://wiki.seeedstudio.com/LoRa_E5_mini/",
  "vendor": "ST / Seeed"
}

But when I start the project wizard, the Board-selection spinner keeps turning forever…

Okay, let me double check… because in another project I’m using

{
  "build": {
    "core": "stm32",
    "cpu": "cortex-m4",
    "extra_flags": "-DSTM32WLxx -DSTM32WL55xx",
    "f_cpu": "48000000L",
    "framework_extra_flags": {
      "arduino": "-DUSE_CM4_STARTUP_FILE"
    },
    "mcu": "stm32wl55jc",
    "product_line": "STM32WL55xx",
    "variant": "STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I"
  },
  "debug": {
    "default_tools": [
      "stlink"
    ],
    "jlink_device": "STM32WL55JC",
    "onboard_tools": [
      "stlink"
    ],
    "openocd_board": "nucleo_wl55",
    "svd_path": "STM32WL5x_CM4.svd"
  },
  "frameworks": [
    "arduino",
    "zephyr"
  ],
  "name": "ST Nucleo WL55JC",
  "upload": {
    "maximum_ram_size": 65536,
    "maximum_size": 262144,
    "protocol": "stlink",
    "protocols": [
      "jlink",
      "cmsis-dap",
      "stlink",
      "mbed"
    ]
  },
  "url": "https://www.st.com/en/evaluation-tools/nucleo-wl55jc.html",
  "vendor": "ST"
}

and it’s working fine with a baremetal project.

Ok, starting from this Nucleo board, I’ve made a board.json which at least doesn’t cause problems in the new project wizard. One small question : what is the importance / use of

"product_line": "STM32WLE55xx",

i.e. when I have the partnumber of the MCU (stm32wle5jci6 in my case), how to I obtain the correct product_line value ?

The stm32cube.py builder scripts expects a bunch of information to be present in the board JSON file. That can be seen with all instances of board.get().

So basically the platform and builder script use this info to infer the name of the stm32cube package and the name of the startup file etc.

Ok, I understand.

Looking into STM32Cube, there is a ‘Segment / Series / Line’ selection filter, so I assumed this ‘Line’ has to match with PlatformIO’s product_line = .
But then looking at your example for the NUCLEO-WL55JC1 / NUCLEO-WL55JC2 board, it has a STM32WL55JCI6 MCU, and for this part, the ‘Line’ is SMT32WL5x, not exactly the same as STM32WL55xx in the json file.

Same for the variant setting. I am a bit in the dark on how to set this properly.

Did you ever get this to work? I would also like to use the Lora E5 Mini with PlatformIO. Any hints on how to set it up as a custom board would be appreciated…

No, not really.
For the time being I am doing all hw-independent development in PlatformIO and target builds in STM32CubeIDE.