Skip to content

Commit f2be454

Browse files
committed
Fixes for building STM32G0.
1 parent 254882c commit f2be454

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

docs/Targets.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Targets
22

3+
This README describes configuration of supported targets.
4+
35
## STM32-F407
46

57
Example 512KB partitioning on STM32-F407
@@ -69,6 +71,7 @@ Possible workarounds:
6971
- Compile ed25519 with debug (optimizations are disabled) : `make TARGET=stm32l0 DEBUG=1`
7072
- Use ECDSA instead (which is much faster) : `make TARGET=stm32l0 SIGN=ECC256`
7173

74+
7275
## STM32G0x0/STM32G0x1
7376

7477
Example 128KB partitioning on STM32-G070:
@@ -87,7 +90,7 @@ Example 128KB partitioning on STM32-G070:
8790

8891
### Building
8992

90-
Use `make TARGET=stm32l0`. The option `CORTEX_M0` is automatically selected for this target.
93+
Use `make TARGET=stm32g0`. The option `CORTEX_M0` is automatically selected for this target.
9194
The option `NVM_FLASH_WRITEONCE=1` is mandatory on this target, since the IAP driver does not support
9295
multiple writes after each erase operation.
9396

@@ -101,8 +104,9 @@ With Ed25519 (default SIGN algorithm) it's not possible at the moment to compile
101104
with optimizations, due to a GCC linker error complaining about a missing symbol `__gnu_thumb1_case_uqi`.
102105

103106
Possible workarounds:
104-
- Compile ed25519 with debug (optimizations are disabled) : `make TARGET=stm32l0 DEBUG=1`
105-
- Use ECDSA instead (which is much faster) : `make TARGET=stm32l0 SIGN=ECC256`
107+
- Compile ed25519 with debug (optimizations are disabled) : `make TARGET=stm32g0 NVM_FLASH_WRITEONCE=1 DEBUG=1`
108+
- Use ECDSA instead (which is much faster) : `make TARGET=stm32g0 NVM_FLASH_WRITEONCE=1 SIGN=ECC256`
109+
106110

107111
## SiFive HiFive1 RISC-V
108112

@@ -188,9 +192,3 @@ riscv64-unknown-elf-gdb wolfboot.elf -ex "set remotetimeout 240" -ex "target ext
188192
add-symbol-file test-app/image.elf 0x20020100
189193
```
190194

191-
```
192-
riscv64-unknown-elf-objdump -D test-app/image.elf
193-
```
194-
195-
196-

hal/stm32g0.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ int RAMFUNCTION hal_flash_write(uint32_t address, const uint8_t *data, int len)
114114
uint32_t *src, *dst;
115115
flash_clear_errors();
116116
FLASH_CR |= FLASH_CR_PG;
117-
117+
118118
while (i < len) {
119119
flash_clear_errors();
120120
if ((len - i > 3) && ((((address + i) & 0x07) == 0) && ((((uint32_t)data) + i) & 0x07) == 0)) {
@@ -141,7 +141,7 @@ int RAMFUNCTION hal_flash_write(uint32_t address, const uint8_t *data, int len)
141141
flash_wait_complete();
142142
}
143143
}
144-
if ((FLASH_SR & FLASH_SR_EOP) == FLASH_SR_EOP);
144+
if ((FLASH_SR & FLASH_SR_EOP) == FLASH_SR_EOP)
145145
FLASH_SR |= FLASH_SR_EOP;
146146
FLASH_CR &= ~FLASH_CR_PG;
147147
return 0;

src/libwolfboot.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ uint32_t ext_cache;
3939
#define PART_UPDATE_ENDFLAGS ((WOLFBOOT_PARTITION_UPDATE_ADDRESS + WOLFBOOT_PARTITION_SIZE) - TRAILER_SKIP)
4040

4141
#ifdef NVM_FLASH_WRITEONCE
42+
#include <stddef.h>
43+
extern void *memcpy(void *dst, const void *src, size_t n);
4244
static uint8_t NVM_CACHE[WOLFBOOT_SECTOR_SIZE];
4345
int RAMFUNCTION hal_trailer_write(uint32_t addr, uint8_t val) {
4446
uint32_t addr_align = addr & (~(WOLFBOOT_SECTOR_SIZE - 1));

0 commit comments

Comments
 (0)