Skip to content

Commit f1e1675

Browse files
de-nordicrlubos
authored andcommitted
[nrf noup] Revert of zephyr: arm: Update reading the flash image reset vector
This is revert of upstream commit 453096b which was supposed to allow picking interrupt vector table from flash area but the whole modification unfortunately misunderstood difference between flash device ID and flash area ID. The commit is not important for sdk-nrf and requires re-design and fixing upstream. Signed-off-by: Dominik Ermel <[email protected]>
1 parent 3be724f commit f1e1675

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

boot/zephyr/flash_map_extended.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,8 @@ int flash_area_sector_from_off(off_t off, struct flash_sector *sector)
141141

142142
uint8_t flash_area_get_device_id(const struct flash_area *fa)
143143
{
144-
#if defined(CONFIG_ARM)
145-
return fa->fa_id;
146-
#else
147-
(void)fa;
148-
return FLASH_DEVICE_ID;
149-
#endif
144+
(void)fa;
145+
return FLASH_DEVICE_ID;
150146
}
151147

152148
#define ERASED_VAL 0xff

boot/zephyr/main.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -174,26 +174,16 @@ static void do_boot(struct boot_rsp *rsp)
174174
/* Get ram address for image */
175175
vt = (struct arm_vector_table *)(rsp->br_hdr->ih_load_addr + rsp->br_hdr->ih_hdr_size);
176176
#else
177+
uintptr_t flash_base;
177178
int rc;
178-
const struct flash_area *fap;
179-
static uint32_t dst[2];
180179

181180
/* Jump to flash image */
182-
rc = flash_area_open(rsp->br_flash_dev_id, &fap);
183-
assert(rc == 0);
184-
185-
rc = flash_area_read(fap, rsp->br_hdr->ih_hdr_size, dst, sizeof(dst));
181+
rc = flash_device_base(rsp->br_flash_dev_id, &flash_base);
186182
assert(rc == 0);
187-
#ifndef CONFIG_ASSERT
188-
/* Enter a lock up as asserts are disabled */
189-
if (rc != 0) {
190-
while (1);
191-
}
192-
#endif
193-
194-
flash_area_close(fap);
195183

196-
vt = (struct arm_vector_table *)dst;
184+
vt = (struct arm_vector_table *)(flash_base +
185+
rsp->br_image_off +
186+
rsp->br_hdr->ih_hdr_size);
197187
#endif
198188

199189
if (IS_ENABLED(CONFIG_SYSTEM_TIMER_HAS_DISABLE_SUPPORT)) {

0 commit comments

Comments
 (0)