Re: Making small executables from h8300-coff-gcc

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View

Quoted text here. Click to load it
[snip...snip...]

Yup. The printf() family is required to do all sorts of magical
formatting, and that takes code.

Some microcontroller implementations have "reduced capability" printf()-
style functions for just the reason you've seen. For example, the
Imagecraft AVR C compiler (ICCAVR) has three "sizes" of library code for
the printf() family (portions snipped from the help file):

basic: only %c, %d, %x, %X, %u, and %s format specifiers without
modifiers.

long: %ld, %lu, %lx, %lX are supported, in addition to the width and
precision fields.
    
floating point: adds the %f specifier.

Each one needs more space for the library code.

If at all possible, avoid the printf() family altogether on smaller
microcontrollers. It's possible (and frequently necessary) to do your
own string formatting.

--
Rich Webb   Norfolk, VA

Re: Making small executables from h8300-coff-gcc
Quoted text here. Click to load it

Probably yes, or change to a compiler like the IAR one that has a
reduced printf available from the outset.

Re: Making small executables from h8300-coff-gcc
Quoted text here. Click to load it

Either that, or shun printf() and friends.

--
Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: Making small executables from h8300-coff-gcc
Quoted text here. Click to load it

Well, in an embedded application particularly, I'd prefer it if he
used strncpy... :)

Re: Making small executables from h8300-coff-gcc
Quoted text here. Click to load it

The normal C library used with GCC for embedded is newlib, and newlib
also comes with a reduced capability printf (no floating point). It's
called iprintf(). I suggest the OP try that!

Jifl
--
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine

Re: Making small executables from h8300-coff-gcc
Quoted text here. Click to load it

Rick

I have a simple source file for printf (no floating point support)
that I simply link in to my H8 projects and I don't get loads of other
garbage along for the ride.

Email me (or post here) if you would like a copy. (The email here does
work)

Andy G.

Re: Making small executables from h8300-coff-gcc

Quoted text here. Click to load it

Andy, Thanks!

 I've just did the same.

I found some source for sprintf and sscanf which is configurable (float or
no float etc). I have used the IAR source actually which i found on a demo
CD.

I have a next question which you can answer maybe. I have definied a section
for uninitialized data like this:

int someData[200] __attribute__ ((section("MySection")));

"MySection" is RAM memory.

This wil cause that in the S-record file the section is included but it is
uninitialized data.

How can I tell the linker to handle it as uninitialized data?

BTW:  I use Kpit GNU 0303-elf with HEW

Rick



Re: Making small executables from h8300-coff-gcc
Quoted text here. Click to load it

Not claiming to be an expert here, but is what you are after something like:

.bss (NOLOAD)
  {
  ...
  *(.MySection) ;
  ...
  }

in the .xr (?) file that describes to the linker where to locate segments.

Sorry to be woolly - working from shaky memory.

Andy

Site Timeline