Thanks for the kind words.
You can use CMSIS, which is built-in with Zephyr, for WFI.
in your C code.
The definition is here:
That said, are you sure you need to invoke the WFI instruction manually? this is automatically done by Zephyr when the core can be powered down, for example:
First of all: thanks specifically to Carles Cufi for taking the time a few months ago to give very detailed answers to my questions on whether Zephyr would be a right choice for our device. Partially
because of this we're going with Zephyr for now - at least for the upcoming phase where I'm going to develop a prototype!
The first step for this prototype is making sure that the OS actually supports the low power mode we need to still meet our battery life requirements. Some context:
- We use the STM32L151CC MCU
- We need to be able to request the WFI (wait_for_interrupt) instruction (we use that one right now)
- In our current (bare-metal) code we use CMSIS + a separate library (STM32 Standard
Peripheral Library), of which the latter actually includes functions for requesting low power modes (including WFI)
I'm trying to figure out whether this specific instruction is already part of the HAL of Zephyr for the STM32Lxx MCU's. However, I'm kind of getting lost in the code, since the abstraction seems to be dispersed
over multiple locations. I've looked into the documentation of course, but wasn't able to find an answer for my specific question.
It would help me tremendously if someone could point me in the right direction or give a summary of the architecture, so I can check whether it's already supported or can start with implementing it myself.
Quick note that I'm relatively new to this, so if you need more information to understand my question or help me, I'm happy to provide it!