Skip to content

Commit

Permalink
MIMXRT105x: upgrade linker script to use memory banks, disable SRAM (#…
Browse files Browse the repository at this point in the history
…411)

* Update MIMXRT105x linker script to use memory banks

* Disable SRAM for now :/

* Add split heap support
  • Loading branch information
multiplemonomials authored Jan 2, 2025
1 parent 722c2f1 commit d255e11
Show file tree
Hide file tree
Showing 12 changed files with 193 additions and 124 deletions.
3 changes: 3 additions & 0 deletions platform/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@
},
"MCU_STM32H7": {
"crash-capture-enabled": true
},
"MIMXRT105X": {
"crash-capture-enabled": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ SECTIONS
. = ALIGN(8);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(8);
} > m_text AT> m_text :text
} > m_text :text

/* FCF to absolute address of 0x400, but only if bootloader is not present. */
#if !IS_BOOTLOADER_PRESENT
.flash_config FLASH_VTOR_TABLE_SIZE :
{
KEEP(*(.FlashConfig)) /* Flash Configuration Field (FCF) */
} > m_text AT> m_text :text
} > m_text :text
#else
/DISCARD/ : {
*(.FlashConfig)
Expand All @@ -140,19 +140,19 @@ SECTIONS
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(8);
} > m_text AT> m_text :text
} > m_text :text

.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > m_text AT> m_text :text
} > m_text :text

.ARM :
{
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} > m_text AT> m_text :text
} > m_text :text

.ctors :
{
Expand All @@ -176,7 +176,7 @@ SECTIONS
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
__CTOR_END__ = .;
} > m_text AT> m_text :text
} > m_text :text

.dtors :
{
Expand All @@ -187,30 +187,30 @@ SECTIONS
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
__DTOR_END__ = .;
} > m_text AT> m_text :text
} > m_text :text

.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
} > m_text AT> m_text :text
} > m_text :text

.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} > m_text AT> m_text :text
} > m_text :text

.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
} > m_text AT> m_text :text
} > m_text :text

#if MBED_CONF_PLATFORM_CRASH_CAPTURE_ENABLED
/* Stick the crash data ram at the start of sram_l */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const flexspi_nor_config_t hyperflash_config = {
(1u << kFlexSpiMiscOffset_SafeConfigFreqEnable) | (1u << kFlexSpiMiscOffset_DiffClkEnable),
.sflashPadType = kSerialFlash_8Pads,
.serialClkFreq = kFlexSpiSerialClk_133MHz,
.sflashA1Size = BOARD_FLASH_SIZE,
.sflashA1Size = MBED_ROM_BANK_EXT_FLASH_SIZE,
.dataValidTime = {16u, 16u},
.lookupTable = {
// Read LUTs
Expand Down Expand Up @@ -68,7 +68,7 @@ const flexspi_nor_config_t qspiflash_config = {
.sflashPadType = kSerialFlash_4Pads,
.serialClkFreq = kFlexSpiSerialClk_133MHz,
.lutCustomSeqEnable = 0u,
.sflashA1Size = BOARD_FLASH_SIZE,
.sflashA1Size = MBED_ROM_BANK_EXT_FLASH_SIZE,
.lookupTable = {
// Fast read sequence
[0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const flexspi_nor_config_t qspiflash_config = {
.deviceType = kFlexSpiDeviceType_SerialNOR,
.sflashPadType = kSerialFlash_4Pads,
.serialClkFreq = kFlexSpiSerialClk_120MHz,
.sflashA1Size = BOARD_FLASH_SIZE,
.sflashA1Size = MBED_ROM_BANK_EXT_FLASH_SIZE,
.lookupTable =
{
// Read LUTs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,8 @@ int32_t flash_free(flash_t *obj)
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
{
uint32_t sectorsize = MBED_FLASH_INVALID_SIZE;
uint32_t devicesize = BOARD_FLASH_SIZE;
uint32_t startaddr = BOARD_FLASH_START_ADDR;
uint32_t devicesize = MBED_ROM_BANK_EXT_FLASH_SIZE;
uint32_t startaddr = MBED_ROM_BANK_EXT_FLASH_START;

if ((address >= startaddr) && (address < (startaddr + devicesize))) {
sectorsize = BOARD_FLASH_SECTOR_SIZE;
Expand All @@ -672,12 +672,12 @@ uint32_t flash_get_page_size(const flash_t *obj)

uint32_t flash_get_start_address(const flash_t *obj)
{
return BOARD_FLASH_START_ADDR;
return MBED_ROM_BANK_EXT_FLASH_START;
}

uint32_t flash_get_size(const flash_t *obj)
{
return BOARD_FLASH_SIZE;
return MBED_ROM_BANK_EXT_FLASH_SIZE;
}

uint8_t flash_get_erase_value(const flash_t *obj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ static uint32_t customLUT[CUSTOM_LUT_LENGTH] = {

flexspi_device_config_t deviceconfig = {
.flexspiRootClk = 120000000,
.flashSize = (BOARD_FLASH_SIZE/1024),
.flashSize = (MBED_ROM_BANK_EXT_FLASH_SIZE/1024),
.CSIntervalUnit = kFLEXSPI_CsIntervalUnit1SckCycle,
.CSInterval = 0,
.CSHoldTime = 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ typedef struct _boot_data_ {
uint32_t placeholder; /* placehoder to make even 0x10 size */
}BOOT_DATA_T;

#define FLASH_SIZE BOARD_FLASH_SIZE
#define FLASH_SIZE MBED_ROM_BANK_EXT_FLASH_SIZE
#define PLUGIN_FLAG (uint32_t)0

/* External Variables */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,12 @@

#ifdef HYPERFLASH_BOOT
/* 64MB HyperFlash */
#define BOARD_FLASH_SIZE (0x4000000)
#define BOARD_FLASH_START_ADDR (0x60000000)
#define BOARD_FLASH_PAGE_SIZE (512)
#define BOARD_FLASH_SECTOR_SIZE (262144)
#else
/* 8MB QSPI Flash */
#define BOARD_FLASH_SIZE (0x800000)
#define BOARD_FLASH_START_ADDR (0x60000000)
#define BOARD_FLASH_PAGE_SIZE (256)
#define BOARD_FLASH_SECTOR_SIZE (4096)
#endif

// Unless the user overrides it, define the app to use the entire flash space.
#ifndef MBED_APP_START
#define MBED_APP_START BOARD_FLASH_START_ADDR
#endif

#ifndef MBED_APP_SIZE
#define MBED_APP_SIZE BOARD_FLASH_SIZE
#endif

#define MIMXRT105X_BOARD_HAS_EXTERNAL_RAM 1
#define MIMXRT105X_EXTERNAL_RAM_SIZE 0x02000000

#endif //MBED_OS_MIMXRT_MEMORY_INFO_H
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,7 @@
#define MBED_OS_MIMXRT_MEMORY_INFO_H

/* 2MB QSPI Flash */
#define BOARD_FLASH_SIZE (0x1F0000) // 1984k
#define BOARD_FLASH_START_ADDR (0x60000000)
#define BOARD_FLASH_PAGE_SIZE (256)
#define BOARD_FLASH_SECTOR_SIZE (4096)

// Unless the user overrides it, define the app to use the entire flash space.
#ifndef MBED_APP_START
#define MBED_APP_START BOARD_FLASH_START_ADDR
#endif

#ifndef MBED_APP_SIZE
#define MBED_APP_SIZE BOARD_FLASH_SIZE
#endif

#define MIMXRT105X_BOARD_HAS_EXTERNAL_RAM 0

#endif //MBED_OS_MIMXRT_MEMORY_INFO_H
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,7 @@
#define MBED_OS_MIMXRT_MEMORY_INFO_H

/* 8MB QSPI Flash */
#define BOARD_FLASH_SIZE (0x7C0000) // 7936k
#define BOARD_FLASH_START_ADDR (0x60000000)
#define BOARD_FLASH_PAGE_SIZE (256)
#define BOARD_FLASH_SECTOR_SIZE (4096)

// Unless the user overrides it, define the app to use the entire flash space.
#ifndef MBED_APP_START
#define MBED_APP_START BOARD_FLASH_START_ADDR
#endif

#ifndef MBED_APP_SIZE
#define MBED_APP_SIZE BOARD_FLASH_SIZE
#endif

#define MIMXRT105X_BOARD_HAS_EXTERNAL_RAM 0

#endif //MBED_OS_MIMXRT_MEMORY_INFO_H
Loading

0 comments on commit d255e11

Please sign in to comment.