[bsp][pico] Add msh cmd to reset pico to BOOTSEL mode

This commit is contained in:
1ridic 2023-09-27 12:01:55 +08:00 committed by Meco Man
parent 87ee7205d4
commit 11367953d2
1 changed files with 21 additions and 10 deletions

View File

@ -16,6 +16,7 @@
#include "board.h"
#include "hardware/structs/systick.h"
#include "pico/bootrom.h"
#define PLL_SYS_KHZ (133 * 1000)
@ -71,12 +72,13 @@ void rt_hw_board_init()
// Call each function in the list.
// We have to take the address of the symbols, as __init_array_start *is*
// the first function pointer, not the address of it.
for (void (**p)() = &__init_array_start; p < &__init_array_end; ++p) {
for (void (**p)() = &__init_array_start; p < &__init_array_end; ++p)
{
(*p)();
}
/* Configure the SysTick */
systick_config(clock_get_hz(clk_sys)/RT_TICK_PER_SECOND);
systick_config(clock_get_hz(clk_sys) / RT_TICK_PER_SECOND);
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
@ -91,3 +93,12 @@ void rt_hw_board_init()
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
}
#ifdef RT_USING_MSH
static int pico_reboot(int argc, char *argv[])
{
reset_usb_boot(0, 0);
return 0;
}
MSH_CMD_EXPORT_ALIAS(pico_reboot, reboot, reset Pico to BOOTSEL mode);
#endif