[En-Nut-Discussion] Use of RAM

Harald Kipp harald.kipp at egnite.de
Sat Nov 20 11:14:22 CET 2004


Hello Leo,

Sigurd should have noted, that he uses ICCAVR.

At 11:18 20.11.2004 +0000, you wrote:

>i'm also developing an embedded web server using ATMEGA16 and RTL8019AS.
>and i'm using the AVR uIP TCP/IP stack (by Louis Beaudoin and Adam
>Dunkels).
>ATMEGA16 indedd has a less memory resources (RAM and Flash mem) than
>ATMEGA128 used in the ethernut board.

That's correct. Adam's stack (and Louis' port) is optimized
for size while Nut/OS tries to mimic the API of Linux/Win/DOS.


>so i use this:
>         char htmlcode[] PROGMEM = {"........."};
>(maybe it is the same with prog_char).
>
>and read it byte per byte by using:
>         Buff[i] = PRG_RDB(&htmlcode[i]); // used in a necessary loop
>i.e. Buff[] is the buffer allocated in the RAM.

Again right, this is fine with AVR-GCC (and WinAVR).
Unfortunately ICCAVR doesn't allow to define something
similar to GCC's PSTR() macro. With GCC one can simply
change

    fprint(stream, "<HTML>");

to

    fprintf_p(stream, PSTR("<HTML>"));

Thus, it had to be changed to

    prog_char dummy[] = "<HTML>";
    fprintf_p(stream, dummy);

which makes code less readable. prog_char works for both,
ICCAVR and AVR-GCC.


>i hope these could help you, because i'm also a newbee in embedded
>ethernet developing.... :)

Nevertheless, your comments are most welcome.

Harald

>best regards,
>
>Leo Hendrawan




More information about the En-Nut-Discussion mailing list