-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zephyr doesn't boot on STM32F4 (and probably other ARMv7-M cores) #71698
Comments
Did you try with #71593 ? |
Yes I realized that it fails to boot on warm reboots (cold reboots are fine). |
It appears that I have missed something important around the (seemingly inconsistent) use of BASEPRI & cpsie/d… 🤔 Interrestingly, this isn’t caught by any of the tests I ran. I would like to fix the issue but also eventually add some tests to capture future regressions. |
I also encountered a similar phenomenon with arduino_uno_r4_minima (Renesas RA4M1, Cortex-M4/ARMv7-M). |
Thank you for letting me know. I am currently running tests on a nucleo_f401re but can’t seem to be able to reproduce the issue. Along with the fix, I’d like to understand & document the why is this extra cpsie required. |
Have you tried jumping to reset vector with interrupts disabled? |
I am running Zephyr’s tests & samples. Would you be able to provide a sample project that exhibits this issue? |
In my case, I'm jumping to Zephyr reset vector from another code (chain-loading) with interrupts disabled ( To reproduce issue without chain-loading you can use following code:
|
So I edited #include "zephyr/kernel.h"
#include <stdio.h>
extern void z_arm_reset(void);
int main(void) {
printf("Hello World! %s\n", CONFIG_BOARD_TARGET);
k_sleep(Z_TIMEOUT_MS(2000));
__disable_irq();
z_arm_reset();
/* should not be reached */
printf("Reboot failed\n");
k_sleep(Z_FOREVER);
return 0;
} And this indeeds behaves incorrectly as the sleep is not stopping the thread for the requested amount of time. However, With reguards to chain loading, I also tried MCUBoot with the helloworld (using For the record, here’s how I built & flashed them: west build --sysbuild -p -b nucleo_f401re samples/hello_world -DSB_BOOTLOADER=MCUBOOT=y
pyocd load build/mcuboot/zephyr/zephyr.elf
pyocd load build/hello_world/zephyr/zephyr.signed.hex It might be worth noting that the documentation for
Could this be something useful for your usecase? |
MCUBoot works because they use @yperess do you remember why we disable interrupts using |
When the cleanup is enabled, |
|
Well, I cannot reproduce the issue but from the bug report what's missing is enabling the IRQ so if anything it only confuses me more. |
Are you happy closing this issue with the fix that was merged? |
Closing |
Describe the bug
Zephyr can't boot on STM32F4 after #65071.
To Reproduce
Build Zephyr and run on STM32F4
Expected behavior
It boots
Impact
Very high. Zephyr doesn't work.
Logs and console output
No logs are printed.
Environment (please complete the following information):
N/A
Additional context
Reverting f11027d seems to fix the problem.
I compared assembly code and looks like commit above removed
cpsie if
instruction from arch_switch_to_main_thread().For me, the following change fixes problem (ARMv7-M only!):
The text was updated successfully, but these errors were encountered: