Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,24 @@

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_RAM_BANK_SCRATCH_X_START, LENGTH = MBED_RAM_BANK_SCRATCH_X_SIZE
SCRATCH_Y(rwx) : ORIGIN = MBED_RAM_BANK_SCRATCH_Y_START, LENGTH = MBED_RAM_BANK_SCRATCH_Y_SIZE

/* If we are at the start of RAM, we are core 0. Otherwise we are core 1. */
#if MBED_CONFIGURED_RAM_BANK_IRAM1_START == MBED_RAM_BANK_IRAM1_START
#define STACK_SCRATCH SCRATCH_X
#define STACK_SCRATCH_STATIC_END_SYMBOL __scratch_x_end__
#else
#define STACK_SCRATCH SCRATCH_Y
#define STACK_SCRATCH_STATIC_END_SYMBOL __scratch_y_end__
#endif
}

ENTRY(_entry_point)
Expand Down Expand Up @@ -218,23 +225,23 @@ 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(__end__ < 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(STACK_SCRATCH) + LENGTH(STACK_SCRATCH);
__StackLimit = __StackTop - MBED_CONF_TARGET_BOOT_STACK_SIZE;
__StackBottom = __StackLimit;
ASSERT(__StackLimit >= STACK_SCRATCH_STATIC_END_SYMBOL, "stack scratch region overflowed")
PROVIDE(__stack = __StackTop);

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

ASSERT( __binary_info_header_end - __logical_binary_start <= 256, "Binary info must be in first 256 bytes of the binary")
/* todo assert on extra code */
}
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
2 changes: 1 addition & 1 deletion targets/TARGET_RASPBERRYPI/TARGET_RP2040/flash_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ uint32_t flash_get_size(const flash_t *obj)
{
(void)(obj);

return PICO_FLASH_SIZE_BYTES;
return MBED_ROM_BANK_QSPI_FLASH_SIZE;
}

uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
Expand Down
15 changes: 15 additions & 0 deletions targets/targets.json5
Original file line number Diff line number Diff line change
Expand Up @@ -9792,6 +9792,21 @@
// (so the ADC can never read 100%).
"default-adc-vref": 3.3
},
"memory_banks": {
"QSPI_FLASH": {
"access": {
"execute": true,
"peripheral": false,
"read": true,
"secure": false,
"write": false
},
"default": true,
"startup": true,
"size": 0x200000, // 2MiB
"start": 0x10000000
}
},
"image_url": "https://cdn11.bigcommerce.com/s-2fbyfnm8ev/images/stencil/1280x1280/products/1212/4275/Pico3__75642.1611086462.jpg?c=2"
},
"RASPBERRY_PI_PICO_SWD": {
Expand Down
Loading