I'm not entirely sure if this belongs here or on electronics.stackexchange.com, but since this is to do with IDE setup, and compilation, I believe this is the best place to ask my question.
I've got a C project setup in Eclipse CDT. It uses the Sourcery CodeBench Lite ARM toolchain from Mentor Graphics. I've got the Eclipse CDT, as well as GNU ARM Eclipse plugins installed, and trying to setup the ST.com STM32F4 Discovery examples to compile in Eclipse CDT.
When compiling, the compiler is outputting over 200 errors (shortened for brevity):
.../main.c:75: undefined reference to `STM_EVAL_PBInit'
.../main.c:77: undefined reference to `STM_EVAL_LEDInit'
.../main.c:78: undefined reference to `STM_EVAL_LEDInit'
.../main.c:79: undefined reference to `STM_EVAL_LEDInit'
.../main.c:80: undefined reference to `STM_EVAL_LEDInit'
.../main.c:83: undefined reference to `RCC_GetClocksFreq'
.../main.c:86: undefined reference to `STM_EVAL_PBGetState'
.../main.c:89: undefined reference to `STM_EVAL_LEDOn'
.../main.c:90: undefined reference to `STM_EVAL_LEDOn'
.../main.c:91: undefined reference to `STM_EVAL_LEDOn'
.../main.c:92: undefined reference to `STM_EVAL_LEDOn'
Nearly all these items are defined in stm32f4_discovery.h, but for some reason, they are not being resolved during compilation.
I've checked, and double checked that the file is made available C/C++ General > Paths and Symbols, Includes tab, but not sure why things aren't working out.
The project is available on GitHub, for anyone wanting to checkout and try the compilation themselves.
I also created a ticket on Github, as I didn't want to flood here with output information.
Simply clone https://github.com/josefvanniekerk/stm32f4-discovery.git, import stm32f4-discovery/projects/demonstration into Eclipse CDT, and try the compilation.
The Sourcery CodeBench Lite toolchain is compiled on Mac OS X from arm-cs-tools-build.sh, and the Eclipse GNU ARM plugin is required, and can be installed into Eclipse using their update site
Turns out I just needed to add the external sources under
C/C++ General > Paths and Symbols > Source Location
Still some errors, but not relating to this question anymore. :)
Related
I'm new to Eclipse environment and I'm trying to write a C program in Eclipse installed in Windows 10. Compiler I use is MinGW latest version installed through MSYS2. The program I've written has got regular expressions used in it. When I try to build the code, I get the following errors-
21: undefined reference to regcomp'
35: undefined reference toregexec'
enter image description here
Can anyone help me resolve this issue??
If you have #include <regex.h> in your code and it compiles then it looks like you have the library installed.
But undefined reference to 'regexec' is a linker error, which means you're not linking with the library that you are calling functions of.
So you need to link with this library, probably by adding the linker flag -lregex.
I need to use the GSL library in my program on LPCXpresso 4367(ARM CORTEX M4). I tried to follow the library linking procedure for LPC xpresso but the MCU linker is giving me these errors:
MCUXpressoIDE_10.3.0_2200\workspace\test1\Debug/../src/test1.c:53: undefined reference to 'gsl_linalg_LU_decomp'
MCUXpressoIDE_10.3.0_2200\workspace\test1\Debug/../src/test1.c:56: undefined reference to 'gsl_matrix_alloc'
MCUXpressoIDE_10.3.0_2200\workspace\test1\Debug/../src/test1.c:57: undefined reference to 'gsl_linalg_LU_invert'
and so on for other functions as well.
I have the libgsl.a and libgslcblas.a precompiled libraries for windows which works perfectly on codeblocks on windows with GCC compiler.
I read that I need to crosscompile library for the arm-none-eabi-gcc toolchain. But can someone please provide me the procedure as well?
the libgsl.a and libgslcblas.a precompiled libraries for windows
Those won't do for ARM.
In order to work on another platform, these libs need to be compiled from source code with the proper compiler (and settings - Cortex-M4F requires Thumb2 instruction set).
As the libraries are precompiled for Windows they don't work for ARM (as it is said in the other answer)
You need to cross compile the libraries first. If you install the GSL libraries following this procedure, you only need to change the parameters in the ./config according to your platform, for example I used:
./config --host=arm-linux-gnueabihf --prefix=/home/yourname/gsl_arm
Inside the .zip file with the gsl-2.5 files, there is a file called INSTALL. There you can find more details on the options for cross compiling.
Make sure to make clean before if you have already compiled the library for different settings. After cross-compiling the library when you run make check on the terminal you will probably get errors, but still it works. Continue with make install and you are ready to use it.
I'm interested in compiling the sourceforge project https://svn.code.sf.net/p/archopen/code/ArchOpen/trunk/, and more especifically the app AOnes, which is a NES emulator for Archos Gmini 400 (Inactive old project)
Analyzing the source code, I saw that the Gmini400 is an arm7tdmi device, no MMU and the toolchain used to compile was a buildroot one named arm-linux-nofpu.
I supposed (according to the buildroot-2009-02 menuconfig) that no-fpu means soft floating point, so i tried to build such a toolchain.
I build a toolchain with buildroot-2013-02 (both year 2009 and 2010 don't work for me) with the following options:
arm7tdmi
no MMU
Software Floating Point
Enable elf2flt support (i saw there were such a reference in the
Makefile of ArchOpen)
I let the other options as they were and made the build.
I made a checkout of ArchOpen, launch the configuration script to choose Gmini4XX as the target (and not Gmini 402 chich is quite different), selected to defaut.rules and edit the resulting Makefile.conf to adapt the tools paths and names (as my generated toolchain name is different)
First error:
[thread.o]
{standard input}: Assembler messages:
{standard input}:1236: Error: Rn must not overlap other operand -- swpb r0,r3,[r0]
Well, this code is supposed to be working, but i opened thread.h and corrected the source to pass through (adding a "&")
Second error:
undefined reference to __aeabi_idivmod and undefined reference to __aeabi_ldivmod
As google says, it seems to be a -lgcc missing problem.
I edited the wav folder makefile to add -lgcc and specified -L/lib_folder_of_my_toolchain_containing_libgcc.a
Third error:
in gcc/config/arm/lib1funcs.asm : multiple definition of __divsi3
in gcc/config/arm/lib1funcs.asm : undefined reference to raise
in libgcc.a (some .o inside) : undefined reference to __aeabi_unwind_cpp_pr0
I've no idea to solve this...
Does anyone have an idea? Does anyone can help me to get a working arm7 toolchain compatible with this archopen code?
Thanks!
Well, in this particular case, back to 2005 was a good solution...
With a ubuntu 5.04, buildroot has been built with the defaut generic ARM (little endian) configuration, except for the following options:
GCC 3.3.5
No use the daily uClibc snapshot
The processor has no MMU
No support large file
Use softfloat by default
No install busybox (as I only wanted the toolchain)
No create an Ext2 filesystem (same reason than above)
The build fail just after having compiled the last GCC phase. At this point, add the buildroot/build_arm_nofpu/staging_dir/bin in the PATH env. variable, download the libfloat source (libfloat-990616.orig.tar.bz2) tarball, edit the Makefile changing gcc, ld and as repectively by arm-linux-uclibc-gcc, arm-linux-uclibc-ld and arm-linux-uclibc-as and build libfloat (make clean & make). Copy libfloat.a into buildroot/build_arm_nofpu/staging_dir/lib and run the buildroot make again (without cleaning). The build should end successfully. With this toolchain, mediOS will compile without any warning.
I've been trying to run the code from https://github.com/dungtn/mpi-floyd/blob/master/floyd2d.c in my system. I'm using CodeBlocks IDE and MS-Mpi. When I try to compile the code, it says undefined reference to MPI_file_seek#12. Does this mean MS mpi does not support this function or why does this happen?
This usually happens if you are trying to link 32-bit code with 64-bit libraries. The fact that the unresolved symbol has #12 in its name means that the compiler is expecting that MPI_File_seek is an stdcall function. stdcall is mainly used for DLL functions and only on x86 (x64 uses a different calling convention similar to fastcall). If you are linking against the 64-bit import library of MS-MPI, the decorated symbol won't be found in the library and such an error will occur.
Double check what version of MS-MPI you have and also your project settings and make sure that both have the same "bitness".
Change the project settings in Code::Blocks to a C project (rather than C++ project, what you have currently). It may be easier to create a brand new C project and import the file there. Double check that Code::Blocks in running gcc and not g++ to compile your code (floyd2d.c).
If it still doesn't work, please post the full compiler and linker output of Code::Blocks, including the commands run and their output messages.
I have installed Dosbox to run Turbo C in it. But my graphics.h programs are not executing in it. I am getting Linker Error which says"Undefined sumbol initgraph in module..." and so on.
The problem you are facing is quite simple to solve.
Open your Turboc IDE
Click on options
click on linker
click on libraries
mark the graphics option(a cross mark usually)
now run.
You are not linking the required graphics library. It has been quite a while since I last used Turbo C, but if I remember correctly, you can simply configure the toolchain to link the graphics lib in the linker options which are easily accessible from the Turbo C "IDE".
If You are getting Error in Windows XP that Undefined symbol initgraph in module
then follow the Steps :
Go to Console
Go to Options
Go to Linker
Go to Libraries
Make "X" Mark on Graphics Library