Problem with Jumping from Bootloader to Apploader with cortex_m::asm::bootload
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 28/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- rust
- Domain
- embedded-iot
Research direction
Start with the jump_to_apploader function and the linker script definition of __apploader_origin, then inspect cortex_m::asm::bootload's expected vector-table and stack-pointer layout. Use the reported address and a debugger to determine whether control reaches a valid apploader entry point; done means identifying the handoff failure and documenting a reproducible fix.
Written by the indexing model from the issue text.
Description
Hi everyone,
I’m working on an embedded Rust project using Embassy, cortex-m, and a STM32L471RG. I’ve set up a bootloader and an apploader, but I’m running into a strange issue when trying to jump from the bootloader to the apploader.
Here’s the function I’m using to perform the jump:
fn jump_to_apploader() -> ! {
unsafe {
let start = &__apploader_origin as *const u32 as u32;
info!("booting to apploader at 0x{:X}", start);
let p = cortex_m::Peripherals::steal();
p.SCB.vtor.write(start);
cortex_m::asm::bootload(start as *const u32)
}
}
When I call this, the code completely stops running — it doesn’t execute the apploader, and I don’t even hit my panic handler. It’s just stuck.
Here is my panic handler for reference:
#[cfg(target_os = "none")]
#[panic_handler]
fn panic(info: &core::panic::PanicInfo) -> ! {
use defmt::error;
error!("{}: {}", info, defmt::Display2Format(&info.message()));
cortex_m::peripheral::SCB::sys_reset();
}
So far:
The jump address (__apploader_origin) is set correctly in the linker script.
The log message shows the expected address before jumping.
After cortex_m::asm::bootload, the MCU seems to hang completely — no reset, no panic, no debug logs.
Has anyone faced a similar issue before?
Could this be related to stack pointer initialization, interrupts still enabled, or something about how bootload expects the vector table?
Any hints or debugging approaches would be greatly appreciated!
- Dominant language
- Rust
- Stars
- 1k
- Forks
- 201
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 3
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-embedded/cortex-m
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
rust-embedded/cortex-m#651 · 5 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
rust-embedded/cortex-m#637 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
rust-embedded/cortex-m#511 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
rust-embedded/cortex-m#694 · 1 comment ·
-
Enabling LOBOpen
Difficulty 4/5 3-5 days Newbie friendliness 52/100
rust-embedded/cortex-m#691 · 1 comment ·
All issues in rust-embedded/cortex-m
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
bmander/geomsolver#118 ·
Maintainers usually reply within 1 day
-
Three Windows builds are keyed on a later release than their layoutPossibly taken @ero-qt claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 95/100
Maintainers usually reply within 1 day
-
Markdown Preview Fonts Don't Show Selected OptionPossibly taken @RadhiRasho claimed this today. Openstate:needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
zed-industries/zed#65300 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day