"Enabling PlatformIO and Zephyr on custom hardware" doesn't work with my custom board

I have an existing custom board that uses an AcSIP S76S system on a chip that incorporates an STM32L073 mcu and sx1276 Semtech radio. I would like to make use of Zephyr RToS to develop firmware for this board with PlatformIO and VSCode as IDE. I’ve tried following “Enabling PlatformIO and Zephyr on custom hardware” with platformio.ini as:
[env:acsip_s76s]
platform = ststm32
board = acsip_s76s
framework = zephyr
However when PlatformIO tries to configure the project it fails with:
“Error: This board doesn’t support zephyr framework!”
and doesn’t install the zephyr folders in the project folder tree.
A board apparently already exist under Zephyr using the s76s: Ronoth LoDev — Zephyr Project Documentation
What additional steps do I need to take to use PlatformIO for a custom acsip_s76s board with Zephyr as a framework? Thanks.

If you get this error message then the board definition does not have zephyr in its framework array, like

I recommend you to create your own board defintion (you would need to do this anyway to declare the Zephyr variant name etc). I.e., create a new folder boards in your project, copy paste this as e.g. custom_acsip_s76s.json, make the necessary modifications to frameworks and build to it, and reference board = custom_acsip_s76s in the platformo.ini.

Thanks Max, your comprehensive advice appears to be just what I was hoping for. Will give it a try and report back.

Got a little further. The project structure at least now contains a zephyr folder with a default CMakeLists.txt file.
However the new board specified by s76s_multiboard.json under new folder boards (in the project root) isn’t being found. Instead it appears that only the platformio set of standard boards is being searched:

Resolving s76s_multiboard dependencies...
Already up-to-date.
Updating metadata for the vscode IDE...
UserSideException: Processing s76s_multiboard (platform: ststm32; board: s76s_multiboard; framework: zephyr)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/s76s_multiboard.html
PLATFORM: ST STM32 (16.0.0) > ACSIP S76S
HARDWARE: STM32L073RZ 32MHz, 20KB RAM, 192KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES:
- framework-zephyr @ 2.20701.220422 (2.7.1)
- tool-cmake @ 3.21.3
- tool-dtc @ 1.4.7
- tool-gperf @ 3.0.4
- tool-ninja @ 1.7.1
- toolchain-gccarmnoneeabi @ 1.80201.181220 (8.2.1)
Reading CMake configuration...
-- Application: /media/molly/development/platformio/multiboard/zephyr
-- Zephyr version: 2.7.1 (/home/ron/.platformio/packages/framework-zephyr)
-- Found Python3: /home/ron/.platformio/penv/bin/python3.10 (found suitable exact version "3.10.8") found components: Interpreter
-- Board: s76s_multiboard
-- Configuring incomplete, errors occurred!
No board named 's76s_multiboard' found.
Please choose one of the following boards:
CMake Error at /home/ron/.platformio/packages/framework-zephyr/cmake/app/boilerplate.cmake:391 (message):
Invalid BOARD; see above.
Call Stack (most recent call first):
CMakeLists.txt:2 (include)
========================== [FAILED] Took 1.46 seconds ==========================

platformio.ini is:

[env:s76s_multiboard]
platform = ststm32
board = s76s_multiboard
framework = zephyr

Is something else needed so that the new boards folder is referenced?

It’s not using the right zephyr board (ronoth_lodev, based on your initial link above). Did you make sure to add the zephyr variant declaration into your custom board JSON file like reference? This must be inside the “build” object / dictionary.

My bad.

  "build": {
    "cpu": "cortex-m0plus",
    "extra_flags": "-DSTM32L073xx",
    "f_cpu": "32000000L",
    "framework_extra_flags": {
      "arduino": "-D__CORTEX_SC=0 -DCUSTOM_PERIPHERAL_PINS"
    },
    "mcu": "stm32l073rz",
    "product_line": "STM32L073xx",
    "variant": "STM32L0xx/L072R(B-Z)T_L073R(B-Z)T_L083R(B-Z)T",
    "zephyr": {
      "variant": "ronoth_lodev"
    }
  },

This works now.
Ever so grateful. Thanks a million Max.

Now to sort out the rest of the customisation!

1 Like