summaryrefslogtreecommitdiff
path: root/bsp
diff options
context:
space:
mode:
authorGUI <[email protected]>2023-07-25 21:31:44 +0800
committerGitHub <[email protected]>2023-07-25 21:31:44 +0800
commit6f119d4ce90a1a4f3b491f21d50a286662f79480 (patch)
tree1e1c2824aa04cabe193a43304b21469caadd2924 /bsp
parentef91876ee71a63208aec706147a68f60eae8a2fe (diff)
AArch64: support public linker scripts (#7831)
Signed-off-by: GuEe-GUI <[email protected]>
Diffstat (limited to 'bsp')
-rw-r--r--bsp/qemu-virt64-aarch64/.config8
-rw-r--r--bsp/qemu-virt64-aarch64/SConstruct4
-rw-r--r--bsp/qemu-virt64-aarch64/link.lds109
-rw-r--r--bsp/qemu-virt64-aarch64/link_smart.lds109
-rw-r--r--bsp/qemu-virt64-aarch64/rtconfig.h7
-rw-r--r--bsp/qemu-virt64-aarch64/rtconfig.py4
6 files changed, 18 insertions, 223 deletions
diff --git a/bsp/qemu-virt64-aarch64/.config b/bsp/qemu-virt64-aarch64/.config
index 44f181b385..1b1516ad60 100644
--- a/bsp/qemu-virt64-aarch64/.config
+++ b/bsp/qemu-virt64-aarch64/.config
@@ -94,6 +94,10 @@ CONFIG_RT_CONSOLEBUF_SIZE=256
CONFIG_RT_CONSOLE_DEVICE_NAME="uart0"
CONFIG_RT_VER_NUM=0x50001
CONFIG_RT_USING_STDC_ATOMIC=y
+
+#
+# RT-Thread Architecture
+#
CONFIG_ARCH_CPU_64BIT=y
CONFIG_RT_USING_CACHE=y
# CONFIG_RT_USING_HW_ATOMIC is not set
@@ -104,6 +108,10 @@ CONFIG_ARCH_MM_MMU=y
CONFIG_ARCH_ARM=y
CONFIG_ARCH_ARM_MMU=y
CONFIG_ARCH_ARMV8=y
+CONFIG_ARCH_TEXT_OFFSET=0x80000
+CONFIG_ARCH_RAM_OFFSET=0x40000000
+CONFIG_ARCH_SECONDARY_CPU_STACK_SIZE=4096
+CONFIG_ARCH_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
#
# RT-Thread Components
diff --git a/bsp/qemu-virt64-aarch64/SConstruct b/bsp/qemu-virt64-aarch64/SConstruct
index 70cd98c4f4..3791a1bfac 100644
--- a/bsp/qemu-virt64-aarch64/SConstruct
+++ b/bsp/qemu-virt64-aarch64/SConstruct
@@ -40,9 +40,5 @@ Export('rtconfig')
# prepare building environment
objs = PrepareBuilding(env, RTT_ROOT)
-if GetDepend('RT_USING_SMART'):
- # use smart link.lds
- env['LINKFLAGS'] = env['LINKFLAGS'].replace('link.lds', 'link_smart.lds')
-
# make a building
DoBuilding(TARGET, objs)
diff --git a/bsp/qemu-virt64-aarch64/link.lds b/bsp/qemu-virt64-aarch64/link.lds
deleted file mode 100644
index 3adad6e44c..0000000000
--- a/bsp/qemu-virt64-aarch64/link.lds
+++ /dev/null
@@ -1,109 +0,0 @@
-OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
-OUTPUT_ARCH(aarch64)
-SECTIONS
-{
- . = 0x40080000;
- /* . = 0xffff000000080000; */
-
- __text_start = .;
- .text :
- {
- KEEP(*(.text.entrypoint))
- KEEP(*(.vectors))
- *(.text)
- *(.text.*)
-
- /* section information for utest */
- . = ALIGN(8);
- __rt_utest_tc_tab_start = .;
- KEEP(*(UtestTcTab))
- __rt_utest_tc_tab_end = .;
-
- /* section information for finsh shell */
- . = ALIGN(8);
- __fsymtab_start = .;
- KEEP(*(FSymTab))
- __fsymtab_end = .;
- . = ALIGN(8);
- __vsymtab_start = .;
- KEEP(*(VSymTab))
- __vsymtab_end = .;
- . = ALIGN(8);
-
- /* section information for modules */
- . = ALIGN(8);
- __rtmsymtab_start = .;
- KEEP(*(RTMSymTab))
- __rtmsymtab_end = .;
-
- /* section information for initialization */
- . = ALIGN(8);
- __rt_init_start = .;
- KEEP(*(SORT(.rti_fn*)))
- __rt_init_end = .;
- } =0
- __text_end = .;
-
- .ARM.exidx :
- {
- __exidx_start = .;
- *(.ARM.exidx* .gnu.linkonce.armexidx.*)
- __exidx_end = .;
- }
-
- __rodata_start = .;
- .rodata : { *(.rodata) *(.rodata.*) }
- __rodata_end = .;
-
- . = ALIGN(8);
- .ctors :
- {
- PROVIDE(__ctors_start__ = .);
- KEEP(*(SORT(.init_array.*)))
- KEEP(*(.init_array))
- PROVIDE(__ctors_end__ = .);
- }
-
- .dtors :
- {
- PROVIDE(__dtors_start__ = .);
- KEEP(*(SORT(.fini_array.*)))
- KEEP(*(.fini_array))
- PROVIDE(__dtors_end__ = .);
- }
-
- . = ALIGN(8);
- __data_start = .;
- .data :
- {
- *(.data)
- *(.data.*)
- }
- __data_end = .;
-
- . = ALIGN(8);
- __bss_start = .;
- .bss :
- {
- *(.bss)
- *(.bss.*)
- *(COMMON)
- . = ALIGN(8);
- }
- . = ALIGN(8);
- __bss_end = .;
-
- /* Stabs debugging sections. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- .stab.excl 0 : { *(.stab.excl) }
- .stab.exclstr 0 : { *(.stab.exclstr) }
- .stab.index 0 : { *(.stab.index) }
- .stab.indexstr 0 : { *(.stab.indexstr) }
- .comment 0 : { *(.comment) }
-
- __data_size = SIZEOF(.data);
- __bss_size = SIZEOF(.bss);
-
- _end = .;
-}
diff --git a/bsp/qemu-virt64-aarch64/link_smart.lds b/bsp/qemu-virt64-aarch64/link_smart.lds
deleted file mode 100644
index 3df5a76afc..0000000000
--- a/bsp/qemu-virt64-aarch64/link_smart.lds
+++ /dev/null
@@ -1,109 +0,0 @@
-OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
-OUTPUT_ARCH(aarch64)
-SECTIONS
-{
- /* . = 0x40080000; */
- . = 0xffff000000080000;
-
- __text_start = .;
- .text :
- {
- KEEP(*(.text.entrypoint))
- KEEP(*(.vectors))
- *(.text)
- *(.text.*)
-
- /* section information for utest */
- . = ALIGN(8);
- __rt_utest_tc_tab_start = .;
- KEEP(*(UtestTcTab))
- __rt_utest_tc_tab_end = .;
-
- /* section information for finsh shell */
- . = ALIGN(8);
- __fsymtab_start = .;
- KEEP(*(FSymTab))
- __fsymtab_end = .;
- . = ALIGN(8);
- __vsymtab_start = .;
- KEEP(*(VSymTab))
- __vsymtab_end = .;
- . = ALIGN(8);
-
- /* section information for modules */
- . = ALIGN(8);
- __rtmsymtab_start = .;
- KEEP(*(RTMSymTab))
- __rtmsymtab_end = .;
-
- /* section information for initialization */
- . = ALIGN(8);
- __rt_init_start = .;
- KEEP(*(SORT(.rti_fn*)))
- __rt_init_end = .;
- } =0
- __text_end = .;
-
- .ARM.exidx :
- {
- __exidx_start = .;
- *(.ARM.exidx* .gnu.linkonce.armexidx.*)
- __exidx_end = .;
- }
-
- __rodata_start = .;
- .rodata : { *(.rodata) *(.rodata.*) }
- __rodata_end = .;
-
- . = ALIGN(8);
- .ctors :
- {
- PROVIDE(__ctors_start__ = .);
- KEEP(*(SORT(.init_array.*)))
- KEEP(*(.init_array))
- PROVIDE(__ctors_end__ = .);
- }
-
- .dtors :
- {
- PROVIDE(__dtors_start__ = .);
- KEEP(*(SORT(.fini_array.*)))
- KEEP(*(.fini_array))
- PROVIDE(__dtors_end__ = .);
- }
-
- . = ALIGN(8);
- __data_start = .;
- .data :
- {
- *(.data)
- *(.data.*)
- }
- __data_end = .;
-
- . = ALIGN(8);
- __bss_start = .;
- .bss :
- {
- *(.bss)
- *(.bss.*)
- *(COMMON)
- . = ALIGN(8);
- }
- . = ALIGN(8);
- __bss_end = .;
-
- /* Stabs debugging sections. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- .stab.excl 0 : { *(.stab.excl) }
- .stab.exclstr 0 : { *(.stab.exclstr) }
- .stab.index 0 : { *(.stab.index) }
- .stab.indexstr 0 : { *(.stab.indexstr) }
- .comment 0 : { *(.comment) }
-
- __data_size = SIZEOF(.data);
- __bss_size = SIZEOF(.bss);
-
- _end = .;
-}
diff --git a/bsp/qemu-virt64-aarch64/rtconfig.h b/bsp/qemu-virt64-aarch64/rtconfig.h
index 5b71c996f6..205d642927 100644
--- a/bsp/qemu-virt64-aarch64/rtconfig.h
+++ b/bsp/qemu-virt64-aarch64/rtconfig.h
@@ -61,12 +61,19 @@
#define RT_CONSOLE_DEVICE_NAME "uart0"
#define RT_VER_NUM 0x50001
#define RT_USING_STDC_ATOMIC
+
+/* RT-Thread Architecture */
+
#define ARCH_CPU_64BIT
#define RT_USING_CACHE
#define ARCH_MM_MMU
#define ARCH_ARM
#define ARCH_ARM_MMU
#define ARCH_ARMV8
+#define ARCH_TEXT_OFFSET 0x80000
+#define ARCH_RAM_OFFSET 0x40000000
+#define ARCH_SECONDARY_CPU_STACK_SIZE 4096
+#define ARCH_HAVE_EFFICIENT_UNALIGNED_ACCESS
/* RT-Thread Components */
diff --git a/bsp/qemu-virt64-aarch64/rtconfig.py b/bsp/qemu-virt64-aarch64/rtconfig.py
index dd6cbdc4a7..98d1a38cec 100644
--- a/bsp/qemu-virt64-aarch64/rtconfig.py
+++ b/bsp/qemu-virt64-aarch64/rtconfig.py
@@ -13,6 +13,7 @@ if PLATFORM == 'gcc':
PREFIX = os.getenv('RTT_CC_PREFIX') or 'aarch64-none-elf-'
CC = PREFIX + 'gcc'
CXX = PREFIX + 'g++'
+ CPP = PREFIX + 'cpp'
AS = PREFIX + 'gcc'
AR = PREFIX + 'ar'
LINK = PREFIX + 'gcc'
@@ -25,10 +26,11 @@ if PLATFORM == 'gcc':
AFPFLAGS = ' '
DEVICE = ' -march=armv8-a -mtune=cortex-a53 -ftree-vectorize -ffast-math -funwind-tables -fno-strict-aliasing'
+ CPPFLAGS= ' -E -P -x assembler-with-cpp'
CXXFLAGS= DEVICE + CFPFLAGS + ' -Wall -fdiagnostics-color=always'
CFLAGS = DEVICE + CFPFLAGS + ' -Wall -Wno-cpp -std=gnu99 -fdiagnostics-color=always'
AFLAGS = ' -c' + AFPFLAGS + ' -x assembler-with-cpp'
- LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,system_vectors -T link.lds' + ' -lsupc++ -lgcc -static'
+ LFLAGS = DEVICE + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,system_vectors -T link.lds' + ' -lsupc++ -lgcc -static'
CPATH = ''
LPATH = ''