Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,15 @@ ifeq ($(TARGET),kinetis)
## ECC_EXTRA_OBJS+=./lib/wolfssl/wolfcrypt/src/port/nxp/ksdk_port.o $(KINETIS_DRIVERS)/drivers/fsl_ltc.o
##endif
endif

ifeq ($(TARGET),stm32wb)
ifneq ($(PKA),0)
ECC_EXTRA_OBJS+= $(STM32CUBE)/Drivers/STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pka.o ./lib/wolfssl/wolfcrypt/src/port/st/stm32.o
ECC_EXTRA_CFLAGS+=-DWOLFSSL_STM32_PKA -I$(STM32CUBE)/Drivers/STM32WBxx_HAL_Driver/Inc \
-Isrc -I$(STM32CUBE)/Drivers/BSP/P-NUCLEO-WB55.Nucleo/ -I$(STM32CUBE)/Drivers/CMSIS/Device/ST/STM32WBxx/Include \
-I$(STM32CUBE)/Drivers/STM32WBxx_HAL_Driver/Inc/ \
-I$(STM32CUBE)/Drivers/CMSIS/Include \
-Ihal \
-DSTM32WB55xx
endif
endif
27 changes: 27 additions & 0 deletions config/examples/kinetis-k82f.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ARCH?=ARM
TARGET?=kinetis
SIGN?=ECC256
KINETIS?=$(HOME)/src/FRDM-K82F
KINETIS_CPU?=MK82FN256VLL15
KINETIS_DRIVERS?=$(KINETIS)/devices/MK82F25615
KINETIS_CMSIS?=$(HOME)/src/FRDM-K64F/CMSIS
FREEDOM_E_SDK?=$(HOME)/src/freedom-e-sdk
DEBUG?=0
VTOR?=1
CORTEX_M0?=0
NO_ASM?=0
EXT_FLASH?=0
SPI_FLASH?=0
ALLOW_DOWNGRADE?=0
NVM_FLASH_WRITEONCE?=1
WOLFBOOT_VERSION?=0
V?=0
SPMATH?=1
RAM_CODE?=0
DUALBANK_SWAP?=0
IMAGE_HEADER_SIZE?=256
WOLFBOOT_PARTITION_SIZE?=0x7A000
WOLFBOOT_SECTOR_SIZE?=0x1000
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xA000
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x84000
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xff000
1 change: 1 addition & 0 deletions config/examples/stm32wb-small.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ TARGET=stm32wb
SIGN=ECC256
WOLFBOOT_PARTITION_BOOT_ADDRESS=0xA000
WOLFBOOT_PARTITION_SIZE=0x4000
PKA=1
8 changes: 3 additions & 5 deletions docs/Targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Example partitioning on Nucleo-68 board:

- Sector size: 4KB
- Wolfboot partition size: 32 KB
- Applicatiobn partition size: 128 KB
- Application partition size: 128 KB

```C
#define WOLFBOOT_SECTOR_SIZE 0x1000 /* 4 KB */
Expand Down Expand Up @@ -260,7 +260,7 @@ reset
halt
```

OpenOCD can be either run in background (to allow remote GDB and monitor terminal connections), or
OpenOCD can be either run in background (to allow remote GDB and monitor terminal connections), or
directly from command line, to execute terminal scripts.

If OpenOCD is running, local TCP port 4444 can be used to access an interactive terminal prompt.
Expand Down Expand Up @@ -293,7 +293,7 @@ Upon reboot, wolfboot will elect the best candidate (version 2 in this case) and
If the accepted candidate image resides on BANK B (like in this case), wolfBoot will perform one bank swap before
booting.

The bank-swap operation is immediate and a SWAP image is not required in this case. Fallback mechanism can rely on
The bank-swap operation is immediate and a SWAP image is not required in this case. Fallback mechanism can rely on
a second choice (older firmware) in the other bank.


Expand All @@ -309,5 +309,3 @@ From another console, connect using gdb, e.g.:
arm-none-eabi-gdb
(gdb) target remote:3333
```


35 changes: 34 additions & 1 deletion hal/stm32wb.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
*/

#include <stdint.h>
#include <image.h>
#include "image.h"
#ifdef WOLFSSL_STM32_PKA
#include "stm32wbxx_hal.h"
PKA_HandleTypeDef hpka = { };
#endif

/* STM32 WB register configuration */

/* Assembly helpers */
Expand Down Expand Up @@ -286,6 +291,11 @@ static void clock_pll_on(void)
void hal_init(void)
{
clock_pll_on();
#ifdef WOLFSSL_STM32_PKA
__HAL_RCC_PKA_CLK_ENABLE();
hpka.Instance = PKA;
HAL_PKA_Init(&hpka);
#endif
}

void hal_prepare_boot(void)
Expand All @@ -297,3 +307,26 @@ void hal_prepare_boot(void)
clock_pll_off();
}

#ifdef WOLFSSL_STM32_PKA


void HAL_PKA_MspInit(PKA_HandleTypeDef* hpka)
{
if(hpka->Instance==PKA)
{
/* Peripheral clock enable */
__HAL_RCC_PKA_CLK_ENABLE();
}
}

/* This value is unused, the function is never called
* as long as the timeout is 0xFFFFFFFF.
* It is defined here only to avoid a compiler error
* for a missing symbol in hal_pka_driver.
*/
uint32_t HAL_GetTick(void)
{
return 0;
}

#endif
2 changes: 1 addition & 1 deletion lib/wolfssl
Submodule wolfssl updated 368 files
8 changes: 4 additions & 4 deletions test-app/app_stm32f7.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

/* UART module */
#define UART1_PIN_AF 7
#define UART1_RX_PIN 10
#define UART1_TX_PIN 9
#define UART1_RX_PIN 10
#define UART1_TX_PIN 9
#define UART1 (0x40011000)
#define UART1_CR1 (*(volatile uint32_t *)(UART1 + 0x00))
#define UART1_CR2 (*(volatile uint32_t *)(UART1 + 0x04))
Expand Down Expand Up @@ -278,7 +278,7 @@ void uart_update_mgr(void)

#define LED_BOOT_PIN (4)
#define LED_USR_PIN (12)
void boot_led_on(void)
static void boot_led_on(void)
{
uint32_t reg;
uint32_t pin = LED_BOOT_PIN;
Expand All @@ -290,7 +290,7 @@ void boot_led_on(void)
GPIOD_BSRR |= (1 << pin);
}

void boot_led_off(void)
static void boot_led_off(void)
{
GPIOD_BSRR |= (1 << (LED_BOOT_PIN + 16));
}
Expand Down
2 changes: 1 addition & 1 deletion test-app/app_stm32wb.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@

#ifdef PLATFORM_stm32wb

volatile uint32_t time_elapsed = 0;
void main(void) {
boot_led_on();
/* Wait for reboot */
while(1)
;
}
#endif /** PLATFROM_stm32wb **/

3 changes: 2 additions & 1 deletion tools/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ifeq ($(ARCH),)
KINETIS_DRIVERS?=$(KINETIS)/devices/MK64F12
KINETIS_CMSIS?=$(KINETIS)/CMSIS
FREEDOM_E_SDK?=$(HOME)/src/freedom-e-sdk
STM32CUBE?=$(HOME)/src/STM32CubeWB/STM32Cube_FW_WB_V1.2.0
DEBUG?=0
VTOR?=1
CORTEX_M0?=0
Expand All @@ -31,7 +32,7 @@ endif


CONFIG_VARS:= ARCH TARGET SIGN KINETIS KINETIS_CPU KINETIS_DRIVERS \
KINETIS_CMSIS FREEDOM_E_SDK DEBUG VTOR CORTEX_M0 NO_ASM EXT_FLASH \
KINETIS_CMSIS FREEDOM_E_SDK STM32CUBE DEBUG VTOR CORTEX_M0 NO_ASM EXT_FLASH \
SPI_FLASH ALLOW_DOWNGRADE NVM_FLASH_WRITEONCE WOLFBOOT_VERSION V \
SPMATH RAM_CODE DUALBANK_SWAP IMAGE_HEADER_SIZE \
WOLFBOOT_PARTITION_SIZE WOLFBOOT_SECTOR_SIZE \
Expand Down