Skip to content

Commit 7c54925

Browse files
ahasztagnordicjm
authored andcommitted
samples: dfu_target: fix partitions with partition manager
By default, partition manager is used - however, the dfu_target_helper partition in the sample code was taken from the dts overlay. This commit fixes this issue, adding a proper static partitioning file. Signed-off-by: Artur Hadasz <[email protected]>
1 parent f07dcd1 commit 7c54925

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
app:
2+
address: 0xc200
3+
end_address: 0x5a000
4+
region: flash_primary
5+
size: 0x4de00
6+
mcuboot:
7+
address: 0x0
8+
end_address: 0xc000
9+
region: flash_primary
10+
size: 0xc000
11+
mcuboot_pad:
12+
address: 0xc000
13+
end_address: 0xc200
14+
region: flash_primary
15+
size: 0x200
16+
mcuboot_primary:
17+
address: 0xc000
18+
end_address: 0x5a000
19+
orig_span: &id001
20+
- mcuboot_pad
21+
- app
22+
region: flash_primary
23+
sharers: 0x1
24+
size: 0x4e000
25+
span: *id001
26+
mcuboot_primary_app:
27+
address: 0xc200
28+
end_address: 0x5a000
29+
orig_span: &id002
30+
- app
31+
region: flash_primary
32+
size: 0x4de00
33+
span: *id002
34+
mcuboot_secondary:
35+
address: 0x5a000
36+
end_address: 0xa8000
37+
region: flash_primary
38+
size: 0x4e000
39+
dfu_target_helper:
40+
address: 0xa8000
41+
end_address: 0x100000
42+
region: flash_primary
43+
size: 0x58000

samples/dfu/dfu_target/src/dfu_target_shell.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,17 @@
1414
#include <dfu/dfu_target_mcuboot.h>
1515
#include <zephyr/dfu/mcuboot.h>
1616

17+
#include <pm_config.h>
18+
1719
#define STREAM_BUF_SIZE 256
20+
21+
#ifdef CONFIG_PARTITION_MANAGER_ENABLED
22+
#define DFU_TARGET_HELPER_ADDRESS PM_DFU_TARGET_HELPER_ADDRESS
23+
#define DFU_TARGET_HELPER_SIZE PM_DFU_TARGET_HELPER_SIZE
24+
#else
1825
#define DFU_TARGET_HELPER_ADDRESS DT_REG_ADDR(DT_ALIAS(dfu_target_helper))
1926
#define DFU_TARGET_HELPER_SIZE DT_REG_SIZE(DT_ALIAS(dfu_target_helper))
27+
#endif
2028

2129
static uint8_t stream_buf[STREAM_BUF_SIZE];
2230

0 commit comments

Comments
 (0)