Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5010

SDK • boot_stage2 in rp2350 vs rp2040

$
0
0
Hi everyone,

I'm working on porting my code from an RP2040-based board to the RP2350 and have encountered an issue with a specific feature. Here's the setup:

I have two applications stored in flash memory:

- App EMUL: Located at address 0x10000000 (XIP_BASE), which is the start of the flash. This application boots when the board powers on.
- App USBDRIVE: Positioned at XIP_BASE + 0x20000. This application includes all necessary headers and vectors.

In the RP2040 setup, when USB power is detected, the EMUL app jumps to the USBDRIVE app, enabling the device to function as a mass storage device. This transition works seamlessly on the RP2040 using the following code, adapted from exit_from_boot2.s:

Code:

            __asm__ __volatile__(                "mov r0, %[start]\n"                "ldr r1, =%[vtable]\n"                "str r0, [r1]\n"                "ldmia r0, {r0, r1}\n"                "msr msp, r0\n"                "bx r1\n"                :                : [start] "r"(XIP_BASE + USBDRIVE_APP_OFFSET + 256), [vtable] "X"(PPB_BASE + M0PLUS_VTOR_OFFSET)                :);
However, this approach doesn't seem to work on the RP2350. I modified the code as follows, but after reviewing the exit_from_boot2.s version for the RP2350, I believe a different approach might be necessary:

Code:

            __asm__ __volatile__(                "mov r0, %[start]\n"                "ldr r1, =%[vtable]\n"                "str r0, [r1]\n"                "ldmia r0, {r0, r1}\n"                "msr msp, r0\n"                "bx r1\n"                :                : [start] "r"(XIP_BASE + USBDRIVE_APP_OFFSET + 256), [vtable] "X"(PPB_BASE + M33_VTOR_OFFSET)                :);
Questions:
1. Has anyone successfully implemented a similar application jump on the RP2350?
2. Are there specific considerations or configurations required for the RP2350's Cortex-M33 core when performing such jumps?
3. Could TrustZone or other security features be influencing the application's behavior during the jump?

Any insights or guidance would be greatly appreciated.

Statistics: Posted by logronoide — Tue Mar 11, 2025 7:40 pm — Replies 3 — Views 94



Viewing all articles
Browse latest Browse all 5010

Trending Articles