如何解决在交叉编译的问题的crt0.o
1个回答
展开全部
如何添加ctr0.o?我得到这个错误:
yagarto-4.7.2/bin/arm-none-eabi-ld: cannot find crt0.o: No such file or directory
collect2: error: ld returned 1 exit status`
离这里很简单的程序:
/* -- first.s */
/* This is a comment */
.global main /* 'main' is our entry point and must be global */
.func main /* 'main' is a function */
main: /* This is main */
mov r0, #2 /* Put a 2 inside the register r0 */
bx lr /* Return from main */
我看这2个线程,并没有得到任何完整的和直截了当的回答: 什么是从背后取下gcc4.7.x的crt0.o的理由? 我有这些文件,什么是CRT0和外箱之间的区别不就可以了?
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/crtbegin.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/crtend.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/crti.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/crtn.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/crtbegin.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/crtend.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/crti.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/crtn.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v6m/crtbegin.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v6m/crtend.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v6m/crti.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v6m/crtn.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v7m/crtbegin.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v7m/crtend.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v7m/crti.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v7m/crtn.o
在SO解决方案给周围的工作不工作了:
arm-none-eabi-gcc -o first assembler_tutorial/chapter01/first.o -nostartfiles
./yagarto-4.7.2/bin/arm-none-eabi-ld: warning: cannot find entry symbol _start; defaulting to 0000000000008000
本文地址 :CodeGo.net/603832/
-------------------------------------------------------------------------------------------------------------------------
1. vectors.s
.globl _start
_start:
mov sp,#0x8000
bl main
hang: b hang
main.s
.globl main
main:
mov r0,#2
bx lr
MEMMAP(链接脚本)
MEMORY
{
ram : ORIGIN = 0x8000, LENGTH = 0x10000
}
SECTIONS
{
.text : { *(.text*) } > ram
.bss : { *(.bss*) } > ram
}
命令
arm-none-eabi-as vectors.s -o vectors.o
arm-none-eabi-as main.s -o main.o
arm-none-eabi-ld vectors.o main.o -T memmap -o main.elf
arm-none-eabi-objdump -D main.elf > main.list
arm-none-eabi-objcopy main.elf -O binary main.bin
结果
main.elf: file format elf32-littlearm
Disassembly of section .text:
00008000 <_start>:
8000: e3a0d902 mov sp, #32768 ; 0x8000
8004: eb000000 bl 800c <main>
00008008 <hang>:
8008: eafffffe b 8008 <hang>
0000800c <main>:
800c: e3a00002 mov r0, #2
8010: e12fff1e bx lr
如果你想,而不是ASM主C,则 main.c中
int main ( void )
{
return(2);
}
命令
arm-none-eabi-as vectors.s -o vectors.o
arm-none-eabi-gcc -Wall -Werror -O2 -nostdlib -nostartfiles -ffreestanding -c main.c -o main.o
arm-none-eabi-ld vectors.o main.o -T memmap -o main.elf
arm-none-eabi-objdump -D main.elf > main.list
arm-none-eabi-objcopy main.elf -O binary main.bin
结果
main.elf: file format elf32-littlearm
Disassembly of section .text:
00008000 <_start>:
8000: e3a0d902 mov sp, #32768 ; 0x8000
8004: eb000000 bl 800c <main>
00008008 <hang>:
8008: eafffffe b 8008 <hang>
0000800c <main>:
800c: e3a00002 mov r0, #2
8010: e12fff1e bx lr
我更喜欢其他的函数不是主要的编译器添加额外的行李,当他们看到那个函数 vectors.s
.globl _start
_start:
mov sp,#0x8000
bl notmain
hang: b hang
main.c中
int notmain ( void )
{
return(2);
}
结果
main.elf: file format elf32-littlearm
Disassembly of section .text:
00008000 <_start>:
8000: e3a0d902 mov sp, #32768 ; 0x8000
8004: eb000000 bl 800c <notmain>
00008008 <hang>:
8008: eafffffe b 8008 <hang>
0000800c <notmain>:
800c: e3a00002 mov r0, #2
8010: e12fff1e bx lr
yagarto-4.7.2/bin/arm-none-eabi-ld: cannot find crt0.o: No such file or directory
collect2: error: ld returned 1 exit status`
离这里很简单的程序:
/* -- first.s */
/* This is a comment */
.global main /* 'main' is our entry point and must be global */
.func main /* 'main' is a function */
main: /* This is main */
mov r0, #2 /* Put a 2 inside the register r0 */
bx lr /* Return from main */
我看这2个线程,并没有得到任何完整的和直截了当的回答: 什么是从背后取下gcc4.7.x的crt0.o的理由? 我有这些文件,什么是CRT0和外箱之间的区别不就可以了?
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/crtbegin.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/crtend.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/crti.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/crtn.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/crtbegin.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/crtend.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/crti.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/crtn.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v6m/crtbegin.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v6m/crtend.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v6m/crti.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v6m/crtn.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v7m/crtbegin.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v7m/crtend.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v7m/crti.o
./yagarto-4.7.2/lib/gcc/arm-none-eabi/4.7.2/thumb/v7m/crtn.o
在SO解决方案给周围的工作不工作了:
arm-none-eabi-gcc -o first assembler_tutorial/chapter01/first.o -nostartfiles
./yagarto-4.7.2/bin/arm-none-eabi-ld: warning: cannot find entry symbol _start; defaulting to 0000000000008000
本文地址 :CodeGo.net/603832/
-------------------------------------------------------------------------------------------------------------------------
1. vectors.s
.globl _start
_start:
mov sp,#0x8000
bl main
hang: b hang
main.s
.globl main
main:
mov r0,#2
bx lr
MEMMAP(链接脚本)
MEMORY
{
ram : ORIGIN = 0x8000, LENGTH = 0x10000
}
SECTIONS
{
.text : { *(.text*) } > ram
.bss : { *(.bss*) } > ram
}
命令
arm-none-eabi-as vectors.s -o vectors.o
arm-none-eabi-as main.s -o main.o
arm-none-eabi-ld vectors.o main.o -T memmap -o main.elf
arm-none-eabi-objdump -D main.elf > main.list
arm-none-eabi-objcopy main.elf -O binary main.bin
结果
main.elf: file format elf32-littlearm
Disassembly of section .text:
00008000 <_start>:
8000: e3a0d902 mov sp, #32768 ; 0x8000
8004: eb000000 bl 800c <main>
00008008 <hang>:
8008: eafffffe b 8008 <hang>
0000800c <main>:
800c: e3a00002 mov r0, #2
8010: e12fff1e bx lr
如果你想,而不是ASM主C,则 main.c中
int main ( void )
{
return(2);
}
命令
arm-none-eabi-as vectors.s -o vectors.o
arm-none-eabi-gcc -Wall -Werror -O2 -nostdlib -nostartfiles -ffreestanding -c main.c -o main.o
arm-none-eabi-ld vectors.o main.o -T memmap -o main.elf
arm-none-eabi-objdump -D main.elf > main.list
arm-none-eabi-objcopy main.elf -O binary main.bin
结果
main.elf: file format elf32-littlearm
Disassembly of section .text:
00008000 <_start>:
8000: e3a0d902 mov sp, #32768 ; 0x8000
8004: eb000000 bl 800c <main>
00008008 <hang>:
8008: eafffffe b 8008 <hang>
0000800c <main>:
800c: e3a00002 mov r0, #2
8010: e12fff1e bx lr
我更喜欢其他的函数不是主要的编译器添加额外的行李,当他们看到那个函数 vectors.s
.globl _start
_start:
mov sp,#0x8000
bl notmain
hang: b hang
main.c中
int notmain ( void )
{
return(2);
}
结果
main.elf: file format elf32-littlearm
Disassembly of section .text:
00008000 <_start>:
8000: e3a0d902 mov sp, #32768 ; 0x8000
8004: eb000000 bl 800c <notmain>
00008008 <hang>:
8008: eafffffe b 8008 <hang>
0000800c <notmain>:
800c: e3a00002 mov r0, #2
8010: e12fff1e bx lr
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询