2023-09-06 01:29 AM
Hi,
I am working on freertos plus tcp library with STM32H563ZI, but how must I make memory otions in linker file?
like:
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 320K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K
RAM1 (xrw) : ORIGIN = 0x20000000, LENGTH = 256K
RAM2 (xrw) : ORIGIN = 0x20040000, LENGTH = 64K
RAM3 (xrw) : ORIGIN = 0x20050000, LENGTH = 320K
it is wrong I know but how can I make this right ?
2023-09-06 02:07 AM
2023-09-06 04:28 AM - last edited on 2023-09-06 06:38 AM by Foued_KH
thanks
but I made it like this:
/*
******************************************************************************
**
** @file : LinkerScript.ld
**
** @author : Auto-generated by STM32CubeIDE
**
** Abstract : Linker script for NUCLEO-H563ZI Board embedding STM32H563ZITx Device from stm32h5 series
** 2048Kbytes FLASH
** 640Kbytes RAM
**
** Set heap size, stack size and stack location according
** to application requirements.
**
** Set memory bank area and size if external memory is used
**
** Target : STMicroelectronics STM32
**
** Distribution: The file is distributed as is, without any warranty
** of any kind.
**
******************************************************************************
** @attention
**
** Copyright (c) 2023 STMicroelectronics.
** All rights reserved.
**
** This software is licensed under terms that can be found in the LICENSE file
** in the root directory of this software component.
** If no LICENSE file comes with this software, it is provided AS-IS.
**
******************************************************************************
*/
/* Entry Point */
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
_estack = ORIGIN(SRAM3) + LENGTH(SRAM3); /* end of "RAM" Ram type memory */
_Min_Heap_Size = 0x4000; /* required amount of heap */
_Min_Stack_Size = 0x4000; /* required amount of stack */
/* Memories definition */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K
SRAM1 (xrw) : ORIGIN = 0x20000000, LENGTH = 256K
SRAM2 (xrw) : ORIGIN = 0x20040000, LENGTH = 64K
SRAM3 (xrw) : ORIGIN = 0x20050000, LENGTH = 320K
}
/* Sections */
SECTIONS
{
/* The startup code into "FLASH" Rom type memory */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
/* The program code and other data into "FLASH" Rom type memory */
.text :
{
. = ALIGN(4);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} >FLASH
/* Constant data into "FLASH" Rom type memory */
.rodata :
{
. = ALIGN(4);
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(4);
} >FLASH
.ARM.extab : {
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
} >FLASH
.ARM : {
. = ALIGN(4);
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
. = ALIGN(4);
} >FLASH
.preinit_array :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
. = ALIGN(4);
} >FLASH
.init_array :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
. = ALIGN(4);
} >FLASH
.fini_array :
{
. = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
. = ALIGN(4);
} >FLASH
.ethernet_data :
{
PROVIDE_HIDDEN (__ethernet_data_start = .);
KEEP (*(SORT(.ethernet_data.*)))
KEEP (*(.ethernet_data*))
PROVIDE_HIDDEN (__ethernet_data_end = .);
} >SRAM3
/* Used by the startup to initialize data */
_sidata = LOADADDR(.data);
/* Initialized data sections into "RAM" Ram type memory */
.data :
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
*(.RamFunc) /* .RamFunc sections */
*(.RamFunc*) /* .RamFunc* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} >SRAM1 AT> FLASH
/* Uninitialized data section into "RAM" Ram type memory */
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss section */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >SRAM1
/* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
._user_heap_stack :
{
. = ALIGN(8);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(8);
} >SRAM1
/* Remove information from the compiler libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
.ARM.attributes 0 : { *(.ARM.attributes) }
}
and still didn't work
gave me this error:
Flashing firmware to the board
scons: *** [build/STM32H563ZI/mc] JLinkFlashException : Could not write target memory.
2023-09-06 08:24 AM - edited 2023-09-06 08:25 AM
Hi @Recep ,
You need to modify the SRAM address as showing :
SRAM1 : 0x0A00 0000
SRAM1 : 0x0A04 0000
SRAM1 : 0x0A05 0000
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-09-06 09:01 AM - edited 2023-09-06 09:03 AM
The Programmers don't want to write into RAM spaces. These either need to be NOLOAD sections, or you need to stage them in FLASH, and copy them to the final destinations via code in startup.s
That code needs to copy or zero the RAM content as appropriate.
The Linker Script also presumes the memory regions don't overlap, doing so will result in variables/structures being given the same addresses and conflicting when used.
2023-09-09 08:41 AM
thanks, I found out that h5 doesn't need ethernet configure in linker file with freertos plus tcp library, it is configured in library as attributes in memory field.
2023-09-10 06:24 AM - edited 2023-09-10 06:26 AM
The eth memory in FreeRTOS+ TCP for STM32H7 is defined here.
They don't seem to have a separate source for STM32H5 yet.
2024-02-08 03:42 PM
Hi Recep,
I'm just starting a project with ethernet on the H563ZI and am considering using lwip or FreeRTOS+TCP.
Would you have references for the porting that you did? I see only H7 is included in the official FreeRTOS+TCP project.
Thanks
2024-02-09 02:09 AM
hi,
just used https://github.com/FreeRTOS/FreeRTOS/releases/download/202212.01/FreeRTOSv202212.01.zip
Freertos + TCP libraries in this
but you need to change the hal h7 includes to h5 includes
path is like -> FreeRTOS-Plus-TCP/source/portable/Networkinterface/STM32Hxx/Networkinterface.c
all the codes in the Networkinterface.c almost the same but includes
2024-04-03 09:54 AM
Hi @Recep, I tried to follow your suggestion of using the files in FreeRTOS-Plus-TCP\source\portable\NetworkInterface\STM32Hxx for STM32H5 by just renaming the relevant H7 files to H5 but I have this compiler error at stm32hxx_hal_eth.h that seems to refer a define that H5 does not have (In the H7 version it is exist in stm32h743xx.h):
How did you resolve this?
Thanks!