cancel
Showing results for 
Search instead for 
Did you mean: 

[Solved] Linker script: block RAM for variables

Joerg Wagner
Senior III
Posted on October 04, 2017 at 20:09

How do I have to configure the linker script file to block the required space

for Ethernet buffers at 0x24000000?

STM32H743 starts with DTCM at 0x20000000, but Ethernet works in 0x24000000 only.

I want to use the RAM space around for my purpose without losing so much.

In ethernetif.c the buffers are marked with .RxDecripSection, .TxDecripSection, .RxArraySection.

I'm not a linker file specialist to make the right definitions.

Thank you for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
Joerg Wagner
Senior III
Posted on February 07, 2018 at 23:44

Solved with HAL 1.2.0

View solution in original post

5 REPLIES 5
Joerg Wagner
Senior III
Posted on October 06, 2017 at 11:16

I modified the linker script file for myself to place ETH descriptors and RX buffer in one SRAM block. It's so much fun so I did it for the UART buffer as well in another SRAM section for DMA transfer. 

Posted on October 06, 2017 at 11:22

Hi

Wagner.Joerg

,

0690X00000608VuQAI.pnghttps://community.st.com/0D50X00009bMM5DSAW

-Nesrine-

Posted on October 06, 2017 at 11:33

to help us lesser able programmers;

how did you do it ?

that chip is not available at Digikey..

Posted on October 06, 2017 at 11:55

I have a NUCLEO-H743ZI board. IDE is OpenSTM32 (GNU C). For Keil and IAR there is nothing to do.

My linker script file looks like:

/* Entry Point */

ENTRY(Reset_Handler)

/* Highest address of the user mode stack */

_estack = 0x20020000;    /* end of RAM */

/* Generate a link error if heap and stack don't fit into RAM */

_Min_Heap_Size = 0x200;      /* required amount of heap  */

_Min_Stack_Size = 0x400; /* required amount of stack */

/* Specify the memory areas */

MEMORY

{

DTCMRAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 128K

RAM_D1 (xrw)      : ORIGIN = 0x24000000, LENGTH = 512K

RAM1_D2 (xrw)      : ORIGIN = 0x30000000, LENGTH = 128K

RAM2_D2 (xrw)      : ORIGIN = 0x30020000, LENGTH = 128K

RAM3_D2 (xrw)      : ORIGIN = 0x30040000, LENGTH = 32K

RAM4_D3 (xrw)      : ORIGIN = 0x38000000, LENGTH = 64K

ITCMRAM (xrw)      : ORIGIN = 0x00000000, LENGTH = 64K

FLASH (rx)      : ORIGIN = 0x8000000, LENGTH = 2048K

}

/* Define output sections */

SECTIONS

{

  /* The startup code goes first into FLASH */

  .isr_vector :

  {

    . = ALIGN(4);

    KEEP(*(.isr_vector)) /* Startup code */

    . = ALIGN(4);

  } >FLASH

  /* The program code and other data goes into FLASH */

  .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 goes into FLASH */

  .rodata :

  {

    . = ALIGN(4);

    *(.rodata)         /* .rodata sections (constants, strings, etc.) */

    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */

    . = ALIGN(4);

  } >FLASH

  .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH

  .ARM : {

    __exidx_start = .;

    *(.ARM.exidx*)

    __exidx_end = .;

  } >FLASH

  .preinit_array     :

  {

    PROVIDE_HIDDEN (__preinit_array_start = .);

    KEEP (*(.preinit_array*))

    PROVIDE_HIDDEN (__preinit_array_end = .);

  } >FLASH

  .init_array :

  {

    PROVIDE_HIDDEN (__init_array_start = .);

    KEEP (*(SORT(.init_array.*)))

    KEEP (*(.init_array*))

    PROVIDE_HIDDEN (__init_array_end = .);

  } >FLASH

  .fini_array :

  {

    PROVIDE_HIDDEN (__fini_array_start = .);

    KEEP (*(SORT(.fini_array.*)))

    KEEP (*(.fini_array*))

    PROVIDE_HIDDEN (__fini_array_end = .);

  } >FLASH

  /* used by the startup to initialize data */

  _sidata = LOADADDR(.data);

  /* Initialized data sections goes into RAM, load LMA copy after code */

  .data :

  {

    . = ALIGN(4);

    _sdata = .;        /* create a global symbol at data start */

    *(.data)           /* .data sections */

    *(.data*)          /* .data* sections */

    . = ALIGN(4);

    _edata = .;        /* define a global symbol at data end */

  } >DTCMRAM AT> FLASH

 

  /* Uninitialized data section */

  . = ALIGN(4);

  .bss :

  {

    /* This is used by the startup in order to initialize the .bss secion */

    _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;

  } >DTCMRAM

  /* User_heap_stack section, used to check that there is enough RAM left */

  ._user_heap_stack :

  {

    . = ALIGN(8);

    PROVIDE ( end = . );

    PROVIDE ( _end = . );

    . = . + _Min_Heap_Size;

    . = . + _Min_Stack_Size;

    . = ALIGN(8);

  } >DTCMRAM

  .RxDecripSection (NOLOAD) :

  {

      . = 0x00;

      *(.RxDecripSection)

      *(.RxDecripSection*)

  } >RAM2_D2

 

  .TxDecripSection (NOLOAD) :

  {

      . = 0x60;

      *(.TxDecripSection)

      *(.TxDecripSection*)

  } >RAM2_D2

 

  .ETHfill (NOLOAD) :

  {

      . = 0xe0;

  } >RAM2_D2

 

  .RxArraySection (NOLOAD) :

  {

      . = 0x200;

      *(.RxArraySection)

      *(.RxArraySection*)

  } >RAM2_D2

 

  .DMA_UART3STR (NOLOAD) :

  {

      . = 0x2000;

      *(.DMA_UART3STR)

      *(.DMA_UART3STR*)

  } >RAM3_D2

  /* Remove information from the standard libraries */

  /DISCARD/ :

  {

    libc.a ( * )

    libm.a ( * )

    libgcc.a ( * )

  }

  .ARM.attributes 0 : { *(.ARM.attributes) }

}

I used Dx for the domain numbers.

Joerg Wagner
Senior III
Posted on February 07, 2018 at 23:44

Solved with HAL 1.2.0