|
@@ -88,10 +88,11 @@ struct event {
|
88
|
88
|
#define TCP_PORT 4242
|
89
|
89
|
|
90
|
90
|
struct image_header app_image_header;
|
91
|
|
-#define IMAGE_HEADER_OFFSET ((uint32_t)&app_image_header - XIP_BASE)
|
|
91
|
+#define IMAGE_HEADER_ADDR ((uint32_t)&app_image_header)
|
|
92
|
+#define IMAGE_HEADER_OFFSET (IMAGE_HEADER_ADDR - XIP_BASE)
|
92
|
93
|
|
93
|
|
-#define WRITE_ADDR_MIN (XIP_BASE + IMAGE_HEADER_OFFSET + FLASH_SECTOR_SIZE)
|
94
|
|
-#define ERASE_ADDR_MIN (XIP_BASE + IMAGE_HEADER_OFFSET)
|
|
94
|
+#define WRITE_ADDR_MIN (IMAGE_HEADER_ADDR + FLASH_SECTOR_SIZE)
|
|
95
|
+#define ERASE_ADDR_MIN (IMAGE_HEADER_ADDR)
|
95
|
96
|
#define FLASH_ADDR_MAX (XIP_BASE + PICO_FLASH_SIZE_BYTES)
|
96
|
97
|
|
97
|
98
|
#define CMD_SYNC (('S' << 0) | ('Y' << 8) | ('N' << 16) | ('C' << 24))
|
|
@@ -581,10 +582,8 @@ int main()
|
581
|
582
|
|
582
|
583
|
sleep_ms(10);
|
583
|
584
|
|
584
|
|
- struct image_header *hdr = (struct image_header *)(XIP_BASE + IMAGE_HEADER_OFFSET);
|
585
|
|
-
|
586
|
|
- if (!should_stay_in_bootloader() && image_header_ok(hdr)) {
|
587
|
|
- uint32_t vtor = *((uint32_t *)(XIP_BASE + IMAGE_HEADER_OFFSET));
|
|
585
|
+ if (!should_stay_in_bootloader() && image_header_ok(&app_image_header)) {
|
|
586
|
+ uint32_t vtor = *(uint32_t *)IMAGE_HEADER_ADDR;
|
588
|
587
|
disable_interrupts();
|
589
|
588
|
reset_peripherals();
|
590
|
589
|
jump_to_vtor(vtor);
|