diff options
Diffstat (limited to 'stmhal/modpyb.c')
-rw-r--r-- | stmhal/modpyb.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c index 2f2e039964..c32a8cfc31 100644 --- a/stmhal/modpyb.c +++ b/stmhal/modpyb.c @@ -74,6 +74,14 @@ STATIC NORETURN mp_obj_t pyb_bootloader(void) { HAL_RCC_DeInit(); HAL_DeInit(); +#if defined(STM32F7) + // arm-none-eabi-gcc 4.9.0 does not correctly inline this + // MSP function, so we write it out explicitly here. + //__set_MSP(*((uint32_t*) 0x1FF00000)); + __ASM volatile ("movw r3, #0x0000\nmovt r3, #0x1FF0\nldr r3, [r3, #0]\nMSR msp, r3\n" : : : "r3", "sp"); + + ((void (*)(void)) *((uint32_t*) 0x1FF00004))(); +#else __HAL_REMAPMEMORY_SYSTEMFLASH(); // arm-none-eabi-gcc 4.9.0 does not correctly inline this @@ -82,6 +90,7 @@ STATIC NORETURN mp_obj_t pyb_bootloader(void) { __ASM volatile ("movs r3, #0\nldr r3, [r3, #0]\nMSR msp, r3\n" : : : "r3", "sp"); ((void (*)(void)) *((uint32_t*) 0x00000004))(); +#endif while (1); } @@ -453,6 +462,9 @@ MP_DEFINE_CONST_FUN_OBJ_0(pyb_stop_obj, pyb_stop); /// \function standby() STATIC mp_obj_t pyb_standby(void) { +#if defined(STM32F7) + printf("pyb.standby not supported yet\n"); +#else // We need to clear the PWR wake-up-flag before entering standby, since // the flag may have been set by a previous wake-up event. Furthermore, // we need to disable the wake-up sources while clearing this flag, so @@ -481,7 +493,7 @@ STATIC mp_obj_t pyb_standby(void) { // enter standby mode HAL_PWR_EnterSTANDBYMode(); // we never return; MCU is reset on exit from standby - +#endif return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_0(pyb_standby_obj, pyb_standby); @@ -577,8 +589,10 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = { #if defined(MICROPY_HW_LED1) { MP_OBJ_NEW_QSTR(MP_QSTR_LED), (mp_obj_t)&pyb_led_type }, #endif +#if !defined(STM32F7) // Temp hack { MP_OBJ_NEW_QSTR(MP_QSTR_I2C), (mp_obj_t)&pyb_i2c_type }, { MP_OBJ_NEW_QSTR(MP_QSTR_SPI), (mp_obj_t)&pyb_spi_type }, +#endif { MP_OBJ_NEW_QSTR(MP_QSTR_UART), (mp_obj_t)&pyb_uart_type }, #if MICROPY_HW_ENABLE_CAN { MP_OBJ_NEW_QSTR(MP_QSTR_CAN), (mp_obj_t)&pyb_can_type }, |