Skip to content

Commit e457444

Browse files
danieldegrassed3zd3z
authored andcommitted
boot: zephyr: enable ram load for ARM
Enable ram loading for ARM, with correct handling of vector table when code has moved to RAM. Signed-off-by: Daniel DeGrasse <[email protected]>
1 parent 9324d2b commit e457444

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

boot/zephyr/main.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,20 +168,27 @@ struct arm_vector_table {
168168
static void do_boot(struct boot_rsp *rsp)
169169
{
170170
struct arm_vector_table *vt;
171-
uintptr_t flash_base;
172-
int rc;
173171

174172
/* The beginning of the image is the ARM vector table, containing
175173
* the initial stack pointer address and the reset vector
176174
* consecutively. Manually set the stack pointer and jump into the
177175
* reset vector
178176
*/
177+
#ifdef CONFIG_BOOT_RAM_LOAD
178+
/* Get ram address for image */
179+
vt = (struct arm_vector_table *)(rsp->br_hdr->ih_load_addr + rsp->br_hdr->ih_hdr_size);
180+
#else
181+
uintptr_t flash_base;
182+
int rc;
183+
184+
/* Jump to flash image */
179185
rc = flash_device_base(rsp->br_flash_dev_id, &flash_base);
180186
assert(rc == 0);
181187

182188
vt = (struct arm_vector_table *)(flash_base +
183189
rsp->br_image_off +
184190
rsp->br_hdr->ih_hdr_size);
191+
#endif
185192

186193
sys_clock_disable();
187194

0 commit comments

Comments
 (0)