cancel
Showing results for 
Search instead for 
Did you mean: 

what is _impure _ptr ? why am I getting this error ?

mehmet.karakaya
Associate III
Posted on November 22, 2012 at 21:53

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-yagarto
5 REPLIES 5
Posted on November 22, 2012 at 22:34

''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?

mehmet.karakaya
Associate III
Posted on November 23, 2012 at 13:12

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 problem

0690X00000602maQAA.jpg

 

frankmeyer9
Associate II
Posted on November 23, 2012 at 13:38

Have you tried that ?

http://communities.mentor.com/community/cs/archives/arm-gnu/msg03556.html

mehmet.karakaya
Associate III
Posted on November 23, 2012 at 15:39

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/src

STARTUPFILE

= ./lib/startup_stm32f4xx.s

#-------------------------------------------------------------------------------

# Tools

#-------------------------------------------------------------------------------

# Tool suffix when cross-compiling

CROSS_COMPILE

= arm-none-eabi-

CC

=

$(CROSS_COMPILE)

gcc

SIZE

=

$(CROSS_COMPILE)

size

STRIP

=

$(CROSS_COMPILE)

strip

OBJCOPY

=

$(CROSS_COMPILE)

objcopy

OBJDUMP

=

$(CROSS_COMPILE)

objdump

LD

=

$(CROSS_COMPILE)

ld

AS

=

$(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.o

C_OBJECTS +

=

$(OBJ)

/system_stm32f4xx.o

C_OBJECTS +

=

$(OBJ)

/stm32f4xx_gpio.o

C_OBJECTS +

=

$(OBJ)

/stm32f4xx_rcc.o

C_OBJECTS +

=

$(OBJ)

/stm32f4xx_it.o

C_OBJECTS +

=

$(OBJ)

/stm32f4xx_syscfg.o

C_OBJECTS +

=

$(OBJ)

/stm32_eth.o

C_OBJECTS +

=

$(OBJ)

/ethernet.o

C_OBJECTS +

=

$(OBJ)

/clock-arch.o

C_OBJECTS +

=

$(OBJ)

/timer.o

C_OBJECTS +

=

$(OBJ)

/misc.o

C_OBJECTS +

=

$(OBJ)

/uip.o

C_OBJECTS +

=

$(OBJ)

/httpd.o

C_OBJECTS +

=

$(OBJ)

/uip_arp.o

# Objects built from Assembly source files

ASM_OBJECTS

=

$(OBJ)

/startup_stm32f4xx.o

LINKER_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 -mthumb

CFLAGS +

= -g

$(OPTIMIZATION)

$(INCLUDES)

-

DTRACE_LEVEL

=

$(TRACE_LEVEL)

ASFLAGS

= -g -mapcs-32

LDFLAGS

= -g -v -nostartfiles

OBJCOPYFLAGS

= -O binary

OBJDUMPFLAGS

= -x --syms -S

all:

$(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)

/*.lss

Posted on November 23, 2012 at 16:12

The linker is driven by the LD and LDFLAGS lines, fix those.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..