|
4 | 4 | MEMORY |
5 | 5 | { |
6 | 6 | /* The boot ROM loads this image here and enters it at EL3. LENGTH is the |
7 | | - * same 192 KiB budget U-Boot gives SPL, so growth is a link error rather |
8 | | - * than a silent overrun into the stack below. Both come from |
9 | | - * WOLFBOOT_STAGE1_BASE_ADDR / WOLFBOOT_STAGE1_SIZE, so the same sources |
10 | | - * can also be linked somewhere else for bring-up. */ |
| 7 | + * same 192 KiB budget U-Boot gives SPL, so growth past it is a link error |
| 8 | + * rather than a silent overrun. Both come from WOLFBOOT_STAGE1_BASE_ADDR / |
| 9 | + * WOLFBOOT_STAGE1_SIZE, so the same sources can also be linked somewhere |
| 10 | + * else for bring-up. The stack is NOT inside this region; see END_STACK. */ |
11 | 11 | OCRAM(rwx): ORIGIN = @WOLFBOOT_STAGE1_BASE_ADDR@, LENGTH = @WOLFBOOT_STAGE1_SIZE@ |
12 | 12 | } |
13 | 13 | ENTRY(_boot); |
@@ -45,7 +45,13 @@ SECTIONS |
45 | 45 | } > OCRAM |
46 | 46 | } |
47 | 47 |
|
48 | | -/* Stack top, above the loaded image and below the end of the region. At the |
49 | | - * OCRAM base this is 0x204D6000, the same address U-Boot SPL uses, so it is |
50 | | - * known to be clear of anything the ROM or the OEI left behind. */ |
| 48 | +/* Stack top. This deliberately sits ABOVE the region declared in MEMORY, in the |
| 49 | + * part of OCRAM that extends past this image's budget: at the OCRAM base it is |
| 50 | + * 0x204D6000, the same address U-Boot SPL uses, so it is known both to exist and |
| 51 | + * to be clear of anything the ROM or the OEI left behind. Being a bare symbol |
| 52 | + * assignment it is not placed in OCRAM and gets no bounds check, so the assert |
| 53 | + * below stands in for one - the stack grows down towards the image, and the gap |
| 54 | + * between the end of the region and this address is all the headroom there is. */ |
51 | 55 | END_STACK = @WOLFBOOT_STAGE1_BASE_ADDR@ + 0x56000; |
| 56 | +ASSERT(END_STACK > @WOLFBOOT_STAGE1_BASE_ADDR@ + @WOLFBOOT_STAGE1_SIZE@, |
| 57 | + "stage 1 stack top must stay above the OCRAM image region") |
0 commit comments