[En-Nut-Discussion] Nut/OS port for H8/300H.

Jan Dubiec jdx at slackware.pl
Wed Mar 17 17:21:56 CET 2004


On Wed, 17 Mar 2004 17:28:23 +0100, Harald Kipp <harald.kipp at egnite.de> wrote:
[.....]
> No, string constants are placed in RAM by default.
> Actually in the data segment, which contains all
> pre-initialized RAM.
OK, I have caught it. So I am going to prepare a patch to fix all
those debug stuff. Just tell me which of the following two versions do
you prefer.

1st version:

void foo(void)
{
#ifdef NUTDEBUG
#ifdef ARCH_32BIT
    static prog_char fmt[] = "SWC<%08lx %08lx>";
#else
    static prog_char fmt[] = "SWC<%04x %04x>";
#endif
#endif

    do_something();

#ifdef NUTDEBUG
    fprintf_P(__os_trs, fmt, level, (uptr_t) runningThread);
#endif
}

2nd version:

void foo(void)
{
    do_something();

#ifdef NUTDEBUG
#ifdef ARCH_32BIT
    fprintf(__os_trs, "SWC<%08lx %08lx>", level, (uptr_t) runningThread);
#else
    fprintf(__os_trs, "SWC<%04x %04x>", level, (uptr_t) runningThread);
#endif
#endif
}

Regards,
/J.D.
-- 
Jan Dubiec, jdx at slackware.pl, mobile: +48 602 101787

Głęboka wiara wymaga płytkiego rozumu i nikłej wiedzy.



More information about the En-Nut-Discussion mailing list