|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
NutVersionString on AVRHello,
NutVersionString() returns a normal string, needing something like 8 bytes in RAM space. On boards woth no external RAM, this is a noticable amount. What about appended patch? Bye -- Uwe Bonnes bon@... Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ---------- Index: nut/os/version.c =================================================================== --- nut/os/version.c (Revision 2740) +++ nut/os/version.c (Arbeitskopie) @@ -255,8 +255,12 @@ #include <sys/version.h> #define OS_VERSION_NUMBER 0x04090700UL -static CONST char os_version_string[] = "4.9.7.0"; - +#ifdef PROGMEM +static CONST char os_version_string[] PROGMEM +#else +static CONST char os_version_string[] +#endif + = "4.9.7.0"; /*! * \addtogroup xgNutVersion */ _______________________________________________ http://lists.egnite.de/mailman/listinfo/en-nut-discussion |
|
|
Putting strings etc transparent into PROGMEMHello,
some days ago I proposed to put os_version_string into progmem, when progmem is available, like +#ifdef PROGMEM +static CONST char os_version_string[] PROGMEM +#else +static CONST char os_version_string[] +#endif + = "4.9.7.0"; Would this be transparent for a usage like ./nut/pro/httpd.c: fprintf_P(stream, fmt_P, HTTP_MAJOR_VERSION, HTTP_MINOR_VERSION, status, title, NutVersionString()); Bye -- Uwe Bonnes bon@... Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ---------- _______________________________________________ http://lists.egnite.de/mailman/listinfo/en-nut-discussion |
|
|
Re: Putting strings etc transparent into PROGMEMHi Uwe,
Uwe Bonnes wrote: > +#ifdef PROGMEM > +static CONST char os_version_string[] PROGMEM > +#else > +static CONST char os_version_string[] > +#endif > + = "4.9.7.0"; The #ifs are not required, because non-Harvard architectures provide a PROGMEM dummy. > Would this be transparent for a usage like > ./nut/pro/httpd.c: fprintf_P(stream, fmt_P, HTTP_MAJOR_VERSION, HTTP_MINOR_VERSION, status, title, NutVersionString()); It would be incompatible, because %P is required instead of %s. This would break a large number of applications, just to save 8 bytes of RAM. Harald _______________________________________________ http://lists.egnite.de/mailman/listinfo/en-nut-discussion |
|
|
Re: Putting strings etc transparent into PROGMEM>>>>> "Harald" == Harald Kipp <harald.kipp@...> writes:
Harald> Hi Uwe, Uwe Bonnes wrote: >> +#ifdef PROGMEM +static CONST char os_version_string[] PROGMEM +#else >> +static CONST char os_version_string[] +#endif + = "4.9.7.0"; Harald> The #ifs are not required, because non-Harvard architectures Harald> provide a PROGMEM dummy. >> Would this be transparent for a usage like ./nut/pro/httpd.c: >> fprintf_P(stream, fmt_P, HTTP_MAJOR_VERSION, HTTP_MINOR_VERSION, >> status, title, NutVersionString()); Harald> It would be incompatible, because %P is required instead of Harald> %s. This would break a large number of applications, just to Harald> save 8 bytes of RAM. What about adding NutVersionString_P() then? -- Uwe Bonnes bon@... Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ---------- _______________________________________________ http://lists.egnite.de/mailman/listinfo/en-nut-discussion |
|
|
Re: Putting strings etc transparent into PROGMEM>>>>> "Harald" == Harald Kipp <harald.kipp@...> writes:
Harald> Hi Uwe, Uwe Bonnes wrote: >> +#ifdef PROGMEM +static CONST char os_version_string[] PROGMEM +#else >> +static CONST char os_version_string[] +#endif + = "4.9.7.0"; Harald> The #ifs are not required, because non-Harvard architectures Harald> provide a PROGMEM dummy. >> Would this be transparent for a usage like ./nut/pro/httpd.c: >> fprintf_P(stream, fmt_P, HTTP_MAJOR_VERSION, HTTP_MINOR_VERSION, >> status, title, NutVersionString()); Harald> It would be incompatible, because %P is required instead of Harald> %s. This would break a large number of applications, just to Harald> save 8 bytes of RAM. Do non-Harvard architectures provide a dummy %P? -- Uwe Bonnes bon@... Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ---------- _______________________________________________ http://lists.egnite.de/mailman/listinfo/en-nut-discussion |
|
|
Re: Putting strings etc transparent into PROGMEMUwe Bonnes wrote:
> Do non-Harvard architectures provide a dummy %P? Yes, it handles %P like %s. Harald _______________________________________________ http://lists.egnite.de/mailman/listinfo/en-nut-discussion |
|
|
Re: Putting strings etc transparent into PROGMEMUwe Bonnes wrote:
> What about adding NutVersionString_P() then? How would that help? Compatibility requires to have NutVersionString returning a string in RAM. Adding NutVersionString_P would add more code, nothing else. May I ask why you spend that much time on 8 bytes of RAM? I'm almost sure there are more promising parts in the library. Harald _______________________________________________ http://lists.egnite.de/mailman/listinfo/en-nut-discussion |
|
|
Re: Putting strings etc transparent into PROGMEM>>>>> "Harald" == Harald Kipp <harald.kipp@...> writes:
Harald> Uwe Bonnes wrote: >> What about adding NutVersionString_P() then? Harald> How would that help? Compatibility requires to have Harald> NutVersionString returning a string in RAM. Adding Harald> NutVersionString_P would add more code, nothing else. Harald> May I ask why you spend that much time on 8 bytes of RAM? I'm Harald> almost sure there are more promising parts in the library. Well on the AT90CAN128 with no external RAM, code memory is ample and RAM is few. Adding a printf_P with the version string brought down available heap, so I was thinking about how to keep that usefill feature witout scrificing RAM... But thinking again, probably most usefull would be to have #define OS_VERSION_NUMBER 0x04090700UL in sys/version.h an so one could construct PROGMEM strings with it and use it for conditional compilations. Sorry for wasting your time. Bye -- Uwe Bonnes bon@... Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ---------- _______________________________________________ http://lists.egnite.de/mailman/listinfo/en-nut-discussion |
| Free embeddable forum powered by Nabble | Forum Help |