Skip to content

Commit 37e4223

Browse files
lenghonglind3zd3z
authored andcommitted
sample:zephyr: decrease some hard code
Signed-off-by: honglin leng <[email protected]>
1 parent e457444 commit 37e4223

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

samples/zephyr/Makefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@
5353
BOOTLOADER_OVERLAY_CONFIG ?=
5454

5555
BOARD ?= frdm_k64f
56+
SLOT_SIZE ?= 0x60000
57+
BOOT_ADDR ?= 0x0
58+
IMG0_ADDR ?= 0x20000
59+
IMG1_ADDR ?= 0x80000
5660

5761
.PHONY: check boot hello1 clean_boot clean_hello1 \
5862
hello2 clean_hello2 flash_boot flash_hello1 flash_hello2
@@ -130,7 +134,7 @@ hello1: check
130134
--header-size $(BOOT_HEADER_LEN) \
131135
--align $(FLASH_ALIGNMENT) \
132136
--version 1.2 \
133-
--slot-size 0x60000 \
137+
--slot-size $(SLOT_SIZE) \
134138
$(BUILD_DIR_HELLO1)/zephyr/zephyr.bin \
135139
signed-hello1.bin
136140

@@ -155,7 +159,7 @@ hello2: check
155159
--header-size $(BOOT_HEADER_LEN) \
156160
--align $(FLASH_ALIGNMENT) \
157161
--version 1.2 \
158-
--slot-size 0x60000 \
162+
--slot-size $(SLOT_SIZE) \
159163
--pad \
160164
$(BUILD_DIR_HELLO2)/zephyr/zephyr.bin \
161165
signed-hello2.bin
@@ -167,16 +171,16 @@ clean_hello2: check
167171
# are hardcoded at this time.
168172

169173
flash_boot:
170-
$(PYOCD) flash -e chip -a 0 mcuboot.bin
174+
$(PYOCD) flash -e chip -a $(BOOT_ADDR) mcuboot.bin
171175

172176
flash_hello1:
173-
$(PYOCD) flash -a 0x20000 signed-hello1.bin
177+
$(PYOCD) flash -a $(IMG0_ADDR) signed-hello1.bin
174178

175179
flash_hello2:
176-
$(PYOCD) flash -a 0x80000 signed-hello2.bin
180+
$(PYOCD) flash -a $(IMG1_ADDR) signed-hello2.bin
177181

178182
flash_full:
179-
$(PYOCD) flash -e chip -a 0 full.bin
183+
$(PYOCD) flash -e chip -a $(BOOT_ADDR) full.bin
180184

181185
# These test- targets reinvoke make with the configuration set to test
182186
# various configurations. This will generally be followed by using

0 commit comments

Comments
 (0)