mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-08-09 12:26:11 +02:00
107 lines
2.4 KiB
Plaintext
Vendored
107 lines
2.4 KiB
Plaintext
Vendored
/**
|
|
* @file linker.ld
|
|
* @brief Minimal linker script for bare-metal RP2350 development
|
|
* @author Kevin Thomas
|
|
* @date 2025
|
|
*
|
|
* MIT License
|
|
*
|
|
* Copyright (c) 2025 Kevin Thomas
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
* copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
*/
|
|
|
|
ENTRY(Reset_Handler)
|
|
|
|
/**
|
|
* Define memory regions.
|
|
*/
|
|
__XIP_BASE = 0x10000000;
|
|
__XIP_SIZE = 32M;
|
|
|
|
__SRAM_BASE = 0x20000000;
|
|
__SRAM_SIZE = 512K;
|
|
__STACK_SIZE = 32K;
|
|
|
|
MEMORY
|
|
{
|
|
RAM (rwx) : ORIGIN = __SRAM_BASE, LENGTH = __SRAM_SIZE
|
|
FLASH (rx) : ORIGIN = __XIP_BASE, LENGTH = __XIP_SIZE
|
|
}
|
|
|
|
/**
|
|
* Program headers.
|
|
*/
|
|
PHDRS
|
|
{
|
|
text PT_LOAD FLAGS(5);
|
|
}
|
|
|
|
/**
|
|
* Section placement.
|
|
*/
|
|
SECTIONS
|
|
{
|
|
. = ORIGIN(FLASH);
|
|
|
|
/**
|
|
* Vector table MUST be first at 0x10000000.
|
|
*/
|
|
.vectors :
|
|
{
|
|
KEEP(*(.vectors))
|
|
} > FLASH :text
|
|
|
|
ASSERT((ADDR(.vectors) == ORIGIN(FLASH)),
|
|
"Vector table must be at start of flash (0x10000000)")
|
|
|
|
/**
|
|
* Text and read-only data.
|
|
*/
|
|
.text :
|
|
{
|
|
. = ALIGN(4);
|
|
*(.text*)
|
|
*(.rodata*)
|
|
KEEP(*(.init))
|
|
KEEP(*(.fini))
|
|
KEEP(*(.ARM.attributes))
|
|
} > FLASH :text
|
|
|
|
/**
|
|
* IMAGE_DEF block at end of code.
|
|
*/
|
|
.embedded_block :
|
|
{
|
|
KEEP(*(.embedded_block))
|
|
} > FLASH :text
|
|
|
|
/**
|
|
* Non-secure stack symbols.
|
|
*/
|
|
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
|
__StackLimit = __StackTop - __STACK_SIZE;
|
|
__stack = __StackTop;
|
|
_stack_top = __StackTop;
|
|
|
|
.stack (NOLOAD) : { . = ALIGN(8); } > RAM
|
|
|
|
PROVIDE(__Vectors = ADDR(.vectors));
|
|
}
|