2012-11-22 12:53 PM
hello forum
I am trying to compile a C program for STM32F4 microcontroller with Eclipse + yagarto compiler I get the error;undefined reference to `_impure_ptr' there is no function ''impure_ptr'' in whole project the error pointer points to a line containing only } -------------------------------------------- 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 &sharpinclude <stdio.h>&sharpinclude <string.h>
this must be something related to C compiler however I dont know what how can I get rid of this ? #eclipse-yagarto2012-11-22 01:34 PM
''undefined reference to `_impure_ptr'''
Where, exactly, do you get that? Show the code.''there is no function 'impure_ptr' in whole project'' Why do you think it's a function?2012-11-23 04:12 AM
hello , here is a screenshot
I searched google - it says this error is related to newlib or something like that however I couldnot find any answer how to solve this problem2012-11-23 04:38 AM
Have you tried that ?
http://communities.mentor.com/community/cs/archives/arm-gnu/msg03556.html
2012-11-23 06:39 AM
hello , I think you suggest me to change something here in makefile
what do I need to change in below makefile ? # Makefile for compiling the Getting Started project#-------------------------------------------------------------------------------
# User-modifiable options
#-------------------------------------------------------------------------------
# Trace level used for compilation
# (can be overriden by adding TRACE_LEVEL=#number to the command-line)
# TRACE_LEVEL_DEBUG 5
# TRACE_LEVEL_INFO 4
# TRACE_LEVEL_WARNING 3
# TRACE_LEVEL_ERROR 2
# TRACE_LEVEL_FATAL 1
# TRACE_LEVEL_NO_TRACE 0
TRACE_LEVEL
= 4# Optimization level
OPTIMIZATION
= -O0# Output file basename
OUTPUT
= main# Output directories
BIN
= .OBJ
= obj# library dirs
LIBRARYSRC
= ./lib/srcSTARTUPFILE
= ./lib/startup_stm32f4xx.s#-------------------------------------------------------------------------------
# Tools
#-------------------------------------------------------------------------------
# Tool suffix when cross-compiling
CROSS_COMPILE
= arm-none-eabi-CC
=
$(CROSS_COMPILE)
gccSIZE
=
$(CROSS_COMPILE)
sizeSTRIP
=
$(CROSS_COMPILE)
stripOBJCOPY
=
$(CROSS_COMPILE)
objcopyOBJDUMP
=
$(CROSS_COMPILE)
objdumpLD
=
$(CROSS_COMPILE)
ldAS
=
$(CROSS_COMPILE)
as#-------------------------------------------------------------------------------
# Files
#-------------------------------------------------------------------------------
# include folders
INCLUDES
= -I./INCLUDES +
= -I./lib/INCLUDES +
= -I./lib/inc/INCLUDES +
= -I./lib/inc/../../# Objects built from C source files
C_OBJECTS
=
$(OBJ)
/main.oC_OBJECTS +
=
$(OBJ)
/system_stm32f4xx.oC_OBJECTS +
=
$(OBJ)
/stm32f4xx_gpio.oC_OBJECTS +
=
$(OBJ)
/stm32f4xx_rcc.oC_OBJECTS +
=
$(OBJ)
/stm32f4xx_it.oC_OBJECTS +
=
$(OBJ)
/stm32f4xx_syscfg.oC_OBJECTS +
=
$(OBJ)
/stm32_eth.oC_OBJECTS +
=
$(OBJ)
/ethernet.oC_OBJECTS +
=
$(OBJ)
/clock-arch.oC_OBJECTS +
=
$(OBJ)
/timer.oC_OBJECTS +
=
$(OBJ)
/misc.oC_OBJECTS +
=
$(OBJ)
/uip.oC_OBJECTS +
=
$(OBJ)
/httpd.oC_OBJECTS +
=
$(OBJ)
/uip_arp.o# Objects built from Assembly source files
ASM_OBJECTS
=
$(OBJ)
/startup_stm32f4xx.oLINKER_SCRIPT
= ./lib/stm32f4xx_flash.ld#LINKER_SCRIPT = ./lib/stm32f4xx_flash_extsram.ld
# Append OBJ and BIN directories to output filename
OUTPUT :
=
$(BIN)
/
$(OUTPUT)#-------------------------------------------------------------------------------
# Rules
#-------------------------------------------------------------------------------
# Flags
CFLAGS
= -Wall -fno-common -c -g -
mcpu
=cortex-m3 -mthumbCFLAGS +
= -g
$(OPTIMIZATION)
$(INCLUDES)
-
DTRACE_LEVEL
=
$(TRACE_LEVEL)ASFLAGS
= -g -mapcs-32LDFLAGS
= -g -v -nostartfilesOBJCOPYFLAGS
= -O binaryOBJDUMPFLAGS
= -x --syms -Sall:
$(BIN)
$(OBJ)
$(OUTPUT)
.out$(BIN)
$(OBJ)
:mkdir $@
$(OUTPUT)
.out:
$(C_OBJECTS)
$(ASM_OBJECTS)
$(LINKER_SCRIPT)@ echo ''..linking''
$(LD)
$(LDFLAGS)
-Map
$(OUTPUT)
.map -T
$(LINKER_SCRIPT)
-o
$(OUTPUT)
.out
$(C_OBJECTS)
$(ASM_OBJECTS)
libgcc.a$(OBJCOPY)
$(OBJCOPYFLAGS)
$(OUTPUT)
.out
$(OUTPUT)
.bin# $(OBJDUMP) $(OBJDUMPFLAGS) $(OUTPUT).out > $(OUTPUT).lss
@ echo ''...completed.''
$(C_OBJECTS)
: main.c system_stm32f4xx.c@ echo ''.compiling''
$(CC)
$(CFLAGS)
-o
$(OBJ)
/main.o main.c$(CC)
$(CFLAGS)
-o
$(OBJ)
/system_stm32f4xx.o system_stm32f4xx.c$(CC)
$(CFLAGS)
-o
$(OBJ)
/stm32f4xx_it.o stm32f4xx_it.c$(CC)
$(CFLAGS)
-o
$(OBJ)
/stm32_eth.o stm32_eth.c$(CC)
$(CFLAGS)
-o
$(OBJ)
/ethernet.o ethernet.c$(CC)
$(CFLAGS)
-o
$(OBJ)
/clock-arch.o clock-arch.c$(CC)
$(CFLAGS)
-o
$(OBJ)
/timer.o timer.c$(CC)
$(CFLAGS)
-o
$(OBJ)
/uip.o uip.c$(CC)
$(CFLAGS)
-o
$(OBJ)
/httpd.o httpd.c$(CC)
$(CFLAGS)
-o
$(OBJ)
/uip_arp.o uip_arp.c@ echo ''.compiling libraries''
$(CC)
$(CFLAGS)
-o
$(OBJ)
/stm32f4xx_gpio.o
$(LIBRARYSRC)
/stm32f4xx_gpio.c$(CC)
$(CFLAGS)
-o
$(OBJ)
/stm32f4xx_rcc.o
$(LIBRARYSRC)
/stm32f4xx_rcc.c$(CC)
$(CFLAGS)
-o
$(OBJ)
/stm32f4xx_rcc.o
$(LIBRARYSRC)
/stm32f4xx_rcc.c$(CC)
$(CFLAGS)
-o
$(OBJ)
/stm32f4xx_syscfg.o
$(LIBRARYSRC)
/stm32f4xx_syscfg.c$(CC)
$(CFLAGS)
-o
$(OBJ)
/misc.o
$(LIBRARYSRC)
/misc.c$(ASM_OBJECTS)
:
$(STARTUPFILE)@ echo ''.assembling''
$(AS)
$(ASFLAGS)
-o
$(OBJ)
/startup_stm32f4xx.o
$(STARTUPFILE)clean:
-rm -f
$(OBJ)
/*.o
$(BIN)
/*.out
$(BIN)
/*.bin
$(BIN)
/*.dmp
$(BIN)
/*.map
$(BIN)
/*.lss2012-11-23 07:12 AM
The linker is driven by the LD and LDFLAGS lines, fix those.