参考链接: https://whycan.cn/t_1017.html#p4914
pighead 说:这个问题也浪费了我几个小时,后来拿云盘上给的那个rootfs来对比,才发现:
1. arm-linux-gnueabi 这个工具链用来编译内核没有问题,编译应用则会出现问题;2. 编译应用的问题,是因为工具链所附加的库,是面向Cortex A7来编译的;因为假如只编译,不链接: arm-linux-gnueabi-gcc -Q -v -c -mcpu=arm926ej-s hello.c ,然后用readelf -A hello.o,会发现:Tag_CPU_name: "ARM926EJ-S";但只要链接了库,就成了:Tag_CPU_name: "7-A"
3. 解决方法,重新编译工具链,使得它附带的库是用于ARM926EJ-S的,方法是:
https://briolidz.wordpress.com/2012/02/07/building-embedded-arm-systems-with-crosstool-ng/
http://unisim-vp.org/site/crosstool-arm-926ejs-linux-gnueabi-how-to.html4. 之后再使用编译出来的external toolchain,也是完全OK的。
看看是否是这个问题?
谢谢晕哥,我试试
]]>这个问题也浪费了我几个小时,后来拿云盘上给的那个rootfs来对比,才发现:
1. arm-linux-gnueabi 这个工具链用来编译内核没有问题,编译应用则会出现问题;2. 编译应用的问题,是因为工具链所附加的库,是面向Cortex A7来编译的;因为假如只编译,不链接: arm-linux-gnueabi-gcc -Q -v -c -mcpu=arm926ej-s hello.c ,然后用readelf -A hello.o,会发现:Tag_CPU_name: "ARM926EJ-S";但只要链接了库,就成了:Tag_CPU_name: "7-A"
3. 解决方法,重新编译工具链,使得它附带的库是用于ARM926EJ-S的,方法是:
https://briolidz.wordpress.com/2012/02/07/building-embedded-arm-systems-with-crosstool-ng/
http://unisim-vp.org/site/crosstool-arm-926ejs-linux-gnueabi-how-to.html4. 之后再使用编译出来的external toolchain,也是完全OK的。
看看是否是这个问题?
]]>你是裸奔还是在Linux上跑的?
linux,用的7.2.1的arm-linux-gnueabi- 以为是版本问题,就把uboot、rootfs、zImage全编译成这个版本,结果还是一样。抓狂
]]>Building target: helloworld
Invoking: Cross GCC Linker
arm-linux-gnueabi-gcc -o "helloworld" ./main/helloworld.o
Finished building target: helloworld
13:25:18 Build Finished. 0 errors, 0 warnings. (took 1s.877ms)
<code>
#include <stdio.h>
#include <stdlib.h>
int main(void) {
printf("!!!Hello World!!!\r\n"); /* prints !!!Hello World!!! */
return EXIT_SUCCESS;
}
</code>