为了使用vfp或者neon,我添加了-mfpu = vfp和-mfloat-abi =我的交叉编译很难.该程序是一个非常简单的hellofloat.cpp,然后使用Sourcery CodeBench Lite 2013.05-24不再编译.
#include <string>
#include <iostream>
using namespace std;
int main()
{
double val=1.04;
cout << "Hello Float: " << val << endl;
}
Run Code Online (Sandbox Code Playgroud)
编译指令:
arm-none-linux-gnueabi-g++ -o armhf-main main.cpp -march=armv7-a -mfloat-abi=hard -mfpu=neon
Run Code Online (Sandbox Code Playgroud)
我很困惑,因为Codesorcery应该支持armhf编译?
错误:
In file included from /home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../arm-none-linux-gnueabi/libc/usr/include/features.h:399:0,
from /home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.3/../../../../arm-none-linux-gnueabi/include/c++/4.7.3/arm-none-linux-gnueabi/bits/os_defines.h:40,
from /home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.3/../../../../arm-none-linux-gnueabi/include/c++/4.7.3/arm-none-linux-gnueabi/bits/c++config.h:414,
from /home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.3/../../../../arm-none-linux-gnueabi/include/c++/4.7.3/string:40,
from main.cpp:1:
/home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../arm-none-linux-gnueabi/libc/usr/include/gnu/stubs.h:10:29: fatal error: gnu/stubs-hard.h: No such file or directory
compilation terminated.
Run Code Online (Sandbox Code Playgroud)
编译器
arm-none-linux-gnueabi-g++ -v
Using built-in specs.
COLLECT_GCC=arm-none-linux-gnueabi-g++
COLLECT_LTO_WRAPPER=/home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.3/lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: /scratch/jbrown/2013.05-arm-linux-release/src/gcc-4.7-2013.05/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads …Run Code Online (Sandbox Code Playgroud) 我创建了两个静态库,用于我正在使用Mentor Graphics CodeSourcery为ARM STM32F4xx处理器编写的C程序.我已将库及其目录添加到项目中的构建设置中,因为我认为它们应该是(在属性,C/C++构建 - >设置 - >工具设置 - >源代码CodeBench C链接器 - >库)但是当我编译并链接项目,我得到一个库中的函数未定义的引用错误.我试过改变库相对于彼此的顺序.我在编辑的日志中包含了一个片段,以清理长路径名.
我在这里完全失去了所以任何帮助表示赞赏.
'Building target: Firmware_Development'
'Invoking: Sourcery CodeBench C Linker'
arm-none-eabi-gcc -L"Libary1-Folder-Path" -L"Library2-Folder-Path" -Xlinker -Map="Firmware_Development.map" -T "firmware-rom-hosted.ld -mcpu=cortex-m4 -mthumb -o "Firmware_Development" "@objs.rsp" "@user_objs.rsp" "@libs.rsp"
src/main.o: In function `program_loop':
\\Debug/../src/main.c:99: undefined reference to `LwIP_Pkt_Handle'
\\Debug/../src/main.c:103: undefined reference to `LwIP_Periodic_Handle'
src/stm32f4xx_it.o: In function `__cs3_isr_exti15_10':
\\Debug/../src/stm32f4xx_it.c:187: undefined reference to `Eth_Link_ITHandler'
src/Config.o: In function `Communication_Init':
\\Debug/../Libraries_Firmware/src/Config.c:175: undefined reference to `ETH_BSP_Config'
\\Debug/../Libraries_Firmware/src/Config.c:178: undefined reference to `LwIP_Init'
collect2.exe: error: ld returned 1 exit status …Run Code Online (Sandbox Code Playgroud) 我试图从以下链接在Ubuntu 10.04 LTS上为ARM安装Sourcery G ++交叉编译器 - > http://www.codesourcery.com/sgpp/lite/arm/portal/release644我没有使用图形界面,因为我得到java.awt错误.在使用控制台安装模式时,我提供了程序询问的所有详细信息.(更改了安装的默认位置)
一段时间进入安装,我收到此错误:
运行内部程序时发生错误.请从"/ home // cross_compiler"中删除工具链.EXITCODE = -1
我不确定是什么原因.我以root用户身份重新编写此进程,但仍然遇到同样的错误.我正在尝试在64位计算机上安装它.
我有两个文件:
lib.c
#include<stdio.h>
void hi() {
printf("Hi i'm a library function in lib.so\n");
}
Run Code Online (Sandbox Code Playgroud)
和main.c
#include<stdio.h>
#include<dlfcn.h>
/* based on Jeff Scudder's code */
int main() {
void *SharedObjectFile;
void (*hi)();
// Load the shared libary;
SharedObjectFile = dlopen("./lib.so", RTLD_LAZY);
// Obtain the address of a function in the shared library.
ciao = dlsym(SharedObjectFile, "hi");
// Use the dynamically loaded function.
(*hi)();
dlclose(SharedObjectFile);
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下命令构建可执行文件:
export LD_LIBRARY_PATH =
pwdgcc -c -fpic lib.c
gcc -shared -lc -o lib.so lib.o
gcc …
我想在我的一个函数中使用标准c函数
void print(const char* format,...) {
char buffer[256];
va_list args;
va_start (args, format);
vsnprintf (buffer,256,format, args);
va_end (args);
sendString(buffer);
}
Run Code Online (Sandbox Code Playgroud)
错误来了
arm-none-eabi-ld -o check.elf -T /home/sanju/Arm/check/other/ROM.ld Serial.o irq.o lowlevel.o main.o startup.o \
-L/usr/arm-none-eabi/lib -lc -lg -lm
/usr/arm-none-eabi/lib/libc.a(lib_a-svfprintf.o): In function `_svfprintf_r':
vfprintf.c:(.text+0x688): undefined reference to `__aeabi_dcmplt'
vfprintf.c:(.text+0xdfc): undefined reference to `__aeabi_dcmpeq'
vfprintf.c:(.text+0x10b4): undefined reference to `__aeabi_dcmpeq'
vfprintf.c:(.text+0x168c): undefined reference to `__aeabi_uldivmod'
vfprintf.c:(.text+0x16a8): undefined reference to `__aeabi_uldivmod'
vfprintf.c:(.text+0x1a48): undefined reference to `__aeabi_dcmpeq'
vfprintf.c:(.text+0x1eac): undefined reference to `__aeabi_dcmpeq'
/usr/arm-none-eabi/lib/libc.a(lib_a-dtoa.o): In function `quorem':
dtoa.c:(.text+0x3c): …Run Code Online (Sandbox Code Playgroud)