Skip to content

Commit a342b78

Browse files
committed
Minor cleanups.
1 parent 2f05d44 commit a342b78

8 files changed

Lines changed: 44 additions & 260 deletions

File tree

config/examples/stm32wb-tpm.config

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
TARGET=stm32wb
2+
SIGN=ECC256
3+
WOLFBOOT_SECTOR_SIZE?=0x20000
4+
WOLFBOOT_PARTITION_SIZE?=0x60000
5+
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x20000
6+
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x00000
7+
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x60000
8+
NVM_FLASH_WRITEONCE=1
9+
PKA=0
10+
WOLFTPM=1

config/examples/stm32wb.config

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
TARGET=stm32wb
22
SIGN=ECC256
3-
WOLFBOOT_SECTOR_SIZE?=0x1000
4-
WOLFBOOT_PARTITION_SIZE?=0x20000
5-
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x8000
6-
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x28000
7-
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x48000
3+
WOLFBOOT_SECTOR_SIZE?=0x20000
4+
WOLFBOOT_PARTITION_SIZE?=0x60000
5+
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x20000
6+
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x00000
7+
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x60000
88
NVM_FLASH_WRITEONCE=1
9-
PKA=0
10-
WOLFTPM=1
9+
PKA=1

hal/spi/spi_drv_stm32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* spi_drv.h
1+
/* spi_drv_stm32.c
22
*
33
* Driver for the SPI back-end of the SPI_FLASH module.
44
*

hal/spi/spi_drv_stm32.h

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/* spi_drv_stm32.h
2+
*
3+
* wolfBoot is free software; you can redistribute it and/or modify
4+
* it under the terms of the GNU General Public License as published by
5+
* the Free Software Foundation; either version 2 of the License, or
6+
* (at your option) any later version.
7+
*
8+
* wolfBoot is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program; if not, write to the Free Software
15+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
16+
*/
17+
118
#ifndef SPI_DRV_STM32_H_INCLUDED
219
#define SPI_DRV_STM32_H_INCLUDED
320
#include <stdint.h>
@@ -13,16 +30,15 @@
1330
#define CEN_GPIOE (1 << 4)
1431

1532
#ifdef PLATFORM_stm32f4
16-
#define APB2_CLOCK_ER (*(volatile uint32_t *)(0x40023844))
17-
#define APB2_CLOCK_RST (*(volatile uint32_t *)(0x40023824))
18-
#define CLOCK_SPEED (168000000)
33+
#define APB2_CLOCK_ER (*(volatile uint32_t *)(0x40023844))
34+
#define APB2_CLOCK_RST (*(volatile uint32_t *)(0x40023824))
1935
#define RCC_GPIO_CLOCK_ER (*(volatile uint32_t *)(0x40023830))
2036
#define GPIOA_BASE (0x40020000)
2137
#define GPIOB_BASE (0x40020400)
2238
#define GPIOC_BASE (0x40020800)
2339
#define GPIOD_BASE (0x40020C00)
2440
#define GPIOE_BASE (0x40021000)
25-
#define SPI_GPIO GPIOB_BASE
41+
#define SPI_GPIO GPIOB_BASE
2642
#define SPI_CS_GPIO GPIOE_BASE
2743
#define SPI_CS_FLASH 1 /* Flash CS connected to GPIOE1 */
2844
#define SPI_CS_TPM 0 /* TPM CS connected to GPIOE0 */
@@ -33,16 +49,16 @@
3349
#endif
3450

3551
#ifdef PLATFORM_stm32wb
36-
#define APB2_CLOCK_ER (*(volatile uint32_t *)(0x58000060))
37-
#define APB2_CLOCK_RST (*(volatile uint32_t *)(0x58000040))
38-
#define SPI_GPIO GPIOA_BASE
52+
#define APB2_CLOCK_ER (*(volatile uint32_t *)(0x58000060))
53+
#define APB2_CLOCK_RST (*(volatile uint32_t *)(0x58000040))
3954
#define RCC_GPIO_CLOCK_ER (*(volatile uint32_t *)(0x5800004C))
4055
#define GPIOA_BASE (0x48000000)
4156
#define GPIOB_BASE (0x48000400)
4257
#define GPIOC_BASE (0x48000800)
4358
#define GPIOD_BASE (0x48000C00)
4459

4560
/* STM32WB55 NUCLEO: CN9: D13=SCK, D12=MISO, D11=MOSI, FLASHCS=D10, TPMCS=D9 */
61+
#define SPI_GPIO GPIOA_BASE
4662
#define SPI_CS_GPIO GPIOA_BASE
4763
#define SPI_CS_FLASH 4 /* Flash CS connected to GPIOA4 */
4864
#define SPI_CS_TPM 9 /* TPM CS connected to GPIOA9 */
@@ -52,7 +68,7 @@
5268
#define SPI1_MOSI_PIN 7 /* SPI_MOSI PA7 */
5369
#endif
5470

55-
#define SPI_PIO_BASE SPI_GPIO
71+
#define SPI_PIO_BASE SPI_GPIO
5672
#define SPI_CS_PIO_BASE SPI_CS_GPIO
5773

5874
#if (SPI_GPIO == GPIOA_BASE)

hal/spi/spi_drv_stm32f4.c

Lines changed: 0 additions & 173 deletions
This file was deleted.

hal/spi/spi_drv_stm32f4.h

Lines changed: 0 additions & 68 deletions
This file was deleted.

lib/wolfssl

Submodule wolfssl updated 192 files

src/image.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ static int image_hash(struct wolfBoot_image *img, uint8_t *hash)
211211
if (stored_sha_len != SHA256_DIGEST_SIZE)
212212
return -1;
213213
wc_InitSha256(&sha256_ctx);
214-
end_sha = stored_sha - 4;
214+
end_sha = stored_sha - (2 * sizeof(uint16_t)); /* Subtract 2 Type + 2 Len */
215215
while (p < end_sha) {
216216
blksz = SHA256_BLOCK_SIZE;
217217
if (end_sha - p < blksz)
@@ -364,7 +364,7 @@ static int image_hash(struct wolfBoot_image *img, uint8_t *hashBuf)
364364
(const byte*)gUsageAuth, sizeof(gUsageAuth)-1);
365365
if (rc != 0)
366366
return -1;
367-
end_sha = stored_sha - 4;
367+
end_sha = stored_sha - (2 * sizeof(uint16_t)); /* Subtract 2 Type + 2 Len */
368368
while (p < end_sha) {
369369
blksz = SHA256_BLOCK_SIZE;
370370
if (end_sha - p < blksz)

0 commit comments

Comments
 (0)