From 0b6435560efec53e78e9c3f7c45a969636a5df98 Mon Sep 17 00:00:00 2001 From: Bas Stottelaar Date: Mon, 22 Jul 2019 00:06:30 +0200 Subject: [PATCH 1/3] efm32: optimize when building the bootloader --- cpu/efm32/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cpu/efm32/cpu.c b/cpu/efm32/cpu.c index 5c4a9a3835d2..4d34a9919db5 100644 --- a/cpu/efm32/cpu.c +++ b/cpu/efm32/cpu.c @@ -51,6 +51,8 @@ #define EMU_EM4INIT EMU_EM4INIT_DEFAULT #endif +#ifndef RIOTBOOT + #ifdef _SILICON_LABS_32B_SERIES_1 /** * @brief Initialize integrated DC-DC regulator @@ -154,14 +156,20 @@ static void pm_init(void) #endif } +#endif + void cpu_init(void) { +#ifndef RIOTBOOT /* apply errata that may be applicable (see em_chip.h) */ CHIP_Init(); +#endif /* initialize the Cortex-M core */ cortexm_init(); +#ifndef RIOTBOOT + #ifdef _SILICON_LABS_32B_SERIES_1 /* initialize dc-dc */ dcdc_init(); @@ -178,4 +186,5 @@ void cpu_init(void) /* trigger static peripheral initialization */ periph_init(); +#endif } From 962b0efaaff8c66d950ca352320ad574c4aca516 Mon Sep 17 00:00:00 2001 From: Bas Stottelaar Date: Mon, 22 Jul 2019 00:06:58 +0200 Subject: [PATCH 2/3] boards+efm32: add support for riotboot --- boards/common/silabs/Makefile.features | 1 + boards/ikea-tradfri/Makefile.features | 3 +++ cpu/efm32/Makefile.include | 3 +++ 3 files changed, 7 insertions(+) diff --git a/boards/common/silabs/Makefile.features b/boards/common/silabs/Makefile.features index 0f1b19ddfb3d..66b8cb066d1f 100644 --- a/boards/common/silabs/Makefile.features +++ b/boards/common/silabs/Makefile.features @@ -1,2 +1,3 @@ # Various other features (if any) FEATURES_PROVIDED += arduino +FEATURES_PROVIDED += riotboot diff --git a/boards/ikea-tradfri/Makefile.features b/boards/ikea-tradfri/Makefile.features index d03b3183b67f..8bb814676b1f 100644 --- a/boards/ikea-tradfri/Makefile.features +++ b/boards/ikea-tradfri/Makefile.features @@ -8,3 +8,6 @@ FEATURES_PROVIDED += periph_rtt FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart periph_uart_modecfg + +# Put other features for this board (in alphabetical order) +FEATURES_PROVIDED += riotboot diff --git a/cpu/efm32/Makefile.include b/cpu/efm32/Makefile.include index 0a054832937d..cb5d566fc49d 100644 --- a/cpu/efm32/Makefile.include +++ b/cpu/efm32/Makefile.include @@ -3,6 +3,9 @@ include $(RIOTCPU)/efm32/efm32-info.mk export CPU_ARCH = $(EFM32_ARCHITECTURE) export CPU_FAM = $(EFM32_FAMILY) +# the size of riotboot on the EFM32 exceeds the default value +RIOTBOOT_LEN ?= 0x2000 + # the em_device.h header requires a global define with the cpu model CFLAGS += -D$(call uppercase_and_underscore,$(CPU_MODEL)) From 08bc67c0b69e8e13e8a18552b81d695bc12aa293 Mon Sep 17 00:00:00 2001 From: Bas Stottelaar Date: Thu, 26 Sep 2019 23:32:26 +0200 Subject: [PATCH 3/3] boards+efm32: skip board initialization when in bootloader --- boards/ikea-tradfri/board.c | 2 ++ boards/slstk3401a/board.c | 2 ++ boards/slstk3402a/board.c | 2 ++ boards/sltb001a/board.c | 2 ++ boards/slwstk6000b/board.c | 2 ++ boards/stk3600/board.c | 2 ++ boards/stk3700/board.c | 2 ++ 7 files changed, 14 insertions(+) diff --git a/boards/ikea-tradfri/board.c b/boards/ikea-tradfri/board.c index 9d1410bcc451..ee1d4b1b23d0 100644 --- a/boards/ikea-tradfri/board.c +++ b/boards/ikea-tradfri/board.c @@ -26,7 +26,9 @@ void board_init(void) /* initialize the CPU */ cpu_init(); +#ifndef RIOTBOOT /* initialize the LEDs */ gpio_init(LED0_PIN, GPIO_OUT); gpio_init(LED1_PIN, GPIO_OUT); +#endif } diff --git a/boards/slstk3401a/board.c b/boards/slstk3401a/board.c index 37313bb02737..3a346efd7738 100644 --- a/boards/slstk3401a/board.c +++ b/boards/slstk3401a/board.c @@ -28,6 +28,7 @@ void board_init(void) /* initialize the CPU */ cpu_init(); +#ifndef RIOTBOOT /* perform common board initialization */ board_common_init(); @@ -36,4 +37,5 @@ void board_init(void) gpio_init(SI7021_EN_PIN, GPIO_OUT); gpio_set(SI7021_EN_PIN); #endif +#endif } diff --git a/boards/slstk3402a/board.c b/boards/slstk3402a/board.c index 4a0f9170e6c7..1ceed57ef9f3 100644 --- a/boards/slstk3402a/board.c +++ b/boards/slstk3402a/board.c @@ -28,6 +28,7 @@ void board_init(void) /* initialize the CPU */ cpu_init(); +#ifndef RIOTBOOT /* perform common board initialization */ board_common_init(); @@ -36,4 +37,5 @@ void board_init(void) gpio_init(SI7021_EN_PIN, GPIO_OUT); gpio_set(SI7021_EN_PIN); #endif +#endif } diff --git a/boards/sltb001a/board.c b/boards/sltb001a/board.c index 26bde761d888..94ec47af4c60 100644 --- a/boards/sltb001a/board.c +++ b/boards/sltb001a/board.c @@ -32,6 +32,7 @@ void board_init(void) /* initialize the CPU */ cpu_init(); +#ifndef RIOTBOOT /* perform common board initialization */ board_common_init(); @@ -61,4 +62,5 @@ void board_init(void) (RGB_LED4_ENABLED << RGB_LED4_EN_BIT)); #endif #endif +#endif } diff --git a/boards/slwstk6000b/board.c b/boards/slwstk6000b/board.c index ed1d85e517f0..606e86415b15 100644 --- a/boards/slwstk6000b/board.c +++ b/boards/slwstk6000b/board.c @@ -28,6 +28,7 @@ void board_init(void) /* initialize the CPU */ cpu_init(); +#ifndef RIOTBOOT /* perform common board initialization */ board_common_init(); @@ -36,4 +37,5 @@ void board_init(void) gpio_init(SI7021_EN_PIN, GPIO_OUT); gpio_set(SI7021_EN_PIN); #endif +#endif } diff --git a/boards/stk3600/board.c b/boards/stk3600/board.c index 3ee4f85774fa..19f1453ff147 100644 --- a/boards/stk3600/board.c +++ b/boards/stk3600/board.c @@ -27,6 +27,8 @@ void board_init(void) /* initialize the CPU */ cpu_init(); +#ifndef RIOTBOOT /* perform common board initialization */ board_common_init(); +#endif } diff --git a/boards/stk3700/board.c b/boards/stk3700/board.c index de838de006e1..27b36725d66f 100644 --- a/boards/stk3700/board.c +++ b/boards/stk3700/board.c @@ -27,6 +27,8 @@ void board_init(void) /* initialize the CPU */ cpu_init(); +#ifndef RIOTBOOT /* perform common board initialization */ board_common_init(); +#endif }