[riot-notifications] [RIOT-OS/RIOT] stm32l152re: hard-fault unless power-cycled after flash, or depending on optimization (#11820)

Francisco notifications at github.com
Wed Jul 10 09:32:28 CEST 2019

@cladmi Thanks for the suggestions!

> does it also crash when compiling only the low level with optimization (by manually adding CFLAGS in the module Makefile)

It does not, I lowered optimization just for `cortexm_sleep()` this way:

#pragma GCC push_options
#pragma GCC optimize ("O2")
static inline void cortexm_sleep(int deep)
    if (deep) {
        SCB->SCR |=  (SCB_SCR_SLEEPDEEP_Msk);
    else {
        SCB->SCR &= ~(SCB_SCR_SLEEPDEEP_Msk);

    /* ensure that all memory accesses have completed and trigger sleeping */
    unsigned state = irq_disable();
#if defined(CPU_MODEL_STM32L152RE)
    /* STM32L152RE crashes without this __NOP(). See #8518. */
#pragma GCC pop_options

But it hardfaults if the `__NOP()` is removed. 

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190710/39c050d2/attachment-0001.html>

More information about the notifications mailing list