Skip to content

Commit efa8d63

Browse files
committed
Using 0x20000 as start of primary partition in the example
1 parent 433fad0 commit efa8d63

5 files changed

Lines changed: 14 additions & 23 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LD:=$(CROSS_COMPILE)gcc
66
OBJCOPY:=$(CROSS_COMPILE)objcopy
77
SIZE:=$(CROSS_COMPILE)size
88
BOOT_IMG?=test-app/image.bin
9-
BOOTLOADER_SIZE?=0x10000
9+
BOOT0_OFFSET?=0x20000
1010
SIGN?=ED25519
1111
TARGET?=stm32f4
1212
DEBUG?=0
@@ -71,7 +71,7 @@ wolfboot.bin: wolfboot.elf
7171
align: wolfboot-align.bin
7272

7373
wolfboot-align.bin: wolfboot.elf
74-
$(OBJCOPY) -O binary $^ $@ --pad-to=$(BOOTLOADER_SIZE) --gap-fill=255
74+
$(OBJCOPY) -O binary $^ $@ --pad-to=$(BOOT0_OFFSET) --gap-fill=255
7575
$(SIZE) wolfboot.elf
7676

7777
test-app/image.bin:

include/target.h

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

7-
#ifdef PLATFORM_nrf52sd
8-
# define FLASH_AREA_IMAGE_0_OFFSET 0x002F000
9-
# define FLASH_AREA_IMAGE_0_SIZE 0x0020000
10-
# define FLASH_AREA_IMAGE_1_OFFSET 0x004f000
11-
# define FLASH_AREA_IMAGE_1_SIZE 0x0020000
12-
# define FLASH_AREA_IMAGE_SCRATCH_OFFSET 0x6f000
13-
# define FLASH_AREA_IMAGE_SCRATCH_SIZE 0x11000
14-
#else
15-
# define FLASH_AREA_IMAGE_0_OFFSET 0x0010000
16-
# define FLASH_AREA_IMAGE_0_SIZE 0x0010000
17-
# define FLASH_AREA_IMAGE_1_OFFSET 0x0020000
18-
# define FLASH_AREA_IMAGE_1_SIZE 0x0010000
19-
# define FLASH_AREA_IMAGE_SCRATCH_OFFSET 0x0040000
20-
# define FLASH_AREA_IMAGE_SCRATCH_SIZE 0x20000
21-
#endif
7+
#define FLASH_AREA_IMAGE_0_OFFSET 0x20000
8+
#define FLASH_AREA_IMAGE_0_SIZE 0x20000
9+
#define FLASH_AREA_IMAGE_1_OFFSET 0x40000
10+
#define FLASH_AREA_IMAGE_1_SIZE 0x20000
11+
#define FLASH_AREA_IMAGE_SCRATCH_OFFSET 0x60000
12+
#define FLASH_AREA_IMAGE_SCRATCH_SIZE 0x20000
2213

2314
/*
2415
* Sanity check the target support.

test-app/app.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MEMORY
22
{
3-
FLASH (rx) : ORIGIN = 0x00010100, LENGTH = 0x000FF00
3+
FLASH (rx) : ORIGIN = 0x00020100, LENGTH = 0x001FF00
44
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00010000
55
}
66

tools/ed25519/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Settings
22
#
3-
BOOTUTIL_ROOT?=../../lib/bootutil
4-
5-
6-
CFLAGS:=-lwolfssl -DHAVE_ED25519 -DHAVE_ASN -DWOLFCRYPT_ONLY -DTFM_TIMING_RESISTANT -DNO_RSA -DECC_TIMING_RESISTANT -DWOLFSSL_DER_TO_PEM -I$(BOOTUTIL_ROOT)/include
3+
WOLFBOOT_ROOT=../../
4+
BOOTUTIL_ROOT=$(WOLFBOOT_ROOT)/lib/bootutil
5+
CFLAGS:=-lwolfssl -DHAVE_ED25519 -DHAVE_ASN -DWOLFCRYPT_ONLY -DTFM_TIMING_RESISTANT -DNO_RSA -DECC_TIMING_RESISTANT -DWOLFSSL_DER_TO_PEM -I$(BOOTUTIL_ROOT)/include -I$(WOLFBOOT_ROOT)/include
76

87
all: ed25519_keygen ed25519_sign
98

tools/ed25519/ed25519_sign.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <wolfssl/wolfcrypt/asn_public.h>
2828
#include <bootutil/image.h>
2929
#include <sys/stat.h>
30+
#include "target.h"
3031

3132
#define IMAGE_FIRMWARE_OFFSET 256
3233

@@ -140,7 +141,7 @@ int main(int argc, char *argv[])
140141
}
141142
memset(hdr, 0x00, IMAGE_FIRMWARE_OFFSET);
142143
hdr->ih_magic = IMAGE_MAGIC;
143-
hdr->ih_load_addr = 0x10100;
144+
hdr->ih_load_addr = FLASH_AREA_IMAGE_0_OFFSET + IMAGE_FIRMWARE_OFFSET;
144145
hdr->ih_hdr_size = IMAGE_FIRMWARE_OFFSET;
145146
hdr->ih_img_size = st.st_size;
146147
hdr->ih_ver.iv_major = version;

0 commit comments

Comments
 (0)