[En-Nut-Discussion] What do do with big (demo) apps on small CPU

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Wed Jan 30 14:02:25 CET 2013


>>>>> "Henrik" == Henrik Maier <hmnews at proconx.com> writes:

    Henrik> On 30/01/2013 10:18 PM, Harald Kipp wrote:
    >> Otherwise we should remove this app from the trunk. Users typically
    >> get quite frustrated if their first contact with Nut/OS fails at such
    >> an early stage.

    Henrik> I think the lua app is still a good example on how to use and
    Henrik> embed a lua interpreter and it should be available somehow to
    Henrik> interested developers.

    Henrik> Maybe we could split the apps in "core apps" and "extra apps"
    Henrik> with the extra apps farmed out onto a dedicated web site rather
    Henrik> having them in the trunk.

I would propose to prepend the app/lua/lua code with

#if defined(__AVR_ARCH__) && !define(_OPTIMIZE__)
int main(void)
{
    unsigned long baud = 115200;

    /* Initialize the console. */
    NutRegisterDevice(&DEV_CONSOLE, 0, 0);
    freopen(DEV_CONSOLE.dev_name, "w", stdout);
    freopen(DEV_CONSOLE.dev_name, "w", stderr);
    freopen(DEV_CONSOLE.dev_name, "r", stdin);
    _ioctl(_fileno(stdin), UART_SETSPEED, &baud);

    /* Display banner. */
    puts("\nPlease compile the LUA example with optimization enabled\n");
    while(1)
        NutSleep(100);
}

#else
(original code)
#endif
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------


More information about the En-Nut-Discussion mailing list