|
43 | 43 |
|
44 | 44 | #if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD) |
45 | 45 |
|
| 46 | +#ifdef CONFIG_USE_DT_CODE_PARTITION |
| 47 | +#define FIXED_PARTITION_ADDRESS(label) \ |
| 48 | + (DT_REG_ADDR(DT_NODELABEL(label)) + \ |
| 49 | + DT_REG_ADDR(COND_CODE_1(DT_FIXED_SUBPARTITION_EXISTS(DT_NODELABEL(label)), \ |
| 50 | + (DT_GPARENT(DT_PARENT(DT_NODELABEL(label)))), \ |
| 51 | + (DT_GPARENT(DT_NODELABEL(label)))))) |
| 52 | +#define FLASH_LOAD_ADDRESS \ |
| 53 | + (DT_REG_ADDR(DT_CHOSEN(zephyr_code_partition)) + \ |
| 54 | + DT_REG_ADDR(COND_CODE_1(DT_FIXED_SUBPARTITION_EXISTS(DT_CHOSEN(zephyr_code_partition)), \ |
| 55 | + (DT_GPARENT(DT_PARENT(DT_CHOSEN(zephyr_code_partition)))), \ |
| 56 | + (DT_GPARENT(DT_CHOSEN(zephyr_code_partition)))))) |
| 57 | +#define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ |
| 58 | + (FIXED_PARTITION_ADDRESS(label) <= FLASH_LOAD_ADDRESS && \ |
| 59 | + FIXED_PARTITION_ADDRESS(label) + DT_REG_SIZE(DT_NODELABEL(label)) > FLASH_LOAD_ADDRESS) |
| 60 | +#else |
46 | 61 | #ifndef CONFIG_FLASH_LOAD_OFFSET |
47 | 62 | #error MCUmgr requires application to be built with CONFIG_FLASH_LOAD_OFFSET set \ |
48 | 63 | to be able to figure out application running slot. |
|
51 | 66 | #define FIXED_PARTITION_IS_RUNNING_APP_PARTITION(label) \ |
52 | 67 | (FIXED_PARTITION_OFFSET(label) <= CONFIG_FLASH_LOAD_OFFSET && \ |
53 | 68 | FIXED_PARTITION_OFFSET(label) + FIXED_PARTITION_SIZE(label) > CONFIG_FLASH_LOAD_OFFSET) |
| 69 | +#endif |
54 | 70 |
|
55 | 71 | BUILD_ASSERT(sizeof(struct image_header) == IMAGE_HEADER_SIZE, |
56 | 72 | "struct image_header not required size"); |
|
0 commit comments