Hi,
I need to disable interrupts in a small function, to keep the contents atomic. I found '__disable_irq() / __enable_irq()', but their comments state "Can only be executed in Privileged modes". As far as I know the compiled code runs in User mode. How do I switch the mode to Privileged or is there another possibility to achive my goal?
The SW runs on a STM32F051 (if that matters).
Regards, Hans
Cortex-M0 does not have "user mode", unless the "Unprivileged/Privileged Extension" is incorporated. Your STM32F051 is always in privileged mode.
Here's a section from ST's "Programming Manual."