Skip to content

Commit

Permalink
Start on linker script changes
Browse files Browse the repository at this point in the history
  • Loading branch information
multiplemonomials committed Nov 23, 2024
1 parent f0e60e8 commit a5e3545
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
__stack (== StackTop)
*/

#include "../cmsis_nvic.h"

#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
/* This value is normally defined by the tools
to 0x1000 for bare metal and 0x400 for RTOS */
Expand All @@ -32,15 +30,15 @@

MEMORY
{
FLASH(rx) : ORIGIN = MBED_ROM_START, LENGTH = MBED_ROM_SIZE
RAM(rwx) : ORIGIN = MBED_RAM_START, LENGTH = MBED_RAM_SIZE
FLASH(rx) : ORIGIN = MBED_CONFIGURED_ROM_BANK_QSPI_FLASH_START, LENGTH = MBED_CONFIGURED_ROM_BANK_QSPI_FLASH_SIZE
RAM(rwx) : ORIGIN = MBED_CONFIGURED_RAM_BANK_IRAM1_START, LENGTH = MBED_CONFIGURED_RAM_BANK_IRAM1_SIZE

/*
* Scratch banks are commonly used for critical data and functions accessed only by one core (when only
* one core is accessing the RAM bank, there is no opportunity for stalls).
*/
SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k
SCRATCH_X(rwx) : ORIGIN = MBED_CONFIGURED_RAM_BANK_SCRATCH_X_START, LENGTH = MBED_CONFIGURED_RAM_BANK_SCRATCH_X_SIZE
SCRATCH_Y(rwx) : ORIGIN = MBED_CONFIGURED_RAM_BANK_SCRATCH_Y_START, LENGTH = MBED_CONFIGURED_RAM_BANK_SCRATCH_Y_SIZE
}

ENTRY(_entry_point)
Expand Down Expand Up @@ -218,16 +216,19 @@ SECTIONS
__end__ = .;
PROVIDE(end = .);
*(.heap*)
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_CONF_TARGET_BOOT_STACK_SIZE;
. = ORIGIN(RAM) + LENGTH(RAM);
__HeapLimit = .;
} > RAM

/* Check if data + heap exceeds RAM limit */
ASSERT(__HeapLimit >= ORIGIN(RAM) + LENGTH(RAM), "region RAM overflowed")

.flash_end : {
PROVIDE(__flash_binary_end = .);
} > FLASH

/* stack limit is poorly named, but historically is maximum heap ptr */
__StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y);
__StackTop = ORIGIN(SCRATCH) + LENGTH(SCRATCH_Y);
__StackLimit = __StackTop - MBED_CONF_TARGET_BOOT_STACK_SIZE;
__StackBottom = __StackLimit;
PROVIDE(__stack = __StackTop);
Expand Down
19 changes: 0 additions & 19 deletions targets/TARGET_RASPBERRYPI/TARGET_RP2040/cmsis_nvic.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,5 @@
#ifndef MBED_CMSIS_NVIC_H
#define MBED_CMSIS_NVIC_H

#if !defined(MBED_ROM_START)
#define MBED_ROM_START 0x10000000
#endif

#if !defined(MBED_ROM_SIZE)
#if defined(PICO_FLASH_SIZE_BYTES)
#define MBED_ROM_SIZE PICO_FLASH_SIZE_BYTES
#else
#define MBED_ROM_SIZE (2048*1024)
#endif
#endif

#if !defined(MBED_RAM_START)
#define MBED_RAM_START 0x20000000
#endif

#if !defined(MBED_RAM_SIZE)
#define MBED_RAM_SIZE (256*1024)
#endif

#endif

0 comments on commit a5e3545

Please sign in to comment.