|
18 | 18 |
|
19 | 19 | /* Tools provide -DMBED_ROM_START=xxx -DMBED_ROM_SIZE=xxx -DMBED_RAM_START=xxx -DMBED_RAM_SIZE=xxx */
|
20 | 20 |
|
21 |
| -if (!isdefinedsymbol(MBED_APP_START)) { define symbol MBED_APP_START = MBED_ROM_START; } |
22 |
| -if (!isdefinedsymbol(MBED_APP_SIZE)) { define symbol MBED_APP_SIZE = MBED_ROM_SIZE; } |
23 |
| - |
24 |
| -/* [ROM = 512kb = 0x80000] */ |
25 |
| -define symbol __intvec_start__ = MBED_APP_START; |
26 |
| -define symbol __region_ROM_start__ = MBED_APP_START; |
27 |
| -define symbol __region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1; |
28 |
| - |
29 |
| -/* [RAM = 128kb = 0x20000] Vector table dynamic copy: 102 vectors = 408 bytes (0x198) to be reserved in RAM */ |
30 |
| -define symbol __NVIC_start__ = 0x20000000; |
31 |
| -define symbol __NVIC_end__ = 0x20000197; /* Aligned on 8 bytes */ |
32 |
| -define symbol __region_CRASH_DATA_RAM_start__ = 0x20000198; |
33 |
| -define symbol __region_CRASH_DATA_RAM_end__ = 0x20000297; |
34 |
| -define symbol __region_RAM_start__ = 0x20000298; |
35 |
| -define symbol __region_RAM_end__ = 0x2001FFFF; |
36 |
| - |
37 |
| -/* Memory regions */ |
38 |
| -define memory mem with size = 4G; |
39 |
| -define region ROM_region = mem:[from __region_ROM_start__ to __region_ROM_end__]; |
40 |
| -define region CRASH_DATA_RAM_region = mem:[from __region_CRASH_DATA_RAM_start__ to __region_CRASH_DATA_RAM_end__]; |
41 |
| -define region RAM_region = mem:[from __region_RAM_start__ to __region_RAM_end__]; |
| 21 | +define symbol VECTORS = 102; /* This value must match NVIC_NUM_VECTORS in cmsis_nvic.h */ |
| 22 | +define symbol HEAP_SIZE = 0xa000; |
| 23 | + |
| 24 | +/* Common - Do not change */ |
| 25 | + |
| 26 | +if (!isdefinedsymbol(MBED_APP_START)) { |
| 27 | + define symbol MBED_APP_START = MBED_ROM_START; |
| 28 | +} |
42 | 29 |
|
43 |
| -/* Define Crash Data Symbols */ |
44 |
| -define exported symbol __CRASH_DATA_RAM_START__ = __region_CRASH_DATA_RAM_start__; |
45 |
| -define exported symbol __CRASH_DATA_RAM_END__ = __region_CRASH_DATA_RAM_end__; |
| 30 | +if (!isdefinedsymbol(MBED_APP_SIZE)) { |
| 31 | + define symbol MBED_APP_SIZE = MBED_ROM_SIZE; |
| 32 | +} |
46 | 33 |
|
47 |
| -/* Stack and Heap */ |
48 | 34 | if (!isdefinedsymbol(MBED_CONF_TARGET_BOOT_STACK_SIZE)) {
|
| 35 | + /* This value is normally defined by the tools |
| 36 | + to 0x1000 for bare metal and 0x400 for RTOS */ |
49 | 37 | define symbol MBED_CONF_TARGET_BOOT_STACK_SIZE = 0x400;
|
50 | 38 | }
|
51 |
| -define symbol __size_cstack__ = MBED_CONF_TARGET_BOOT_STACK_SIZE; |
52 |
| -define symbol __size_heap__ = 0x15000; |
53 |
| -define block CSTACK with alignment = 8, size = __size_cstack__ { }; |
54 |
| -define block HEAP with alignment = 8, size = __size_heap__ { }; |
55 |
| -define block STACKHEAP with fixed order { block HEAP, block CSTACK }; |
56 | 39 |
|
57 |
| -initialize by copy with packing = zeros { readwrite }; |
| 40 | +/* Round up VECTORS_SIZE to 8 bytes */ |
| 41 | +define symbol VECTORS_SIZE = ((VECTORS * 4) + 7) & ~7; |
| 42 | + |
| 43 | +define symbol CRASH_DATA_START = MBED_RAM_START + VECTORS_SIZE; |
| 44 | +define symbol CRASH_DATA_SIZE = 0x100; |
| 45 | +define exported symbol __CRASH_DATA_RAM_START__ = CRASH_DATA_START; |
| 46 | + |
| 47 | +define symbol RAM_REGION_START = CRASH_DATA_START + CRASH_DATA_SIZE; |
| 48 | +define symbol RAM_REGION_SIZE = MBED_RAM_SIZE - VECTORS_SIZE - CRASH_DATA_SIZE; |
| 49 | + |
| 50 | +define memory mem with size = 4G; |
| 51 | +define region ROM_region = mem:[from MBED_APP_START size MBED_APP_SIZE]; |
| 52 | +define region RAM_region = mem:[from RAM_REGION_START size RAM_REGION_SIZE]; |
| 53 | + |
| 54 | +define block CSTACK with alignment = 8, size = MBED_CONF_TARGET_BOOT_STACK_SIZE { }; |
| 55 | +define block HEAP with alignment = 8, size = HEAP_SIZE { }; |
| 56 | + |
| 57 | +initialize by copy { readwrite }; |
58 | 58 | do not initialize { section .noinit };
|
59 | 59 |
|
60 |
| -place at address mem:__intvec_start__ { readonly section .intvec }; |
| 60 | +place at address mem: MBED_APP_START { readonly section .intvec }; |
61 | 61 |
|
62 | 62 | place in ROM_region { readonly };
|
63 |
| -place in RAM_region { readwrite, block STACKHEAP }; |
| 63 | +place in RAM_region { readwrite, |
| 64 | + block CSTACK, block HEAP }; |
0 commit comments