Browse Source

[libcpu] fix symbol of kernel entry point (#8159)

Signed-off-by: Shell <smokewood@qq.com>
Shell 1 năm trước cách đây
mục cha
commit
07b23ecbb1

+ 1 - 1
bsp/qemu-virt64-aarch64/rtconfig.py

@@ -30,7 +30,7 @@ if PLATFORM == 'gcc':
     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 + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,system_vectors -T link.lds' + ' -lsupc++ -lgcc -static'
+    LFLAGS  = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,system_vectors -T link.lds' + ' -lsupc++ -lgcc -static'
     CPATH   = ''
     LPATH   = ''
 

+ 2 - 0
libcpu/aarch64/SConscript

@@ -12,6 +12,8 @@ bsp_path = Dir('#').abspath
 
 if not os.path.exists(bsp_path + "/link.lds"):
     Env['LINKFLAGS'] = Env['LINKFLAGS'].replace('link.lds', cwd + "/link.lds")
+    # fix the linker with crtx.o
+    Env['LINKFLAGS'] += ' -nostartfiles'
     Preprocessing("link.lds.S", ".lds", CPPPATH=[bsp_path])
 
 # add common code files

+ 2 - 2
libcpu/aarch64/common/mmu.c

@@ -803,8 +803,8 @@ void rt_hw_mem_setup_early(unsigned long *tbl0, unsigned long *tbl1,
 #ifdef RT_USING_SMART
     unsigned long va = KERNEL_VADDR_START;
 #else
-    extern unsigned char __start;
-    unsigned long va = (unsigned long) &__start;
+    extern unsigned char _start;
+    unsigned long va = (unsigned long) &_start;
     va = RT_ALIGN_DOWN(va, 0x200000);
 #endif
 

+ 4 - 4
libcpu/aarch64/cortex-a/entry_point.S

@@ -38,8 +38,8 @@ boot_arg1 .req x23
 boot_arg2 .req x24
 stack_top .req x25
 
-.global __start
-__start:
+.global _start
+_start:
 /*
  * Boot CPU general-purpose register settings:
  *   x0 = physical address of device tree blob (dtb) in system RAM.
@@ -165,8 +165,8 @@ __start:
     dsb sy
 
 #ifdef RT_USING_SMART
-    ldr     x2, =__start
-    GET_PHY x3, __start
+    ldr     x2, =_start
+    GET_PHY x3, _start
     sub     x3, x3, x2
 #else
     mov     x3,0