From a89bba470a289e4369b325a8ad7fbd30f3e967d2 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Sun, 5 Apr 2020 10:34:08 -0400 Subject: [PATCH] boards: STM32F76xxx/STM32F77xxx linker add ITCM RAM and .ramfuncs handling - this doesn't currently change anything, but gets us ready to start experimenting with using the small amount of instruction tightly memory on STM32F7 - the .ramfuncs section works with NuttX CONFIG_ARCH_RAMFUNCS --- boards/av/x-v1/nuttx-config/scripts/script.ld | 35 ++++++++++++------- .../fc-v1/nuttx-config/scripts/script.ld | 35 ++++++++++++------- .../nuttx-config/scripts/script.ld | 35 ++++++++++++------- .../x21-777/nuttx-config/scripts/script.ld | 35 ++++++++++++------- .../px4/fmu-v5/nuttx-config/scripts/script.ld | 35 ++++++++++++------- .../fmu-v5x/nuttx-config/scripts/script.ld | 35 ++++++++++++------- 6 files changed, 138 insertions(+), 72 deletions(-) diff --git a/boards/av/x-v1/nuttx-config/scripts/script.ld b/boards/av/x-v1/nuttx-config/scripts/script.ld index fae1d95de0..dcaf04fd2c 100644 --- a/boards/av/x-v1/nuttx-config/scripts/script.ld +++ b/boards/av/x-v1/nuttx-config/scripts/script.ld @@ -71,11 +71,13 @@ MEMORY { - itcm (rwx) : ORIGIN = 0x00208000, LENGTH = 2016K - flash (rx) : ORIGIN = 0x08008000, LENGTH = 2016K - dtcm (rwx) : ORIGIN = 0x20000000, LENGTH = 128K - sram1 (rwx) : ORIGIN = 0x20020000, LENGTH = 368K - sram2 (rwx) : ORIGIN = 0x2007c000, LENGTH = 16K + FLASH_ITCM (rx) : ORIGIN = 0x00208000, LENGTH = 2016K + FLASH_AXIM (rx) : ORIGIN = 0x08008000, LENGTH = 2016K + + ITCM_RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 16K + DTCM_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K + SRAM1 (rwx) : ORIGIN = 0x20020000, LENGTH = 368K + SRAM2 (rwx) : ORIGIN = 0x2007c000, LENGTH = 16K } OUTPUT_ARCH(arm) @@ -118,7 +120,7 @@ SECTIONS * use the NuttX get_errno_ptr() function. */ __errno = get_errno_ptr; - } > flash + } > FLASH_AXIM /* * Init functions (static constructors and the like) @@ -127,7 +129,7 @@ SECTIONS _sinit = ABSOLUTE(.); KEEP(*(.init_array .init_array.*)) _einit = ABSOLUTE(.); - } > flash + } > FLASH_AXIM /* * Construction data for parameters. @@ -136,16 +138,16 @@ SECTIONS __param_start = ABSOLUTE(.); KEEP(*(__param*)) __param_end = ABSOLUTE(.); - } > flash + } > FLASH_AXIM .ARM.extab : { *(.ARM.extab*) - } > flash + } > FLASH_AXIM __exidx_start = ABSOLUTE(.); .ARM.exidx : { *(.ARM.exidx*) - } > flash + } > FLASH_AXIM __exidx_end = ABSOLUTE(.); _eronly = ABSOLUTE(.); @@ -156,7 +158,7 @@ SECTIONS *(.gnu.linkonce.d.*) CONSTRUCTORS _edata = ABSOLUTE(.); - } > sram1 AT > flash + } > SRAM1 AT > FLASH_AXIM .bss : { _sbss = ABSOLUTE(.); @@ -165,7 +167,7 @@ SECTIONS *(COMMON) . = ALIGN(4); _ebss = ABSOLUTE(.); - } > sram1 + } > SRAM1 /* Stabs debugging sections. */ .stab 0 : { *(.stab) } @@ -180,4 +182,13 @@ SECTIONS .debug_line 0 : { *(.debug_line) } .debug_pubnames 0 : { *(.debug_pubnames) } .debug_aranges 0 : { *(.debug_aranges) } + + .ramfunc : { + _sramfuncs = .; + *(.ramfunc .ramfunc.*) + . = ALIGN(4); + _eramfuncs = .; + } > ITCM_RAM AT > FLASH_AXIM + + _framfuncs = LOADADDR(.ramfunc); } diff --git a/boards/modalai/fc-v1/nuttx-config/scripts/script.ld b/boards/modalai/fc-v1/nuttx-config/scripts/script.ld index fae1d95de0..dcaf04fd2c 100644 --- a/boards/modalai/fc-v1/nuttx-config/scripts/script.ld +++ b/boards/modalai/fc-v1/nuttx-config/scripts/script.ld @@ -71,11 +71,13 @@ MEMORY { - itcm (rwx) : ORIGIN = 0x00208000, LENGTH = 2016K - flash (rx) : ORIGIN = 0x08008000, LENGTH = 2016K - dtcm (rwx) : ORIGIN = 0x20000000, LENGTH = 128K - sram1 (rwx) : ORIGIN = 0x20020000, LENGTH = 368K - sram2 (rwx) : ORIGIN = 0x2007c000, LENGTH = 16K + FLASH_ITCM (rx) : ORIGIN = 0x00208000, LENGTH = 2016K + FLASH_AXIM (rx) : ORIGIN = 0x08008000, LENGTH = 2016K + + ITCM_RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 16K + DTCM_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K + SRAM1 (rwx) : ORIGIN = 0x20020000, LENGTH = 368K + SRAM2 (rwx) : ORIGIN = 0x2007c000, LENGTH = 16K } OUTPUT_ARCH(arm) @@ -118,7 +120,7 @@ SECTIONS * use the NuttX get_errno_ptr() function. */ __errno = get_errno_ptr; - } > flash + } > FLASH_AXIM /* * Init functions (static constructors and the like) @@ -127,7 +129,7 @@ SECTIONS _sinit = ABSOLUTE(.); KEEP(*(.init_array .init_array.*)) _einit = ABSOLUTE(.); - } > flash + } > FLASH_AXIM /* * Construction data for parameters. @@ -136,16 +138,16 @@ SECTIONS __param_start = ABSOLUTE(.); KEEP(*(__param*)) __param_end = ABSOLUTE(.); - } > flash + } > FLASH_AXIM .ARM.extab : { *(.ARM.extab*) - } > flash + } > FLASH_AXIM __exidx_start = ABSOLUTE(.); .ARM.exidx : { *(.ARM.exidx*) - } > flash + } > FLASH_AXIM __exidx_end = ABSOLUTE(.); _eronly = ABSOLUTE(.); @@ -156,7 +158,7 @@ SECTIONS *(.gnu.linkonce.d.*) CONSTRUCTORS _edata = ABSOLUTE(.); - } > sram1 AT > flash + } > SRAM1 AT > FLASH_AXIM .bss : { _sbss = ABSOLUTE(.); @@ -165,7 +167,7 @@ SECTIONS *(COMMON) . = ALIGN(4); _ebss = ABSOLUTE(.); - } > sram1 + } > SRAM1 /* Stabs debugging sections. */ .stab 0 : { *(.stab) } @@ -180,4 +182,13 @@ SECTIONS .debug_line 0 : { *(.debug_line) } .debug_pubnames 0 : { *(.debug_pubnames) } .debug_aranges 0 : { *(.debug_aranges) } + + .ramfunc : { + _sramfuncs = .; + *(.ramfunc .ramfunc.*) + . = ALIGN(4); + _eramfuncs = .; + } > ITCM_RAM AT > FLASH_AXIM + + _framfuncs = LOADADDR(.ramfunc); } diff --git a/boards/mro/ctrl-zero-f7/nuttx-config/scripts/script.ld b/boards/mro/ctrl-zero-f7/nuttx-config/scripts/script.ld index d6188a20ef..25bf37252b 100644 --- a/boards/mro/ctrl-zero-f7/nuttx-config/scripts/script.ld +++ b/boards/mro/ctrl-zero-f7/nuttx-config/scripts/script.ld @@ -71,11 +71,13 @@ MEMORY { - itcm (rwx) : ORIGIN = 0x00218000, LENGTH = 1952K - flash (rx) : ORIGIN = 0x08018000, LENGTH = 1952K /* start on 4th sector (1st sector for bootloader, 2 for extra storage) */ - dtcm (rwx) : ORIGIN = 0x20000000, LENGTH = 128K - sram1 (rwx) : ORIGIN = 0x20020000, LENGTH = 368K - sram2 (rwx) : ORIGIN = 0x2007c000, LENGTH = 16K + FLASH_ITCM (rx) : ORIGIN = 0x00218000, LENGTH = 1952K + FLASH_AXIM (rx) : ORIGIN = 0x08018000, LENGTH = 1952K /* start on 4th sector (1st sector for bootloader, 2 for extra storage) */ + + ITCM_RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 16K + DTCM_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K + SRAM1 (rwx) : ORIGIN = 0x20020000, LENGTH = 368K + SRAM2 (rwx) : ORIGIN = 0x2007c000, LENGTH = 16K } OUTPUT_ARCH(arm) @@ -118,7 +120,7 @@ SECTIONS * use the NuttX get_errno_ptr() function. */ __errno = get_errno_ptr; - } > flash + } > FLASH_AXIM /* * Init functions (static constructors and the like) @@ -127,7 +129,7 @@ SECTIONS _sinit = ABSOLUTE(.); KEEP(*(.init_array .init_array.*)) _einit = ABSOLUTE(.); - } > flash + } > FLASH_AXIM /* * Construction data for parameters. @@ -136,16 +138,16 @@ SECTIONS __param_start = ABSOLUTE(.); KEEP(*(__param*)) __param_end = ABSOLUTE(.); - } > flash + } > FLASH_AXIM .ARM.extab : { *(.ARM.extab*) - } > flash + } > FLASH_AXIM __exidx_start = ABSOLUTE(.); .ARM.exidx : { *(.ARM.exidx*) - } > flash + } > FLASH_AXIM __exidx_end = ABSOLUTE(.); _eronly = ABSOLUTE(.); @@ -156,7 +158,7 @@ SECTIONS *(.gnu.linkonce.d.*) CONSTRUCTORS _edata = ABSOLUTE(.); - } > sram1 AT > flash + } > SRAM1 AT > FLASH_AXIM .bss : { _sbss = ABSOLUTE(.); @@ -165,7 +167,7 @@ SECTIONS *(COMMON) . = ALIGN(4); _ebss = ABSOLUTE(.); - } > sram1 + } > SRAM1 /* Stabs debugging sections. */ .stab 0 : { *(.stab) } @@ -180,4 +182,13 @@ SECTIONS .debug_line 0 : { *(.debug_line) } .debug_pubnames 0 : { *(.debug_pubnames) } .debug_aranges 0 : { *(.debug_aranges) } + + .ramfunc : { + _sramfuncs = .; + *(.ramfunc .ramfunc.*) + . = ALIGN(4); + _eramfuncs = .; + } > ITCM_RAM AT > FLASH_AXIM + + _framfuncs = LOADADDR(.ramfunc); } diff --git a/boards/mro/x21-777/nuttx-config/scripts/script.ld b/boards/mro/x21-777/nuttx-config/scripts/script.ld index fae1d95de0..dcaf04fd2c 100644 --- a/boards/mro/x21-777/nuttx-config/scripts/script.ld +++ b/boards/mro/x21-777/nuttx-config/scripts/script.ld @@ -71,11 +71,13 @@ MEMORY { - itcm (rwx) : ORIGIN = 0x00208000, LENGTH = 2016K - flash (rx) : ORIGIN = 0x08008000, LENGTH = 2016K - dtcm (rwx) : ORIGIN = 0x20000000, LENGTH = 128K - sram1 (rwx) : ORIGIN = 0x20020000, LENGTH = 368K - sram2 (rwx) : ORIGIN = 0x2007c000, LENGTH = 16K + FLASH_ITCM (rx) : ORIGIN = 0x00208000, LENGTH = 2016K + FLASH_AXIM (rx) : ORIGIN = 0x08008000, LENGTH = 2016K + + ITCM_RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 16K + DTCM_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K + SRAM1 (rwx) : ORIGIN = 0x20020000, LENGTH = 368K + SRAM2 (rwx) : ORIGIN = 0x2007c000, LENGTH = 16K } OUTPUT_ARCH(arm) @@ -118,7 +120,7 @@ SECTIONS * use the NuttX get_errno_ptr() function. */ __errno = get_errno_ptr; - } > flash + } > FLASH_AXIM /* * Init functions (static constructors and the like) @@ -127,7 +129,7 @@ SECTIONS _sinit = ABSOLUTE(.); KEEP(*(.init_array .init_array.*)) _einit = ABSOLUTE(.); - } > flash + } > FLASH_AXIM /* * Construction data for parameters. @@ -136,16 +138,16 @@ SECTIONS __param_start = ABSOLUTE(.); KEEP(*(__param*)) __param_end = ABSOLUTE(.); - } > flash + } > FLASH_AXIM .ARM.extab : { *(.ARM.extab*) - } > flash + } > FLASH_AXIM __exidx_start = ABSOLUTE(.); .ARM.exidx : { *(.ARM.exidx*) - } > flash + } > FLASH_AXIM __exidx_end = ABSOLUTE(.); _eronly = ABSOLUTE(.); @@ -156,7 +158,7 @@ SECTIONS *(.gnu.linkonce.d.*) CONSTRUCTORS _edata = ABSOLUTE(.); - } > sram1 AT > flash + } > SRAM1 AT > FLASH_AXIM .bss : { _sbss = ABSOLUTE(.); @@ -165,7 +167,7 @@ SECTIONS *(COMMON) . = ALIGN(4); _ebss = ABSOLUTE(.); - } > sram1 + } > SRAM1 /* Stabs debugging sections. */ .stab 0 : { *(.stab) } @@ -180,4 +182,13 @@ SECTIONS .debug_line 0 : { *(.debug_line) } .debug_pubnames 0 : { *(.debug_pubnames) } .debug_aranges 0 : { *(.debug_aranges) } + + .ramfunc : { + _sramfuncs = .; + *(.ramfunc .ramfunc.*) + . = ALIGN(4); + _eramfuncs = .; + } > ITCM_RAM AT > FLASH_AXIM + + _framfuncs = LOADADDR(.ramfunc); } diff --git a/boards/px4/fmu-v5/nuttx-config/scripts/script.ld b/boards/px4/fmu-v5/nuttx-config/scripts/script.ld index fae1d95de0..dcaf04fd2c 100644 --- a/boards/px4/fmu-v5/nuttx-config/scripts/script.ld +++ b/boards/px4/fmu-v5/nuttx-config/scripts/script.ld @@ -71,11 +71,13 @@ MEMORY { - itcm (rwx) : ORIGIN = 0x00208000, LENGTH = 2016K - flash (rx) : ORIGIN = 0x08008000, LENGTH = 2016K - dtcm (rwx) : ORIGIN = 0x20000000, LENGTH = 128K - sram1 (rwx) : ORIGIN = 0x20020000, LENGTH = 368K - sram2 (rwx) : ORIGIN = 0x2007c000, LENGTH = 16K + FLASH_ITCM (rx) : ORIGIN = 0x00208000, LENGTH = 2016K + FLASH_AXIM (rx) : ORIGIN = 0x08008000, LENGTH = 2016K + + ITCM_RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 16K + DTCM_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K + SRAM1 (rwx) : ORIGIN = 0x20020000, LENGTH = 368K + SRAM2 (rwx) : ORIGIN = 0x2007c000, LENGTH = 16K } OUTPUT_ARCH(arm) @@ -118,7 +120,7 @@ SECTIONS * use the NuttX get_errno_ptr() function. */ __errno = get_errno_ptr; - } > flash + } > FLASH_AXIM /* * Init functions (static constructors and the like) @@ -127,7 +129,7 @@ SECTIONS _sinit = ABSOLUTE(.); KEEP(*(.init_array .init_array.*)) _einit = ABSOLUTE(.); - } > flash + } > FLASH_AXIM /* * Construction data for parameters. @@ -136,16 +138,16 @@ SECTIONS __param_start = ABSOLUTE(.); KEEP(*(__param*)) __param_end = ABSOLUTE(.); - } > flash + } > FLASH_AXIM .ARM.extab : { *(.ARM.extab*) - } > flash + } > FLASH_AXIM __exidx_start = ABSOLUTE(.); .ARM.exidx : { *(.ARM.exidx*) - } > flash + } > FLASH_AXIM __exidx_end = ABSOLUTE(.); _eronly = ABSOLUTE(.); @@ -156,7 +158,7 @@ SECTIONS *(.gnu.linkonce.d.*) CONSTRUCTORS _edata = ABSOLUTE(.); - } > sram1 AT > flash + } > SRAM1 AT > FLASH_AXIM .bss : { _sbss = ABSOLUTE(.); @@ -165,7 +167,7 @@ SECTIONS *(COMMON) . = ALIGN(4); _ebss = ABSOLUTE(.); - } > sram1 + } > SRAM1 /* Stabs debugging sections. */ .stab 0 : { *(.stab) } @@ -180,4 +182,13 @@ SECTIONS .debug_line 0 : { *(.debug_line) } .debug_pubnames 0 : { *(.debug_pubnames) } .debug_aranges 0 : { *(.debug_aranges) } + + .ramfunc : { + _sramfuncs = .; + *(.ramfunc .ramfunc.*) + . = ALIGN(4); + _eramfuncs = .; + } > ITCM_RAM AT > FLASH_AXIM + + _framfuncs = LOADADDR(.ramfunc); } diff --git a/boards/px4/fmu-v5x/nuttx-config/scripts/script.ld b/boards/px4/fmu-v5x/nuttx-config/scripts/script.ld index fae1d95de0..dcaf04fd2c 100644 --- a/boards/px4/fmu-v5x/nuttx-config/scripts/script.ld +++ b/boards/px4/fmu-v5x/nuttx-config/scripts/script.ld @@ -71,11 +71,13 @@ MEMORY { - itcm (rwx) : ORIGIN = 0x00208000, LENGTH = 2016K - flash (rx) : ORIGIN = 0x08008000, LENGTH = 2016K - dtcm (rwx) : ORIGIN = 0x20000000, LENGTH = 128K - sram1 (rwx) : ORIGIN = 0x20020000, LENGTH = 368K - sram2 (rwx) : ORIGIN = 0x2007c000, LENGTH = 16K + FLASH_ITCM (rx) : ORIGIN = 0x00208000, LENGTH = 2016K + FLASH_AXIM (rx) : ORIGIN = 0x08008000, LENGTH = 2016K + + ITCM_RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 16K + DTCM_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K + SRAM1 (rwx) : ORIGIN = 0x20020000, LENGTH = 368K + SRAM2 (rwx) : ORIGIN = 0x2007c000, LENGTH = 16K } OUTPUT_ARCH(arm) @@ -118,7 +120,7 @@ SECTIONS * use the NuttX get_errno_ptr() function. */ __errno = get_errno_ptr; - } > flash + } > FLASH_AXIM /* * Init functions (static constructors and the like) @@ -127,7 +129,7 @@ SECTIONS _sinit = ABSOLUTE(.); KEEP(*(.init_array .init_array.*)) _einit = ABSOLUTE(.); - } > flash + } > FLASH_AXIM /* * Construction data for parameters. @@ -136,16 +138,16 @@ SECTIONS __param_start = ABSOLUTE(.); KEEP(*(__param*)) __param_end = ABSOLUTE(.); - } > flash + } > FLASH_AXIM .ARM.extab : { *(.ARM.extab*) - } > flash + } > FLASH_AXIM __exidx_start = ABSOLUTE(.); .ARM.exidx : { *(.ARM.exidx*) - } > flash + } > FLASH_AXIM __exidx_end = ABSOLUTE(.); _eronly = ABSOLUTE(.); @@ -156,7 +158,7 @@ SECTIONS *(.gnu.linkonce.d.*) CONSTRUCTORS _edata = ABSOLUTE(.); - } > sram1 AT > flash + } > SRAM1 AT > FLASH_AXIM .bss : { _sbss = ABSOLUTE(.); @@ -165,7 +167,7 @@ SECTIONS *(COMMON) . = ALIGN(4); _ebss = ABSOLUTE(.); - } > sram1 + } > SRAM1 /* Stabs debugging sections. */ .stab 0 : { *(.stab) } @@ -180,4 +182,13 @@ SECTIONS .debug_line 0 : { *(.debug_line) } .debug_pubnames 0 : { *(.debug_pubnames) } .debug_aranges 0 : { *(.debug_aranges) } + + .ramfunc : { + _sramfuncs = .; + *(.ramfunc .ramfunc.*) + . = ALIGN(4); + _eramfuncs = .; + } > ITCM_RAM AT > FLASH_AXIM + + _framfuncs = LOADADDR(.ramfunc); }