rust-embedded / rust-embedded/cortex-m
Problem with Jumping from Bootloader to Apploader with cortex_m::asm::bootload
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1k
- Forks
- 202
- Avg merge
- 6d 2h
- Merged PRs (30d)
- 2
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!
Contributor guide
No contributing guide indexed for this repository
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.
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.
Assessment
- Tech stack
- rust
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100