For a recent project, I used an LTE modem from Nordic – nrf9160. It’s a very capable and impressive piece of hardware (with the only drawback – pretty hard to solder. From my personal experience, it’s nearly impossible to solder it manually). But what was even more impressive was the software which is available for this modem. Nordic suggests a convenient set of VS Code plugins that allow you easy installation and intuitive use for firmware development. On top of that, you are getting SDK based on Zephyr OS with hardware management based on the Devicetree concept. Although it was very new for me and the learning curve was a bit steep at the beginning I really liked Zephyr OS and now going to use it in my next project based on Wio-E5 LORA module from SeeedStudio (has stm32wle5 uC inside).
I didn’t want to use a dedicated toolchain/SDK installation for the LORA project (in the end one of the main purposes of Zephyr OS is code reuse for different platforms, right?) and I assumed that wonderful VS Code plugins from Nordic will equally good work for stm32 (well, except maybe debugging functionality). It also showed the LORA e5 dev board in the list of supported targets. So I tried to compile a “blinky” sample project and was disappointed that the compilation failed. A short look in the “ncs” folder (where all the Nordic tools are installed) showed that complete STMs HAL is absent (which is sort of logical, in the end, it’s a tool for nrf9160, not for stm32). Although west.yml in Zephyr folder was ok (this file describes which modules will be available in your Zephyr SDK, to get more information about this please check information about “west” – swiss knife tool for your Zephyr projects). I kept searching and found another west.yml in the nrf folder. It had the following “allowlist” inside, which by adding “- hal_stm32” line and running “west update” command, allowed me to successfully build my blinky sample for stm32 :
# Note that the zephyr west extensions (like 'build', 'flash',
# 'debug', etc.) are automatically provided by this import, so
# there's no need to add a redundant west-commands: key for
# the zephyr project.
#
# Please keep this list sorted alphabetically.
name-allowlist:
- TraceRecorderSource
- canopennode
- chre
- cmsis
- cmsis-dsp
- cmsis-nn
- edtt
- fatfs
- hal_nordic
- hal_st # required for ST sensors (unrelated to STM32 MCUs)
- hal_stm32 #
- hal_wurthelektronik
- liblc3
- libmetal
- littlefs
- loramac-node
- lvgl
- lz4
- mipi-sys-t
- nanopb
- net-tools
- nrf_hw_models
- open-amp
- picolibc
- segger
- tinycrypt
- tf-m-tests
- uoscore-uedhoc
- zcbor
- zscilib
So now I have a convenient IDE that works for both Nordic and STM chips for the cost of only a few additional megabytes used for the new HAL. In the same way, you can add support for any other chips that are supported by Zephyr. I’ll also explain how to add debugging functionality in my next post.
