| /* |
| * Copyright (c) 2019, The OpenThread Authors. |
| * All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions are met: |
| * 1. Redistributions of source code must retain the above copyright |
| * notice, this list of conditions and the following disclaimer. |
| * 2. Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in the |
| * documentation and/or other materials provided with the distribution. |
| * 3. Neither the name of the copyright holder nor the |
| * names of its contributors may be used to endorse or promote products |
| * derived from this software without specific prior written permission. |
| * |
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| * POSSIBILITY OF SUCH DAMAGE. |
| */ |
| |
| /** |
| * @file |
| * GCC linker script for JN5189. |
| */ |
| |
| /* |
| * stack size for the boot rom during warm boot and application |
| * 256 is sufficient (pwrm_test) but keep it large to 1024 |
| */ |
| BOOT_RESUME_STACK_SIZE = 1024; |
| |
| /* Set Stack size to 4K minus 32Bytes reserved for ROM code at end of BANK7 so |
| the stack fits in BANK7. In practice the active stack size at the time of |
| going to sleep is more important than the total available stack size */ |
| STACK_SIZE = (4096 - 32); |
| |
| MEM_RAM0_BASE = 0x4000400; |
| MEM_RAM0_SIZE = 0x0015c00; |
| |
| MEMORY |
| { |
| /* Define each memory region. RAM0 definition leaves the first 1kB for the |
| boot code */ |
| Flash640 (rx) : ORIGIN = 0, LENGTH = 0x00a0000 /* 640K bytes (alias Flash) */ |
| RAM0 (rwx) : ORIGIN = 0x4000400, LENGTH = 0x0015c00 /* 87K bytes (alias RAM) */ |
| RAM1 (rwx) : ORIGIN = 0x4020000, LENGTH = 0x10000 /* 64K bytes (alias RAM2) */ |
| } |
| |
| /* Define a symbol for the top of each memory region */ |
| __top_RAM0 = MEM_RAM0_BASE + MEM_RAM0_SIZE; /* 87K bytes */ |
| |
| HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x2F4; |
| |
| /*** flash memory characteristics definitions required for OTA ***/ |
| m_flash_start = 0x00000000; |
| m_flash_end = 0x0009FFFF; |
| m_flash_size = 0x000A0000; |
| m_sector_size = 512; |
| m_fsl_prodInfo_size = m_sector_size; |
| |
| m_fsl_prodInfo_end = m_flash_size - 17 * m_sector_size - 1; |
| m_fsl_prodInfo_start = m_fsl_prodInfo_end - m_fsl_prodInfo_size + 1; |
| |
| NV_STORAGE_MAX_SECTORS = 63; |
| NV_STORAGE_SIZE = NV_STORAGE_MAX_SECTORS * m_sector_size; |
| NV_STORAGE_START_ADDRESS = m_flash_size - 17 * m_sector_size - 1; |
| NV_STORAGE_END_ADDRESS = NV_STORAGE_START_ADDRESS - NV_STORAGE_SIZE + 1; |
| |
| INT_STORAGE_END = NV_STORAGE_START_ADDRESS - 1; |
| INT_STORAGE_START = 0x48000; |
| INT_STORAGE_SIZE = INT_STORAGE_END - INT_STORAGE_START; |
| |
| FREESCALE_PROD_DATA_BASE_ADDR = m_fsl_prodInfo_start; |
| INT_STORAGE_SECTOR_SIZE = m_sector_size; |
| m_app_size = 0x48000; |
| |
| ENTRY(ResetISR) |
| |
| SECTIONS |
| { |
| /* MAIN TEXT SECTION */ |
| .header : ALIGN(4) |
| { |
| _flash_start = ABSOLUTE(.); |
| _flash_beg = ABSOLUTE(.); |
| |
| FILL(0xff) |
| __vectors_start__ = ABSOLUTE(.) ; |
| KEEP(*(.isr_vector)) |
| /* Global Section Table */ |
| . = ALIGN(4) ; |
| __section_table_start = .; |
| __data_section_table = .; |
| LONG(LOADADDR(.data)); |
| LONG( ADDR(.data)); |
| LONG( SIZEOF(.data)); |
| LONG(LOADADDR(.data_RAM2)); |
| LONG( ADDR(.data_RAM2)); |
| LONG( SIZEOF(.data_RAM2)); |
| __data_section_table_end = .; |
| __bss_section_table = .; |
| LONG( ADDR(.bss)); |
| LONG( SIZEOF(.bss)); |
| LONG( ADDR(.bss_RAM2)); |
| LONG( SIZEOF(.bss_RAM2)); |
| __bss_section_table_end = .; |
| __section_table_end = . ; |
| /* End of Global Section Table */ |
| |
| FILL(0xff) |
| . = ALIGN (0x10); |
| } >Flash640 |
| |
| .ro_nonce : ALIGN(0x10) |
| { |
| _FlsNonceStart = ABSOLUTE(.); |
| *(.ro_nonce) /* nonce value is 16 bytes.*/ |
| FILL(0xff) |
| . = ALIGN (0x10); |
| } > Flash640 |
| |
| .ro_ota_header : ALIGN(0x10) |
| { |
| _enc_start = ABSOLUTE(.); |
| _enc_offset = (_enc_start & 0x0000000F); |
| _FlsOtaHeader = ABSOLUTE(.); |
| *(.ro_ota_header) /* Ota Header 69 bytes*/ |
| FILL(0xff) |
| . = ALIGN (0x10); |
| } > Flash640 |
| |
| .ro_se_lnkKey (ALIGN((. - _enc_offset), 16) + _enc_offset): |
| { |
| _FlsLinkKey = ABSOLUTE(.); |
| *(.ro_se_lnkKey) /* Link Key 16 bytes*/ |
| FILL(0xff) |
| . = ALIGN (0x10); |
| } > Flash640 |
| |
| .filler : |
| { |
| BYTE(0xff) |
| FILL(0xff); |
| . = ALIGN(0x40); |
| } > Flash640 |
| |
| .text : ALIGN(0x40) |
| { |
| FILL(0xff) |
| |
| *(.after_vectors*) |
| *(.text*) |
| *(.rodata .rodata.* .constdata .constdata.*) |
| . = ALIGN(4); |
| } > Flash640 |
| /* |
| * for exception handling/unwind - some Newlib functions (in common |
| * with C++ and STDC++) use this. |
| */ |
| .ARM.extab : ALIGN(4) |
| { |
| FILL(0xff) |
| *(.ARM.extab* .gnu.linkonce.armextab.*) |
| } > Flash640 |
| __exidx_start = .; |
| |
| .ARM.exidx : ALIGN(4) |
| { |
| FILL(0xff) |
| *(.ARM.exidx* .gnu.linkonce.armexidx.*) |
| } > Flash640 |
| __exidx_end = .; |
| |
| _etext = .; |
| |
| /* RAM1/RAM2 (different names for same thing) SECTION */ |
| /* RAM1 contents are specified before RAM0 as they have specific input |
| sections and we do not want the RAM0 wildcards to catch them */ |
| /* DATA section for RAM1 */ |
| .data_RAM2 : ALIGN(4) |
| { |
| FILL(0xff) |
| PROVIDE(__start_data_RAM2 = .) ; |
| *(.ramfunc.$RAM2) |
| *(.ramfunc.$RAM1) |
| *(.data.$RAM2*) |
| *(.data.$RAM1*) |
| . = ALIGN(4) ; |
| PROVIDE(__end_data_RAM2 = .) ; |
| } > RAM1 AT>Flash640 |
| |
| /* MAIN DATA SECTION */ |
| .uninit_RESERVED : ALIGN(4) |
| { |
| KEEP(*(.bss.$RESERVED*)) |
| . = ALIGN(4) ; |
| _end_uninit_RESERVED = .; |
| } > RAM0 |
| |
| /* Main DATA section (RAM0) */ |
| .data : ALIGN(4) |
| { |
| FILL(0xff) |
| _data = . ; |
| *(vtable) |
| *(.ramfunc*) |
| *(.data*) |
| . = ALIGN(4) ; |
| _edata = . ; |
| } > RAM0 AT>Flash640 |
| |
| |
| /* BSS section for RAM1 */ |
| .bss_RAM2 (NOLOAD) : ALIGN(4) |
| { |
| PROVIDE(__start_bss_RAM2 = .) ; |
| *(.bss.$RAM2*) |
| *(.bss.$RAM1*) |
| . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */ |
| PROVIDE(__end_bss_RAM2 = .) ; |
| } > RAM1 |
| |
| /* MAIN BSS SECTION */ |
| .bss (NOLOAD) : ALIGN(4) |
| { |
| _bss = .; |
| *(.bss*) |
| *(COMMON) |
| *(g_u32NwkFrameCounter) |
| . = ALIGN(4) ; |
| _ebss = .; |
| |
| PROVIDE(end = .); |
| } > RAM0 |
| |
| /* BSS section for MAC buffers */ |
| .bss_MAC (NOLOAD) : ALIGN(4) |
| { |
| /* MAC buffer section: must be within 128kB block. __mac_buffer_base is |
| defined further down to be on 128kB alignment */ |
| __mac_buffer_start = .; |
| *(.mac_buffer) |
| |
| . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */ |
| } > RAM0 |
| |
| /* HEAP */ |
| .heap (NOLOAD): ALIGN(4) |
| { |
| _heap = .; |
| . += HEAP_SIZE; |
| . = ALIGN(4) ; |
| _end_heap = .; |
| } > RAM0 |
| |
| /* NOINIT section for RAM1 */ |
| .noinit_RAM2 (NOLOAD) : ALIGN(4) |
| { |
| *(.noinit.$RAM2*) |
| *(.noinit.$RAM1*) |
| . = ALIGN(4) ; |
| } > RAM1 |
| |
| /* DEFAULT NOINIT SECTION */ |
| .noinit (NOLOAD): ALIGN(4) |
| { |
| _noinit = .; |
| *(.noinit*) |
| . = ALIGN(4) ; |
| _end_noinit = .; |
| } > RAM0 |
| |
| /* stack for rom boot during warm resume */ |
| .boot_resume_stack (NOLOAD): ALIGN(4) |
| { |
| _boot_resume_stack = .; |
| *(.boot_resume_stack*) |
| . += BOOT_RESUME_STACK_SIZE; |
| . = ALIGN(4) ; |
| _end_boot_resume_stack = .; |
| } > RAM0 |
| |
| __nv_storage_end_address = NV_STORAGE_START_ADDRESS; |
| __nv_storage_start_address = NV_STORAGE_END_ADDRESS; |
| |
| PROVIDE(_vStackTop = __top_RAM0 - 32); |
| PROVIDE(__mac_buffer_base = (__mac_buffer_start & 0xfffe0000)); |
| PROVIDE(BOOT_GetStartPowerMode = 0x03000e9d); |
| PROVIDE(ROM_GetFlash = 0x03000e0d); |
| PROVIDE(pmc_reset_get_cause = 0x030046e9); |
| PROVIDE(psector_ReadIeee802_15_4_MacId1 = 0x030053b1); |
| PROVIDE(Chip_LOWPOWER_ChipSoftwareReset = 0x03003fa1); |
| |
| __StackLimit = _vStackTop - STACK_SIZE; |
| ASSERT(__StackLimit >= _end_boot_resume_stack, "Possible stack corruption with data/bss/boot_stack") |
| } |