hello dear forum , I am trying to compile a C program for STM32F407 microcontroller with OlimexODS ( Eclipse + yagarto compiler ) I get the error; undefined reference to `_impure_ptr' there is no function "impure_ptr" in my whole project the error pointer points to a line containing only } - see attached screenshot yagarto version : -------------------------------------------- This build of yagarto use the following versions: binutils: 2.20.1 gcc: 4.5.1 newlib: 1.18.0 gdb: 7.1 (13.08.2010, mifi) ----------------------------------- In my code I include #include <stdio.h> #include <string.h> this must be something related to C compiler however I dont know what how can I get rid of this ? thanks
:
Locked by Moderator
Don't use a debugger, it won't tell you the root of the problem. Read the map file, generated with -Wl,-Map,filename.map and what object needs _impure_ptr. Presumably it's not a function but an object needed by functions from libc. You can also read the generated assembly (*.s) and precompiled sources (*.i resp. *.ii) by means of -save-temps -g3 -P and ready them to find what causes the problem, but most likely you will find the information in the map file. Maybe a
1 | void *_impure_ptr; |
kludge in one module does what you want. Are you sure you don't have a misconfigured toolchain and no objects / libraries are missing for some reason? The problem is not in the compiler, dig newlib.
1 | Are you sure you don't have a misconfigured toolchain and no objects / |
2 | libraries are missing for some reason? |
3 | |
4 | The problem is not in the compiler, dig newlib. |
I suspect exactly the same thing there must be a switch or a property to be turned off to turn off the compiler or linker option which causes this error