AP_Bootloader: fixed issue loading NuttX firmwares

NuttX assumes a lot more about MCU state on startup
This commit is contained in:
Andrew Tridgell 2018-06-28 20:09:57 +10:00
parent ca3beb88b7
commit c955d7b824
2 changed files with 10 additions and 2 deletions

View File

@ -180,7 +180,11 @@ do_jump(uint32_t stacktop, uint32_t entrypoint)
SCB_DisableICache();
#endif
chSysLock();
// we set sp as well as msp to avoid an issue with loading NuttX
asm volatile(
"mov sp, %0 \n"
"msr msp, %0 \n"
"bx %1 \n"
: : "r"(stacktop), "r"(entrypoint) :);
@ -217,6 +221,12 @@ jump_to_app()
led_set(LED_OFF);
// resetting the clocks is needed for loading NuttX
rccDisableAPB1(~0, 0);
rccDisableAPB2(~0, 0);
rccResetOTG_FS();
rccResetOTG_HS();
// disable all interrupt sources
port_disable();

View File

@ -369,5 +369,3 @@ void port_setbaud(uint32_t baudrate)
sdStart((SerialDriver *)uarts[last_uart], &sercfg);
#endif
}