Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supply memory bank information from the configuration script #326

Merged
merged 12 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mbed_settings.py

# Default Build Directory
.build/
BUILD/
.mbed
venv/

Expand Down
8 changes: 4 additions & 4 deletions platform/include/platform/mbed_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ typedef struct {
uint32_t cpu_id; /**< CPUID register data (Cortex-M only supported) */
mbed_compiler_id_t compiler_id; /**< Compiler ID \ref mbed_compiler_id_t */
uint32_t compiler_version; /**< Compiler version */
uint32_t ram_start[MBED_MAX_MEM_REGIONS]; /**< Start addresses of all internal RAM memories */
uint32_t ram_size[MBED_MAX_MEM_REGIONS]; /**< Size of all internal RAM memories in target */
uint32_t rom_start[MBED_MAX_MEM_REGIONS]; /**< Start addresses of all internal ROM memories */
uint32_t rom_size[MBED_MAX_MEM_REGIONS]; /**< Size of all internal ROM memories in target */
uint32_t ram_start[MBED_MAX_MEM_REGIONS]; /**< Configured start addresses of all internal RAM memories */
uint32_t ram_size[MBED_MAX_MEM_REGIONS]; /**< Configured sizes of all internal RAM memories in target */
uint32_t rom_start[MBED_MAX_MEM_REGIONS]; /**< Configured start addresses of all internal ROM memories */
uint32_t rom_size[MBED_MAX_MEM_REGIONS]; /**< Configured sizes of all internal ROM memories in target */
} mbed_stats_sys_t;

/**
Expand Down
48 changes: 24 additions & 24 deletions platform/source/mbed_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,37 +146,37 @@ void mbed_stats_sys_get(mbed_stats_sys_t *stats)

#if defined(MBED_SYS_STATS_ENABLED)
stats->os_version = MBED_VERSION;
#if defined(MBED_RAM_START) && defined(MBED_RAM_SIZE)
stats->ram_start[0] = MBED_RAM_START;
stats->ram_size[0] = MBED_RAM_SIZE;
#if defined(MBED_CONFIGURED_RAM_START) && defined(MBED_CONFIGURED_RAM_SIZE)
stats->ram_start[0] = MBED_CONFIGURED_RAM_START;
stats->ram_size[0] = MBED_CONFIGURED_RAM_SIZE;
#endif
#if defined(MBED_ROM_START) && defined(MBED_ROM_SIZE)
stats->rom_start[0] = MBED_ROM_START;
stats->rom_size[0] = MBED_ROM_SIZE;
#if defined(MBED_CONFIGURED_ROM_START) && defined(MBED_CONFIGURED_ROM_SIZE)
stats->rom_start[0] = MBED_CONFIGURED_ROM_START;
stats->rom_size[0] = MBED_CONFIGURED_ROM_SIZE;
#endif
#if defined(MBED_RAM1_START) && defined(MBED_RAM1_SIZE)
stats->ram_start[1] = MBED_RAM1_START;
stats->ram_size[1] = MBED_RAM1_SIZE;
#if defined(MBED_CONFIGURED_RAM1_START) && defined(MBED_CONFIGURED_RAM1_SIZE)
stats->ram_start[1] = MBED_CONFIGURED_RAM1_START;
stats->ram_size[1] = MBED_CONFIGURED_RAM1_SIZE;
#endif
#if defined(MBED_RAM2_START) && defined(MBED_RAM2_SIZE)
stats->ram_start[2] = MBED_RAM2_START;
stats->ram_size[2] = MBED_RAM2_SIZE;
#if defined(MBED_CONFIGURED_RAM2_START) && defined(MBED_CONFIGURED_RAM2_SIZE)
stats->ram_start[2] = MBED_CONFIGURED_RAM2_START;
stats->ram_size[2] = MBED_CONFIGURED_RAM2_SIZE;
#endif
#if defined(MBED_RAM3_START) && defined(MBED_RAM3_SIZE)
stats->ram_start[3] = MBED_RAM3_START;
stats->ram_size[3] = MBED_RAM3_SIZE;
#if defined(MBED_CONFIGURED_RAM3_START) && defined(MBED_CONFIGURED_RAM3_SIZE)
stats->ram_start[3] = MBED_CONFIGURED_RAM3_START;
stats->ram_size[3] = MBED_CONFIGURED_RAM3_SIZE;
#endif
#if defined(MBED_ROM1_START) && defined(MBED_ROM1_SIZE)
stats->rom_start[1] = MBED_ROM1_START;
stats->rom_size[1] = MBED_ROM1_SIZE;
#if defined(MBED_CONFIGURED_ROM1_START) && defined(MBED_CONFIGURED_ROM1_SIZE)
stats->rom_start[1] = MBED_CONFIGURED_ROM1_START;
stats->rom_size[1] = MBED_CONFIGURED_ROM1_SIZE;
#endif
#if defined(MBED_ROM2_START) && defined(MBED_ROM2_SIZE)
stats->rom_start[2] = MBED_ROM2_START;
stats->rom_size[2] = MBED_ROM2_SIZE;
#if defined(MBED_CONFIGURED_ROM2_START) && defined(MBED_CONFIGURED_ROM2_SIZE)
stats->rom_start[2] = MBED_CONFIGURED_ROM2_START;
stats->rom_size[2] = MBED_CONFIGURED_ROM2_SIZE;
#endif
#if defined(MBED_ROM3_START) && defined(MBED_ROM3_SIZE)
stats->rom_start[3] = MBED_ROM3_START;
stats->rom_size[3] = MBED_ROM3_SIZE;
#if defined(MBED_CONFIGURED_ROM3_START) && defined(MBED_CONFIGURED_ROM3_SIZE)
stats->rom_start[3] = MBED_CONFIGURED_ROM3_START;
stats->rom_size[3] = MBED_CONFIGURED_ROM3_SIZE;
#endif

#if defined(__CORTEX_M)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,36 +50,14 @@ FLASH_CM0P_SIZE = 0x10000;
/* The size of the MCU boot header area at the start of FLASH */
BOOT_HEADER_SIZE = 0x400;

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

/* MBED_APP_START is being used by the bootloader build script and
* will be calculate by the system. In case if MBED_APP_START address is
* customized by the bootloader config, the application image should not
* include CM0p prebuilt image.
*/
/*
* Figure out start address and size of application, unless overridden by definitions
*/
#if !defined(MBED_APP_START)
#define MBED_APP_START (MBED_ROM_START + FLASH_CM0P_SIZE)
#endif

#if !defined(MBED_ROM_SIZE)
#define MBED_ROM_SIZE 0x000E8000
#define MBED_APP_START (MBED_CONFIGURED_ROM_BANK_IROM1_START + FLASH_CM0P_SIZE)
#endif

/* MBED_APP_SIZE is being used by the bootloader build script and
* will be calculate by the system.
*/
#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE (MBED_ROM_SIZE - FLASH_CM0P_SIZE)
#endif

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

#if !defined(MBED_RAM_SIZE)
#define MBED_RAM_SIZE 0x000DE800
#define MBED_APP_SIZE (MBED_CONFIGURED_ROM_BANK_IROM1_SIZE - FLASH_CM0P_SIZE)
#endif

#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
Expand Down Expand Up @@ -108,8 +86,8 @@ MEMORY
* Your changes must be aligned with the corresponding memory regions for CM0+ core in 'xx_cm0plus.ld',
* where 'xx' is the device group; for example, 'cyb06xxa_cm0plus.ld'.
*/
ram (rwx) : ORIGIN = MBED_RAM_START, LENGTH = MBED_RAM_SIZE
cm0p_image (rx) : ORIGIN = (MBED_ROM_START + BOOT_HEADER_SIZE), LENGTH = FLASH_CM0P_SIZE
ram (rwx) : ORIGIN = MBED_CONFIGURED_RAM_BANK_IRAM1_START, LENGTH = MBED_CONFIGURED_RAM_BANK_IRAM1_SIZE
cm0p_image (rx) : ORIGIN = MBED_ROM_BANK_IROM1_START + BOOT_HEADER_SIZE, LENGTH = FLASH_CM0P_SIZE
flash (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE

/* This is a 32K flash region used for EEPROM emulation. This region can also be used as the general purpose flash.
Expand Down Expand Up @@ -443,8 +421,8 @@ SECTIONS

/* The following symbols used by the cymcuelftool. */
/* Flash */
__cy_memory_0_start = 0x10000000;
__cy_memory_0_length = 0x001D0000;
__cy_memory_0_start = MBED_ROM_BANK_IROM1_START;
__cy_memory_0_length = MBED_ROM_BANK_IROM1_SIZE;
__cy_memory_0_row_size = 0x200;

/* Emulated EEPROM Flash area */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,36 +47,14 @@ ENTRY(Reset_Handler)
/* The size of the Cortex-M0+ application image at the start of FLASH */
FLASH_CM0P_SIZE = 0x2000;

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

/* MBED_APP_START is being used by the bootloader build script and
* will be calculate by the system. In case if MBED_APP_START address is
* customized by the bootloader config, the application image should not
* include CM0p prebuilt image.
*/
/*
* Figure out start address and size of application, unless overridden by definitions
*/
#if !defined(MBED_APP_START)
#define MBED_APP_START (MBED_ROM_START + FLASH_CM0P_SIZE)
#endif

#if !defined(MBED_ROM_SIZE)
#define MBED_ROM_SIZE 0x00200000
#define MBED_APP_START (MBED_CONFIGURED_ROM_BANK_IROM1_START + FLASH_CM0P_SIZE)
#endif

/* MBED_APP_SIZE is being used by the bootloader build script and
* will be calculate by the system.
*/
#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE (MBED_ROM_SIZE - FLASH_CM0P_SIZE)
#endif

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

#if !defined(MBED_RAM_SIZE)
#define MBED_RAM_SIZE 0x000FD800
#define MBED_APP_SIZE (MBED_CONFIGURED_ROM_BANK_IROM1_SIZE - FLASH_CM0P_SIZE)
#endif

#if !defined(MBED_BOOT_STACK_SIZE)
Expand Down Expand Up @@ -106,8 +84,8 @@ MEMORY
* Your changes must be aligned with the corresponding memory regions for CM0+ core in 'xx_cm0plus.ld',
* where 'xx' is the device group; for example, 'cy8c6xx7_cm0plus.ld'.
*/
ram (rwx) : ORIGIN = MBED_RAM_START, LENGTH = MBED_RAM_SIZE
cm0p_image (rx) : ORIGIN = MBED_ROM_START, LENGTH = FLASH_CM0P_SIZE
ram (rwx) : ORIGIN = MBED_CONFIGURED_RAM_BANK_IRAM1_START, LENGTH = MBED_CONFIGURED_RAM_BANK_IRAM1_SIZE
cm0p_image (rx) : ORIGIN = MBED_CONFIGURED_ROM_BANK_IROM1_START, LENGTH = FLASH_CM0P_SIZE
flash (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE

/* This is a 32K flash region used for EEPROM emulation. This region can also be used as the general purpose flash.
Expand Down Expand Up @@ -440,8 +418,8 @@ SECTIONS

/* The following symbols used by the cymcuelftool. */
/* Flash */
__cy_memory_0_start = 0x10000000;
__cy_memory_0_length = 0x00200000;
__cy_memory_0_start = MBED_ROM_BANK_IROM1_START;
__cy_memory_0_length = MBED_ROM_BANK_IROM1_SIZE;
__cy_memory_0_row_size = 0x200;

/* Emulated EEPROM Flash area */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,14 @@ FLASH_CM0P_SIZE = 0x2000;
#define MBED_ROM_START 0x10000000
#endif

/* MBED_APP_START is being used by the bootloader build script and
* will be calculate by the system. In case if MBED_APP_START address is
* customized by the bootloader config, the application image should not
* include CM0p prebuilt image.
*/
/*
* Figure out start address and size of application, unless overridden by definitions
*/
#if !defined(MBED_APP_START)
#define MBED_APP_START (MBED_ROM_START + FLASH_CM0P_SIZE)
#define MBED_APP_START (MBED_CONFIGURED_ROM_BANK_IROM1_START + FLASH_CM0P_SIZE)
#endif

#if !defined(MBED_ROM_SIZE)
#define MBED_ROM_SIZE 0x00100000
#endif

/* MBED_APP_SIZE is being used by the bootloader build script and
* will be calculate by the system.
*/
#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE (MBED_ROM_SIZE - FLASH_CM0P_SIZE)
#endif

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

#if !defined(MBED_RAM_SIZE)
#define MBED_RAM_SIZE 0x00045800
#define MBED_APP_SIZE (MBED_CONFIGURED_ROM_BANK_IROM1_SIZE - FLASH_CM0P_SIZE)
#endif

#if !defined(MBED_BOOT_STACK_SIZE)
Expand Down Expand Up @@ -106,8 +88,8 @@ MEMORY
* Your changes must be aligned with the corresponding memory regions for CM0+ core in 'xx_cm0plus.ld',
* where 'xx' is the device group; for example, 'cy8c6xx7_cm0plus.ld'.
*/
ram (rwx) : ORIGIN = MBED_RAM_START, LENGTH = MBED_RAM_SIZE
cm0p_image (rx) : ORIGIN = MBED_ROM_START, LENGTH = FLASH_CM0P_SIZE
ram (rwx) : ORIGIN = MBED_CONFIGURED_RAM_BANK_IRAM1_START, LENGTH = MBED_CONFIGURED_RAM_BANK_IRAM1_SIZE
cm0p_image (rx) : ORIGIN = MBED_CONFIGURED_ROM_BANK_IROM1_START, LENGTH = FLASH_CM0P_SIZE
flash (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE

/* This is a 32K flash region used for EEPROM emulation. This region can also be used as the general purpose flash.
Expand Down Expand Up @@ -440,8 +422,8 @@ SECTIONS

/* The following symbols used by the cymcuelftool. */
/* Flash */
__cy_memory_0_start = 0x10000000;
__cy_memory_0_length = 0x00100000;
__cy_memory_0_start = MBED_ROM_BANK_IROM1_START;
__cy_memory_0_length = MBED_ROM_BANK_IROM1_SIZE;
__cy_memory_0_row_size = 0x200;

/* Emulated EEPROM Flash area */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,36 +47,14 @@ ENTRY(Reset_Handler)
/* The size of the Cortex-M0+ application image at the start of FLASH */
FLASH_CM0P_SIZE = 0x2000;

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

/* MBED_APP_START is being used by the bootloader build script and
* will be calculate by the system. In case if MBED_APP_START address is
* customized by the bootloader config, the application image should not
* include CM0p prebuilt image.
*/
/*
* Figure out start address and size of application, unless overridden by definitions
*/
#if !defined(MBED_APP_START)
#define MBED_APP_START (MBED_ROM_START + FLASH_CM0P_SIZE)
#endif

#if !defined(MBED_ROM_SIZE)
#define MBED_ROM_SIZE 0x00100000
#define MBED_APP_START (MBED_CONFIGURED_ROM_BANK_IROM1_START + FLASH_CM0P_SIZE)
#endif

/* MBED_APP_SIZE is being used by the bootloader build script and
* will be calculate by the system.
*/
#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE (MBED_ROM_SIZE - FLASH_CM0P_SIZE)
#endif

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

#if !defined(MBED_RAM_SIZE)
#define MBED_RAM_SIZE 0x00045800
#define MBED_APP_SIZE (MBED_CONFIGURED_ROM_BANK_IROM1_SIZE - FLASH_CM0P_SIZE)
#endif

#if !defined(MBED_BOOT_STACK_SIZE)
Expand Down Expand Up @@ -440,8 +418,8 @@ SECTIONS

/* The following symbols used by the cymcuelftool. */
/* Flash */
__cy_memory_0_start = 0x10000000;
__cy_memory_0_length = 0x00100000;
__cy_memory_0_start = MBED_ROM_BANK_IROM1_START;
__cy_memory_0_length = MBED_ROM_BANK_IROM1_SIZE;
__cy_memory_0_row_size = 0x200;

/* Emulated EEPROM Flash area */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,36 +47,14 @@ ENTRY(Reset_Handler)
/* The size of the Cortex-M0+ application image at the start of FLASH */
FLASH_CM0P_SIZE = 0x2000;

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

/* MBED_APP_START is being used by the bootloader build script and
* will be calculate by the system. In case if MBED_APP_START address is
* customized by the bootloader config, the application image should not
* include CM0p prebuilt image.
*/
/*
* Figure out start address and size of application, unless overridden by definitions
*/
#if !defined(MBED_APP_START)
#define MBED_APP_START (MBED_ROM_START + FLASH_CM0P_SIZE)
#endif

#if !defined(MBED_ROM_SIZE)
#define MBED_ROM_SIZE 0x00080000
#define MBED_APP_START (MBED_CONFIGURED_ROM_BANK_IROM1_START + FLASH_CM0P_SIZE)
#endif

/* MBED_APP_SIZE is being used by the bootloader build script and
* will be calculate by the system.
*/
#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE (MBED_ROM_SIZE - FLASH_CM0P_SIZE)
#endif

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

#if !defined(MBED_RAM_SIZE)
#define MBED_RAM_SIZE 0x0003D800
#define MBED_APP_SIZE (MBED_CONFIGURED_ROM_BANK_IROM1_SIZE - FLASH_CM0P_SIZE)
#endif

#if !defined(MBED_BOOT_STACK_SIZE)
Expand Down Expand Up @@ -106,8 +84,8 @@ MEMORY
* Your changes must be aligned with the corresponding memory regions for CM0+ core in 'xx_cm0plus.ld',
* where 'xx' is the device group; for example, 'cy8c6xx7_cm0plus.ld'.
*/
ram (rwx) : ORIGIN = MBED_RAM_START, LENGTH = MBED_RAM_SIZE
cm0p_image (rx) : ORIGIN = MBED_ROM_START, LENGTH = FLASH_CM0P_SIZE
ram (rwx) : ORIGIN = MBED_CONFIGURED_RAM_BANK_IRAM1_START, LENGTH = MBED_CONFIGURED_RAM_BANK_IRAM1_SIZE
cm0p_image (rx) : ORIGIN = MBED_CONFIGURED_ROM_BANK_IROM1_START, LENGTH = FLASH_CM0P_SIZE
flash (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE

/* This is a 32K flash region used for EEPROM emulation. This region can also be used as the general purpose flash.
Expand Down Expand Up @@ -440,8 +418,8 @@ SECTIONS

/* The following symbols used by the cymcuelftool. */
/* Flash */
__cy_memory_0_start = 0x10000000;
__cy_memory_0_length = 0x00080000;
__cy_memory_0_start = MBED_ROM_BANK_IROM1_START;
__cy_memory_0_length = MBED_ROM_BANK_IROM1_SIZE;
__cy_memory_0_row_size = 0x200;

/* Emulated EEPROM Flash area */
Expand Down
Loading
Loading