Zephyr-rtos, nrf53840, mbedtls

I’m trying to figure out the magic involved with enabling mbedtls for my app…

I’ve got an Adafruit Feather nRF52840 Express, and I’ve configured for platform=nordicnrf52, board=adafruit_feather_nrf52840, and framework=zephyr. I find framework-zephyr-mbedtls already there in my .platformio/packages. But, #include <mbedtls/aes.h> is not found.

I perused “pio run --target=menuconfig”, and I find “modules —>” “mbedtls —>” and I check “mbed TLS support”, but this does not help. I looked thru the output of “pio run -v” but no mention of the mbedtls package appears.

What’s the magic to make this work? Thanks for any help.

Review the documentation the PlatformIO Zephyr docs and Zephyr’s prj.confg docs carefully. The CONFIG_MBEDTLS option turns the inclusion of mbedtls on or off.

If I take the standard example platform-nordicnrf52/examples/zephyr-blink at develop · platformio/platform-nordicnrf52 · GitHub and add

CONFIG_MBEDTLS=y

to the zephyr/prj.conf, the source file src/main.c can #include <mbedtls/aes.h> without errors (and it also compiles of course).

Refer to other project’s prj.conf like platform-nordicnrf52/examples/zephyr-net-echo-client at develop · platformio/platform-nordicnrf52 · GitHub which do more complicated stuff (with overlays etc.) for reference.

This is only valid for ESP-IDF configuration.

Aha! Thanks.

So the fix is:

  • Create a zephyr/prj.conf
  • Populate with CONFIG_MBEDTLS=y

Thanks!