This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problem compiling code trying to add sscanf function


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

n f wrote:
I'm programming a 68hc11e1 microprocessor, using c.
Does anyone know if it's possible to use stdio
functions from c, to program a 68hc11e1. Everytime I
compile it gives me an error when I try to use sscanf
function. I'm trying to convert a string to float. I
have inserted "#include <stdio.h>", but it still does
not work.

You don't tell us which error you are getting.


You must at least add the following libraries: -lc -lbcc -lc
and use the newlib 1.11 to use sscanf().

Note that even if floating points work well with 68hc11/68hc12
the libraries are so huge that it's quite unusable in a real situation.
Stay away from using floating point when using a such embedded system.

The 'sscanf' and 'printf' with floating point support are also so
huge (in newlib) that it will use 75% of the 64K address space.
(it will not fit in your 24K text region).

Stephane


here are my files: Here's my memory.x file:

OUTPUT_FORMAT("elf32-m68hc11", "elf32-m68hc11",
"elf32-m68hc11")
OUTPUT_ARCH(m68hc11)
ENTRY(_start)
SEARCH_DIR(C:\usr\lib\gcc-lib\m6811-elf\3.3.1-m68hc1x-20031004
\mshort)

MEMORY
{
ioports (!x) : org = 0x1000, l = 0x500
eeprom (!i) : org = 0xB600, l = 0x300
data (rwx) : org = 0x8800, l = 0x1000
text (rx) : org = 0x9000, l = 0x6000
}

PROVIDE (_stack = 0x01ff-1);

-------------------------------------------------------------
here's my project.mak file:

OC = c:/usr/bin/m6811-elf-objcopy
CC = c:/usr/bin/m6811-elf-gcc
RM = C:/embeddedGNU/rm.exe

CFLAGS = -m68hc11 -O3 -fno-ident -fno-common
-fomit-frame-pointer -
mshort -fsigned-char
LDFLAGS = -Wl,-u,-mm68hc11elfb
OCFLAGS = -O srec

CSRCS=main.c

OBJS=$(CSRCS:.c=.o)

all: ourProject.elf ourProject.s19

$(OBJS): %.o: %.c
$(CC) $(CFLAGS) -c $<

ourProject.elf: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o ourProject.elf $(OBJS)

ourProject.s19: ourProject.elf
$(OC) $(OCFLAGS) ourProject.elf ourProject.s19

clean:
$(RM) -f ourProject.elf
$(RM) -f ourProject.s19
$(RM) -f ourProject.dmp
$(RM) -f $(OBJS)


--------------------------------------- basically this is what i'm adding:

#include<stdio.h>

UINT x;
char *out = "1234.4213"; // this is what what the data

                         //looks like
float fnum;
x = sscanf(out, "%lf", &fnum);


__________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html


- -- Home Office
E-mail: stcarrez@nerim.fr Stephane.Carrez@solsoft.com
WWW: http://stcarrez.nerim.net http://www.solsoft.com
Free the Software! Security Policy Management


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Netscape - http://enigmail.mozdev.org

iD8DBQFAYhBhNyQxO2LzKT0RApLPAJ0U9ecLNMKKoo6JeJGPG2IKaS2twwCg3XnO
rZg5zlUMmBhcgDMJ4jw5PkY=
=0LEz
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]