summaryrefslogtreecommitdiff
path: root/board/servo_micro/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/servo_micro/board.c')
-rw-r--r--board/servo_micro/board.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/board/servo_micro/board.c b/board/servo_micro/board.c
index bf25f86630..305c1ce320 100644
--- a/board/servo_micro/board.c
+++ b/board/servo_micro/board.c
@@ -13,6 +13,7 @@
#include "registers.h"
#include "spi.h"
#include "task.h"
+#include "update_fw.h"
#include "usart-stm32f0.h"
#include "usart_tx_dma.h"
#include "usart_rx_dma.h"
@@ -23,7 +24,6 @@
#include "gpio_list.h"
-
/******************************************************************************
* Forward UARTs as a USB serial interface.
*/
@@ -134,6 +134,7 @@ const void *const usb_strings[] = {
[USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Servo EC Shell"),
[USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("Servo UART2"),
[USB_STR_USART2_STREAM_NAME] = USB_STRING_DESC("Servo UART1"),
+ [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
@@ -186,7 +187,6 @@ void usb_spi_board_disable(struct usb_spi_config const *config)
USB_SPI_CONFIG(usb_spi, USB_IFACE_SPI, USB_EP_SPI);
-
/******************************************************************************
* Support I2C bridging over USB, this requires usb_i2c_board_enable and
* usb_i2c_board_disable to be defined to enable and disable the SPI bridge.
@@ -203,6 +203,26 @@ USB_I2C_CONFIG(usb_i2c, USB_IFACE_I2C, USB_EP_I2C);
/******************************************************************************
+ * Support firmware upgrade over USB. We can update whichever section is not
+ * the current section.
+ */
+
+/*
+ * This array defines possible sections available for the firmware update.
+ * The section which does not map the current executing code is picked as the
+ * valid update area. The values are offsets into the flash space.
+ */
+const struct section_descriptor board_rw_sections[] = {
+ {CONFIG_RO_MEM_OFF,
+ CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE},
+ {CONFIG_RW_MEM_OFF,
+ CONFIG_RW_MEM_OFF + CONFIG_RW_SIZE},
+};
+const struct section_descriptor * const rw_sections = board_rw_sections;
+const int num_rw_sections = ARRAY_SIZE(board_rw_sections);
+
+
+/******************************************************************************
* Initialize board.
*/
static void board_init(void)