|
| 1 | +/* |
| 2 | + * Copyright (c) 2019 ARM Limited. All rights reserved. |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + * |
| 6 | + * Licensed under the Apache License, Version 2.0 (the License) you may |
| 7 | + * not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| 14 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + */ |
| 18 | + |
| 19 | +define symbol NS_CODE_START = 0x000a0400; |
| 20 | +define symbol NS_CODE_SIZE = 0x0005f800; |
| 21 | +define symbol NS_DATA_START = 0x20011000; |
| 22 | +define symbol NS_DATA_SIZE = 0x0000f000; |
| 23 | + |
| 24 | +define symbol __ram_vector_table__ = 1; |
| 25 | + |
| 26 | +if (!isdefinedsymbol(MBED_ROM_START)) { |
| 27 | + define symbol MBED_ROM_START = NS_CODE_START; |
| 28 | +} |
| 29 | + |
| 30 | +if (!isdefinedsymbol(MBED_APP_START)) { |
| 31 | + define symbol MBED_APP_START = MBED_ROM_START; |
| 32 | +} |
| 33 | + |
| 34 | +if (!isdefinedsymbol(MBED_ROM_SIZE)) { |
| 35 | + define symbol MBED_ROM_SIZE = NS_CODE_SIZE; |
| 36 | +} |
| 37 | + |
| 38 | +if (!isdefinedsymbol(MBED_APP_SIZE)) { |
| 39 | + define symbol MBED_APP_SIZE = MBED_ROM_SIZE; |
| 40 | +} |
| 41 | + |
| 42 | +if (!isdefinedsymbol(MBED_RAM_START)) { |
| 43 | + define symbol MBED_RAM_START = NS_DATA_START; |
| 44 | +} |
| 45 | + |
| 46 | +if (!isdefinedsymbol(MBED_RAM_SIZE)) { |
| 47 | + define symbol MBED_RAM_SIZE = NS_DATA_SIZE; |
| 48 | +} |
| 49 | + |
| 50 | +if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) { |
| 51 | + define symbol MBED_BOOT_STACK_SIZE = 0x400; |
| 52 | +} |
| 53 | + |
| 54 | +define symbol __stack_size__ = MBED_BOOT_STACK_SIZE; |
| 55 | +define symbol __heap_size__ = 0x4000; |
| 56 | + |
| 57 | +define symbol __ram_vector_table_size__ = isdefinedsymbol(__ram_vector_table__) ? 0x00000200 : 0; |
| 58 | +define symbol __ram_vector_table_offset__ = isdefinedsymbol(__ram_vector_table__) ? 0x000001FF : 0; |
| 59 | + |
| 60 | +/* Stack and Heap Sizes */ |
| 61 | +if (isdefinedsymbol(__stack_size__)) { |
| 62 | + define symbol __size_cstack__ = __stack_size__; |
| 63 | +} else { |
| 64 | + define symbol __size_cstack__ = 0x0400; |
| 65 | +} |
| 66 | + |
| 67 | +if (isdefinedsymbol(__heap_size__)) { |
| 68 | + define symbol __size_heap__ = __heap_size__; |
| 69 | +} else { |
| 70 | + define symbol __size_heap__ = 0x0400; |
| 71 | +} |
| 72 | + |
| 73 | +define symbol m_interrupts_start = MBED_APP_START; |
| 74 | +define symbol m_interrupts_end = (MBED_APP_START + 0x16F); |
| 75 | + |
| 76 | +define symbol m_text_start = (MBED_APP_START + 0x170); |
| 77 | +define symbol m_text_end = (MBED_APP_START + MBED_APP_SIZE - 1); |
| 78 | + |
| 79 | +define symbol m_interrupts_ram_start = MBED_RAM_START; |
| 80 | +define symbol m_interrupts_ram_end = (MBED_RAM_START + __ram_vector_table_size__ - 1); |
| 81 | + |
| 82 | +define symbol m_data_start = (m_interrupts_ram_start + __ram_vector_table_size__); |
| 83 | +define symbol m_data_end = (MBED_RAM_START + MBED_RAM_SIZE - 1); |
| 84 | + |
| 85 | +define exported symbol __VECTOR_TABLE = m_interrupts_start; |
| 86 | +define exported symbol __VECTOR_RAM = isdefinedsymbol(__ram_vector_table__) ? m_interrupts_ram_start : m_interrupts_start; |
| 87 | +define exported symbol __RAM_VECTOR_TABLE_SIZE = __ram_vector_table_size__; |
| 88 | + |
| 89 | +define memory mem with size = 4G; |
| 90 | + |
| 91 | +define region TEXT_region = mem:[from m_interrupts_start to m_interrupts_end] |
| 92 | + | mem:[from m_text_start to m_text_end]; |
| 93 | +define region DATA_region = mem:[from m_data_start to m_data_end-__size_cstack__]; |
| 94 | +define region CSTACK_region = mem:[from m_data_end-__size_cstack__+1 to m_data_end]; |
| 95 | + |
| 96 | +define region m_interrupts_ram_region = mem:[from m_interrupts_ram_start to m_interrupts_ram_end]; |
| 97 | + |
| 98 | +define block CSTACK with alignment = 8, size = __size_cstack__ { }; |
| 99 | +define block HEAP with alignment = 8, size = __size_heap__ { }; |
| 100 | +define block RW { readwrite }; |
| 101 | +define block ZI { zi }; |
| 102 | + |
| 103 | +initialize by copy { readwrite, section .textrw }; |
| 104 | +do not initialize { section .noinit }; |
| 105 | + |
| 106 | +place at address mem: m_interrupts_start { readonly section .intvec }; |
| 107 | +place in TEXT_region { readonly }; |
| 108 | +place in DATA_region { block RW }; |
| 109 | +place in DATA_region { block ZI }; |
| 110 | +place in DATA_region { last block HEAP }; |
| 111 | +place in CSTACK_region { block CSTACK }; |
| 112 | +place in m_interrupts_ram_region { section m_interrupts_ram }; |
0 commit comments