Zephyr: STM bootloader activation added
This commit is contained in:
@@ -48,8 +48,11 @@
|
||||
gpios = <&gpioc 14 GPIO_DIR_IN>;
|
||||
label = "Solar voltage measurement enable";
|
||||
};
|
||||
boot0-en {
|
||||
gpios = <&gpiob 12 GPIO_DIR_IN>;
|
||||
label = "BOOT0 pin trigger";
|
||||
};
|
||||
};
|
||||
|
||||
aliases {
|
||||
uart-dbg = &usart1;
|
||||
uext-uart = &usart2;
|
||||
|
||||
@@ -44,6 +44,10 @@
|
||||
gpios = <&gpiob 5 GPIO_DIR_IN>;
|
||||
label = "USB charging port disable";
|
||||
};
|
||||
boot0-en {
|
||||
gpios = <&gpiob 12 GPIO_DIR_IN>;
|
||||
label = "BOOT0 pin trigger";
|
||||
};
|
||||
};
|
||||
|
||||
aliases {
|
||||
|
||||
+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