Skip to content

Commit 7f02df5

Browse files
committed
Added SWAP=0 option, fixed some warnings
1 parent 34a8ae4 commit 7f02df5

5 files changed

Lines changed: 16 additions & 5 deletions

File tree

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ SIGN?=ED25519
1111
TARGET?=stm32f4
1212
DEBUG?=0
1313
VTOR?=1
14+
SWAP?=1
1415

1516
LSCRIPT:=hal/$(TARGET).ld
1617

@@ -60,6 +61,9 @@ ifeq ($(VTOR),0)
6061
CFLAGS+=-DNO_VTOR
6162
endif
6263

64+
ifeq ($(SWAP),0)
65+
CFLAGS+=-DWOLFBOOT_OVERWRITE_ONLY
66+
endif
6367

6468

6569
LDFLAGS:=-T $(LSCRIPT) -Wl,-gc-sections -Wl,-Map=wolfboot.map -ffreestanding -nostartfiles -mcpu=cortex-m3 -mthumb -nostdlib

hal/nrf52.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ static void flash_wait_complete(void)
5454
int hal_flash_write(uint32_t address, const uint8_t *data, int len)
5555
{
5656
int i;
57-
uint32_t val;
5857
NVMC_CONFIG = NVMC_CONFIG_WEN;
5958
flash_wait_complete();
6059
/* Set 8-bit write */

include/target.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
#define FLASH_DEV_NAME "flash"
55
#define FLASH_ALIGN 4
66

7+
/* Example flash partitioning.
8+
* Ensure that your firmware entry point is
9+
* at FLASH_AREA_IMAGE_0_OFFSET + 0x100
10+
*/
711
#define FLASH_AREA_IMAGE_0_OFFSET 0x20000
812
#define FLASH_AREA_IMAGE_0_SIZE 0x20000
913
#define FLASH_AREA_IMAGE_1_OFFSET 0x40000
@@ -19,9 +23,7 @@
1923
!defined(FLASH_AREA_IMAGE_0_OFFSET) || \
2024
!defined(FLASH_AREA_IMAGE_0_SIZE) || \
2125
!defined(FLASH_AREA_IMAGE_1_OFFSET) || \
22-
!defined(FLASH_AREA_IMAGE_1_SIZE) || \
23-
!defined(FLASH_AREA_IMAGE_SCRATCH_OFFSET) || \
24-
!defined(FLASH_AREA_IMAGE_SCRATCH_SIZE)
26+
!defined(FLASH_AREA_IMAGE_1_SIZE)
2527
#error "Target support is incomplete; cannot build wolfboot."
2628
#endif
2729

lib/bootutil/src/loader.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,9 +1332,11 @@ boot_go(struct boot_rsp *rsp)
13321332
rc = flash_area_open(fa_id, &BOOT_IMG_AREA(&boot_data, slot));
13331333
assert(rc == 0);
13341334
}
1335+
#ifndef WOLFBOOT_OVERWRITE_ONLY
13351336
rc = flash_area_open(FLASH_AREA_IMAGE_SCRATCH,
13361337
&BOOT_SCRATCH_AREA(&boot_data));
13371338
assert(rc == 0);
1339+
#endif
13381340

13391341
/* Determine the sector layout of the image slots and scratch area. */
13401342
rc = boot_read_sectors();

src/run.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ static struct area_desc flash_areas[1] = {
7575
.id = FLASH_AREA_IMAGE_1,
7676
.num_areas = 1
7777
},
78+
#ifndef WOLFBOOT_OVERWRITE_ONLY
7879
{
7980
.whole = {
8081
.fa_id = FLASH_AREA_IMAGE_SCRATCH,
@@ -87,6 +88,10 @@ static struct area_desc flash_areas[1] = {
8788
}
8889
},
8990
.num_slots = 3
91+
#else
92+
},
93+
.num_slots = 2
94+
#endif
9095
}
9196
} ;
9297

@@ -144,7 +149,6 @@ int flash_area_read(const struct flash_area *area, uint32_t off, void *dst,
144149
int flash_area_write(const struct flash_area *area, uint32_t off, const void *src,
145150
uint32_t len)
146151
{
147-
uint32_t address;
148152
BOOT_LOG_DBG("%s: area=%d, off=%x, len=%x", __func__,
149153
area->fa_id, off, len);
150154
hal_flash_unlock();

0 commit comments

Comments
 (0)