63 lines
2.2 KiB
Text
63 lines
2.2 KiB
Text
/*
|
|
* Minimal version of:
|
|
* - https://github.com/raspberrypi/pico-sdk/blob/ee68c78d0afae2b69c03ae1a72bf5cc267a2d94c/src/rp2_common/pico_crt0/rp2350/memmap_default.ld
|
|
* - https://github.com/raspberrypi/pico-sdk/blob/ee68c78d0afae2b69c03ae1a72bf5cc267a2d94c/src/rp2_common/pico_standard_link/pico_flash_region.template.ld
|
|
* - https://github.com/raspberrypi/pico-sdk/blob/ee68c78d0afae2b69c03ae1a72bf5cc267a2d94c/src/boards/include/boards/pimoroni_pico_plus2_rp2350.h#L88C1-L88C49
|
|
*
|
|
* Provides the following symbols to be used in assembly:
|
|
* - __StackTop
|
|
*/
|
|
__XIP_BASE = 0x10000000;
|
|
__XIP_SIZE = 16M; /* 16M is allocated to QSPI flash for the pico 2 plus */
|
|
|
|
__SRAM_BASE = 0x20000000;
|
|
__SRAM_SIZE = 512K;
|
|
|
|
__SCRATCH_X_BASE = 0x20080000;
|
|
__SCRATCH_Y_BASE = 0x20081000;
|
|
__SCRATCH_SIZE = 4K; /* Both scratch regions have the same size */
|
|
|
|
/* Memories */
|
|
MEMORY
|
|
{
|
|
FLASH (rx) : ORIGIN = __XIP_BASE, LENGTH = __XIP_SIZE
|
|
RAM (rwx) : ORIGIN = __SRAM_BASE, LENGTH = __SRAM_SIZE
|
|
SCRATCH_X(rwx) : ORIGIN = __SCRATCH_X_BASE, LENGTH = __SCRATCH_SIZE
|
|
SCRATCH_Y(rwx) : ORIGIN = __SCRATCH_Y_BASE, LENGTH = __SCRATCH_SIZE
|
|
}
|
|
|
|
/* this is to eliminate RWX permission error for text segment */
|
|
/* I don't think it's necessary */
|
|
/* PHDRS
|
|
{
|
|
text PT_LOAD FLAGS(5);
|
|
data PT_LOAD FLAGS(6);
|
|
bss PT_LOAD FLAGS(6);
|
|
}
|
|
*/
|
|
|
|
/* Sections */
|
|
SECTIONS
|
|
{
|
|
.text : {
|
|
KEEP(*(.vectors))
|
|
. = ALIGN(512); /* See https://forums.raspberrypi.com/viewtopic.php?t=387420 Quote: "So, in the RP2350 Cortex M33 with 16 internal exception vectors and 52 interrupts, the alignment must be 512 bytes. (16+52)x4 = 272, next power of two = 512" */
|
|
KEEP(*(.picobin_block))
|
|
*(.text)
|
|
. = ALIGN(4);
|
|
} > FLASH
|
|
|
|
.data : {
|
|
__data_start__ = .;
|
|
*(.data*)
|
|
. = ALIGN(4);
|
|
__data_end__ = .;
|
|
} > RAM /* AT > FLASH :data */ /* See: https://stackoverflow.com/questions/28809372/what-does-region1-at-region2-mean-in-an-ld-linker-script */
|
|
|
|
|
|
/* stack limit is poorly named, but historically is maximum heap ptr */
|
|
__StackLimit = ORIGIN(RAM) + LENGTH(RAM);
|
|
__StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y); /* Used for core 0 */
|
|
__StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X); /* Used for core 1 */
|
|
|
|
}
|