Zephyr: STM bootloader activation added
This commit is contained in:
+14
-1
@@ -220,10 +220,23 @@ void reset_device()
|
||||
#elif defined(__ZEPHYR__)
|
||||
|
||||
#include <power/reboot.h>
|
||||
#include <drivers/gpio.h>
|
||||
|
||||
void start_stm32_bootloader()
|
||||
{
|
||||
// TODO
|
||||
#ifdef DT_SWITCH_BOOT0_EN_GPIOS_CONTROLLER
|
||||
// pin is connected to BOOT0 via resistor and capacitor
|
||||
struct device *dev = device_get_binding(DT_SWITCH_BOOT0_EN_GPIOS_CONTROLLER);
|
||||
gpio_pin_configure(dev, DT_SWITCH_BOOT0_EN_GPIOS_PIN, GPIO_DIR_OUT);
|
||||
gpio_pin_write(dev, DT_SWITCH_BOOT0_EN_GPIOS_PIN, 1);
|
||||
|
||||
k_sleep(100); // wait for capacitor at BOOT0 pin to charge up
|
||||
reset_device();
|
||||
#elif defined (STM32F0)
|
||||
// place magic code at end of RAM and initiate reset
|
||||
*((uint32_t *)(MAGIC_CODE_ADDR)) = 0xDEADBEEF;
|
||||
reset_device();
|
||||
#endif
|
||||
}
|
||||
|
||||
void reset_device()
|
||||
|
||||
Reference in New Issue
Block a user