hw/h7rs: Update linker to put RTT in DTCM
Signed-off-by: HiFiPhile <admin@hifiphile.com>
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
set(MCU_VARIANT stm32h7s3xx)
|
||||
set(JLINK_DEVICE stm32h7s3xx)
|
||||
|
||||
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/stm32h7s3xx_flash.ld)
|
||||
set(LD_FILE_Clang ${LD_FILE_GNU})
|
||||
set(LD_FILE_IAR ${CMAKE_CURRENT_LIST_DIR}/stm32h7s3xx_flash.icf)
|
||||
|
||||
function(update_board TARGET)
|
||||
target_compile_definitions(${TARGET} PUBLIC
|
||||
|
@@ -7,10 +7,6 @@ JLINK_DEVICE = stm32h7s3xx
|
||||
# flash target using on-board stlink
|
||||
flash: flash-stlink
|
||||
|
||||
# Linker
|
||||
LD_FILE_GCC = $(BOARD_PATH)/stm32h7s3xx_flash.ld
|
||||
LD_FILE_IAR = $(BOARD_PATH)/stm32h7s3xx_flash.icf
|
||||
|
||||
SRC_C += \
|
||||
$(ST_TCPP0203)/tcpp0203.c \
|
||||
$(ST_TCPP0203)/tcpp0203_reg.c \
|
||||
|
@@ -54,11 +54,11 @@ function(add_board_target BOARD_TARGET)
|
||||
set(STARTUP_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/startup_${MCU_VARIANT}.s)
|
||||
|
||||
if(NOT DEFINED LD_FILE_GNU)
|
||||
set(LD_FILE_GNU ${ST_CMSIS}/Source/Templates/gcc/linker/${MCU_VARIANT}_flash.ld)
|
||||
set(LD_FILE_GNU ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/linker/${MCU_VARIANT}_flash.ld)
|
||||
endif()
|
||||
set(LD_FILE_Clang ${LD_FILE_GNU})
|
||||
if(NOT DEFINED LD_FILE_IAR)
|
||||
set(LD_FILE_IAR ${ST_CMSIS}/Source/Templates/iar/linker/${MCU_VARIANT}_flash.icf)
|
||||
set(LD_FILE_IAR ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/linker/${MCU_VARIANT}_flash.icf)
|
||||
endif()
|
||||
|
||||
add_library(${BOARD_TARGET} STATIC
|
||||
@@ -87,8 +87,7 @@ function(add_board_target BOARD_TARGET)
|
||||
BOARD_TUD_MAX_SPEED=${RHPORT_DEVICE_SPEED}
|
||||
BOARD_TUH_RHPORT=${RHPORT_HOST}
|
||||
BOARD_TUH_MAX_SPEED=${RHPORT_HOST_SPEED}
|
||||
SEGGER_RTT_SECTION="noncacheable_buffer"
|
||||
BUFFER_SIZE_UP=0x3000
|
||||
SEGGER_RTT_SECTION=\"dtcm_data\"
|
||||
)
|
||||
|
||||
update_board(${BOARD_TARGET})
|
||||
|
@@ -43,8 +43,7 @@ CFLAGS += \
|
||||
-DBOARD_TUD_MAX_SPEED=${RHPORT_DEVICE_SPEED} \
|
||||
-DBOARD_TUH_RHPORT=${RHPORT_HOST} \
|
||||
-DBOARD_TUH_MAX_SPEED=${RHPORT_HOST_SPEED} \
|
||||
-DSEGGER_RTT_SECTION=\"noncacheable_buffer\" \
|
||||
-DBUFFER_SIZE_UP=0x3000 \
|
||||
-DSEGGER_RTT_SECTION="dtcm_data" \
|
||||
|
||||
# GCC Flags
|
||||
CFLAGS_GCC += \
|
||||
@@ -91,5 +90,5 @@ SRC_S_GCC += $(ST_CMSIS)/Source/Templates/gcc/startup_$(MCU_VARIANT).s
|
||||
SRC_S_IAR += $(ST_CMSIS)/Source/Templates/iar/startup_$(MCU_VARIANT).s
|
||||
|
||||
# Linker
|
||||
LD_FILE_GCC ?= $(ST_CMSIS)/Source/Templates/gcc/linker/$(MCU_VARIANT)_flash.ld
|
||||
LD_FILE_IAR ?= $(ST_CMSIS)/Source/Templates/iar/linker/$(MCU_VARIANT)_flash.icf
|
||||
LD_FILE_GCC ?= $(FAMILY_PATH)/linker/$(MCU_VARIANT)_flash.ld
|
||||
LD_FILE_IAR ?= $(FAMILY_PATH)/linker/$(MCU_VARIANT)_flash.icf
|
||||
|
@@ -4,7 +4,7 @@
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol NONCACHEABLEBUFFER_size = 0x4000;
|
||||
define symbol NONCACHEABLEBUFFER_size = 0x400;
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x24000000;
|
||||
@@ -14,7 +14,7 @@ define symbol NONCACHEABLEBUFFER_end = __ICFEDIT_region_RAM_end__ + NONCAC
|
||||
|
||||
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x800;
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x400;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x200;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
@@ -51,5 +51,5 @@ place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite };
|
||||
place in DTCM_region { block CSTACK, block HEAP, section dtcm_data };
|
||||
place in NONCACHEABLE_region { section noncacheable_buffer };
|
||||
place in DTCM_region { block CSTACK, block HEAP };
|
@@ -35,15 +35,19 @@
|
||||
/* Entry Point */
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/* Highest address of the user mode stack */
|
||||
_estack = ORIGIN(DTCM) + LENGTH(DTCM); /* end of "DTCM" Ram type memory */
|
||||
|
||||
_Min_Heap_Size = 0x200; /* required amount of heap */
|
||||
_Min_Stack_Size = 0x400; /* required amount of stack */
|
||||
|
||||
__FLASH_BEGIN = 0x08000000;
|
||||
__FLASH_SIZE = 0x00010000;
|
||||
|
||||
|
||||
__RAM_BEGIN = 0x24000000;
|
||||
__RAM_SIZE = 0x4FC00;
|
||||
__RAM_NONCACHEABLEBUFFER_SIZE = 0x4000;
|
||||
__RAM_NONCACHEABLEBUFFER_SIZE = 0x400;
|
||||
|
||||
/* Memories definition */
|
||||
MEMORY
|
||||
@@ -59,9 +63,6 @@ MEMORY
|
||||
FLASH (xrw) : ORIGIN = __FLASH_BEGIN, LENGTH = __FLASH_SIZE
|
||||
}
|
||||
|
||||
/* Highest address of the user mode stack */
|
||||
_estack = ORIGIN(DTCM) + LENGTH(DTCM); /* end of "DTCM" Ram type memory */
|
||||
|
||||
/* Sections */
|
||||
SECTIONS
|
||||
{
|
||||
@@ -99,14 +100,14 @@ SECTIONS
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
|
||||
.ARM.extab :
|
||||
.ARM.extab (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
|
||||
.ARM :
|
||||
.ARM (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__exidx_start = .;
|
||||
@@ -115,7 +116,7 @@ SECTIONS
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
|
||||
.preinit_array :
|
||||
.preinit_array (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
|
||||
{
|
||||
. = ALIGN(4);
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
@@ -124,7 +125,7 @@ SECTIONS
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
|
||||
.init_array :
|
||||
.init_array (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
|
||||
{
|
||||
. = ALIGN(4);
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
@@ -134,7 +135,7 @@ SECTIONS
|
||||
. = ALIGN(4);
|
||||
} >FLASH
|
||||
|
||||
.fini_array :
|
||||
.fini_array (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
|
||||
{
|
||||
. = ALIGN(4);
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
@@ -182,7 +183,7 @@ SECTIONS
|
||||
{
|
||||
__NONCACHEABLEBUFFER_BEGIN = .;/* create symbol for start of section */
|
||||
KEEP(*(noncacheable_buffer))
|
||||
__NONCACHEABLEBUFFER_END = .; /* create symbol for start of section */
|
||||
__NONCACHEABLEBUFFER_END = .; /* create symbol for end of section */
|
||||
} > RAM_NONCACHEABLEBUFFER
|
||||
|
||||
/* User_heap_stack section, used to check that there is enough "DTCM" Ram type memory left */
|
||||
@@ -196,6 +197,11 @@ SECTIONS
|
||||
. = ALIGN(8);
|
||||
} >DTCM
|
||||
|
||||
.dtcm_data :
|
||||
{
|
||||
*(dtcm_data)
|
||||
} >DTCM
|
||||
|
||||
/* Remove information from the compiler libraries */
|
||||
/DISCARD/ :
|
||||
{
|
Reference in New Issue
Block a user