- Re: Making small executables from h8300-coff-gcc
- Posted by Rich Webb on July 27th, 2003
On Sun, 27 Jul 2003 21:27:31 +0200, "Rick" <no@mail.no> wrote:
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
- Posted by Jakob Engblom on July 28th, 2003
"Rick" <no@mail.no> wrote in message news:<3f24bf25$0$49110$e4fe514c@news.xs4all.nl>...
Probably yes, or change to a compiler like the IAR one that has a
reduced printf available from the outset.
- Posted by Hans-Bernhard Broeker on July 28th, 2003
Rick <no@mail.no> wrote:
Either that, or shun printf() and friends.
--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
- Posted by Jonathan Larmour on July 28th, 2003
Rich Webb <bbew.ar@mapson.nozirev.ten> enlightened us with:
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
- Posted by Andy G on July 28th, 2003
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.
- Posted by Lewin A.R.W. Edwards on July 28th, 2003
Well, in an embedded application particularly, I'd prefer it if he
used strncpy... 
- Posted by Rick on July 30th, 2003
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
- Posted by Andy G on July 30th, 2003
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