codesourcery

Error during Cross-compiling C code with Dynamic libraries

自作多情 提交于 2019-12-28 06:39:27
问题 I've two files: lib.c #include<stdio.h> void hi() { printf("Hi i'm a library function in lib.so\n"); } and 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); } And I've

Anyway to see list of preprocessor defined macros?

巧了我就是萌 提交于 2019-12-12 08:26:55
问题 I'd like to see all macros that are defined by the invocation of the compiler I'm using. Is there any way to do this? I have seen in the manual it says you can use cpp -dM but this doesn't work for me. Perhaps I'm doing something wrong? When I run: cpp -dM I get no output at all from the preprocessor. If I try adding -dM as an option on gcc, I don't notice any difference. 回答1: You can use: gcc -dM -E - < /dev/null Note that you can also get the compiler macros in addition with this command:

Is codesourcery ARM Toolchain available for 64bit windows?

一个人想着一个人 提交于 2019-12-12 05:15:21
问题 I am currently using the 32 bit codesourcery ARM toolchain for the 32 bit Windows. It's working fine, however I want to know whether a 64 bit codesourcery ARM toolchain is available? 回答1: Sourcery CodeBench is a 32-bit application, but runs on 64-bit host systems with 32-bit host libraries. The information comes from the bottom of the web pages for specific target platforms. Here's the page for ARM GNU/Linux targets: http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench

Arm sourcery toolchain linking error

喜欢而已 提交于 2019-12-11 04:01:10
问题 I want to use standard c function in one of my function 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); } Error coming is 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):

GCC C++ (ARM) and const pointer to struct field

淺唱寂寞╮ 提交于 2019-12-10 08:09:15
问题 Let's say there is a simple test code typedef struct { int first; int second; int third; } type_t; #define ADDRESS 0x12345678 #define REGISTER ((type_t*)ADDRESS) const int data = (int)(&REGISTER->second)*2; int main(void) { volatile int data_copy; data_copy = data; while(1) {}; } Which is compiled in CodeSourcery G++ (gcc 4.3.2) for bare metal ARM. It also has a very standard linker script. When compiled in C (as main.c) the object "data" goes into Flash, as expected. When compiled in C++ (as

GCC arm-none-eabi (Codesourcery) and C++ Exceptions

女生的网名这么多〃 提交于 2019-12-06 01:58:14
问题 I am using Raisonance's Ride7/Codesourcery (a.k.a Sourcery CodeBench Lite) with an STM32F4 board developing a bare metal HMI platform. I will be making use of C++ exceptions in this system, but any exception I throw ends with a "Terminate called recursively" error written to stderr. Code to reproduce the problem: (main.cpp) int main(void) { try { throw 1; } catch (...) { printf("caught"); } } I've already tried Raisonance and other sources for a resolution, and have not received any

GCC C++ (ARM) and const pointer to struct field

自作多情 提交于 2019-12-05 15:59:28
Let's say there is a simple test code typedef struct { int first; int second; int third; } type_t; #define ADDRESS 0x12345678 #define REGISTER ((type_t*)ADDRESS) const int data = (int)(&REGISTER->second)*2; int main(void) { volatile int data_copy; data_copy = data; while(1) {}; } Which is compiled in CodeSourcery G++ (gcc 4.3.2) for bare metal ARM. It also has a very standard linker script. When compiled in C (as main.c) the object "data" goes into Flash, as expected. When compiled in C++ (as main.cpp) this object goes into RAM, and additional code is added which does nothing more than copy

Cross-Compiling Armadillo Linear Algebra Library

不羁的心 提交于 2019-12-04 13:12:11
问题 I enjoy using the Armadillo Linear Algebra Library. It becomes extremely nice when porting octave .m files over to C++, especially when you have to use the eigen methods. However I ran into issues when I had to take my program from my native vanilla G++ and dump it onto my ARM processor. Since I spent a few hours muddling my way though it I wanted to share so others might avoid some frustration. If anyone else could add anything else I would love it. This was the process I used to tackle this

Cross-Compiling for RaspBerry Pi

淺唱寂寞╮ 提交于 2019-12-03 09:08:27
问题 With a RaspBerry Pi and from my computer, I'm trying to cross-compile a simple helloWorld written in C++. I'm using Code Sourcery toolchain for linux to compile. When copy the helloWorld binary to raspBerry by TFTP and give it execution permissions with chmod, the next error appears: "Illegal instruction" If make a 'file' over binary I get: "raspberry: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, stripped" This is because I used "-static -static-libstdc++" when linking

set global gcc default search paths

萝らか妹 提交于 2019-12-03 06:04:54
问题 when running arm-none-linux-gnueabi-gcc -print-search-dirs | grep libraries | sed 's/:/\n/g' I get the following output: libraries =/opt/codesourcery/lib/gcc/arm-none-linux-gnueabi/4.4.1/ /opt/codesourcery/lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/lib/arm-none-linux-gnueabi/4.4.1/ /opt/codesourcery/lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/lib/ /opt/codesourcery/arm-none-linux-gnueabi/libc/lib/arm-none-linux-gnueabi/4.4.1/ /opt