public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] CYGPKG_PDCURSES: PDCurses package for eCos (an without attachment)
@ 2009-03-26 18:24 Sergei Gavrikov
  2009-03-26 18:45 ` Gary Thomas
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Gavrikov @ 2009-03-26 18:24 UTC (permalink / raw)
  To: eCos discuss list

The third attempt. Without the attachment (that was `pdcurses.epk'
~170K). I remember someone told about incoming folder on sourceforge
FTP... Does that exist? What's about pastebin?

I'm sorry, if it is the double post, it seemed for me that gmail reject
the first one (Google disliked `pdcurses.epk').
 
Hello list

I've done the first implementation the PDCurses package for eCos. Let's
it be 1.0beta.

At first

THANKS

to authors of MW port for eCos

    Bart Veer  
    Chris Garry 
    Gary Thomas 
    Jesper Skov  
    Jonathan Larmour  

where I did grab ideas and pices of code for the port. Thanking MW infra
I've done the package in two days.


SYNOPSYS

Installation

    tclsh $ECOS_REPOSITORY/ecosadmin.tcl add pdcurses.epk


Then, it will be possible

i) to build PDCurses stuff in libtarget.a if you just add
   CYGPKG_PDCURSES;

    ecosconfig add pdcurses
    ...

    $ nm install/lib/libtarget.a | grep initscr
    services_curses_pdcurses_initscr.o:
    00000000 T Xinitscr
    00000000 T initscr

In this case your 'PDCurses application' should look as

---------------------------------------->8
#include <curses.h>

int
main(int argc, char *argv[])
{
    initscr();
    printw("Hello World!");
    refresh();
    getch();
    endwin();

    return 0;
}
---------------------------------------->8

Of course, you MUST implement terminal driver for ownself needs, please,
read pdcurses/IMPLEMNT for details. The package's src/drivers/dummy.c is
good for a reference.


ii) to build PDCurses+eCos application (it uses itself a separate thread
    to handle PDCurses event loop (= your TUI)).

Options

cdl_component CYGBLD_PDCURSES_ECOS {
    user_value 1
};

cdl_option CYGBLD_PDCURSES_ECOS_APP {
    user_value 1
};

For a reference

   src/ecos/pdcecos_app.c
   src/ecos/pdcecos_init.c
   src/ecos/pdcecos_thread.c

If you build the eCos with the options the above you'll got

    $ tree ./install/bin
    ./install/bin
    `-- pdcecos_app.elf

    $ ./install/bin/pdcecos_app.elf 
    SYSTEM INITIALIZATION in progress
    data index = 4
    Creating system threads
    Creating PDCECOS thread
    Starting threads
    Starting PDCECOS
    SYSTEM THREADS STARTED!
    pdcecos_main() started!
    pdcecos_main() still alive.
    pdcecos_main() still alive.
    pdcecos_main() still alive.

The pdecos_main() is declared as a WEAK function. It's just a stub for
the real applications. BTW, it works with PDCurses demos, all of them
tweaked as

    #ifdef __ECOS
    int pdcecos_main(int argc, char **argv)
    #else
    int main(int argc, char **argv)
    #endif

So, your 'PDCurses+eCos application' MUST look as

---------------------------------------->8
#include <curses.h>

int
pdecos_main(int argc, char *argv[])
{
    initscr();
    printw("Hello World!");
    refresh();
    getch();
    // ...
    endwin();

    return 0;
}

int
main(int argc, char *argv[])
{
    // ...

    return 0;
}
---------------------------------------->8

Note: It's need compile such pdcecos apps with -D__ECOS and link the
      applicatioan with the install/lib/pdcecos_app.o module.


iii) to build and run PDCurses demos using 'dummy' terminal driver.

Options

cdl_component CYGBLD_PDCURSES_ECOS {
    user_value 1
};

cdl_component CYGBLD_PDCURSES_DEMOS {
    user_value 1
};

cdl_component CYGBLD_PDCURSES_TERMINAL_DRIVER_DUMMY {
    user_value 1
};

For a reference

    cdl/pdcurses.cdl
    src/drivers/dummy.c

Just to try import the options the above to built demos for synthetic
target and run them. I used the latest i386-elf eCosCentric toolchain
with one tweak:

    $ sed -i 's,libgcc_eh.a,,' ./install/lib/target.ld 

to finalize the build.

    $ tree ./install/demos
    ./install/demos
    |-- firework
    |-- newdemo
    |-- ptest
    |-- rain
    |-- testcurs
    |-- tuidemo
    |-- worm
    `-- xmas

Test some demo.

    $ ./install/demos/worm

Note: It's not possible grab an input with dummy terminal driver. It
      exists for the debug purposes only, it used eCos diagnostic
      routings (diag_write_char, diag_write_string) to show curses.


I do not post the patch in the ecos-patches, because I want to know the
opinions eCos gurus or/and testers about the implementation. Perhaps, I
misunderstood something. Perhaps, I did miss something. I hope the
someone will try the package (= test it ;-) and point me on some issues.

Well, this is the 1.0b1 version. But, I hope that you'll find it useful.

Regards,

Sergei


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] CYGPKG_PDCURSES: PDCurses package for eCos (an without  attachment)
  2009-03-26 18:24 [ECOS] CYGPKG_PDCURSES: PDCurses package for eCos (an without attachment) Sergei Gavrikov
@ 2009-03-26 18:45 ` Gary Thomas
  2009-03-26 20:55   ` Sergei Gavrikov
  0 siblings, 1 reply; 3+ messages in thread
From: Gary Thomas @ 2009-03-26 18:45 UTC (permalink / raw)
  To: Sergei Gavrikov; +Cc: eCos discuss list

Sergei Gavrikov wrote:
> The third attempt. Without the attachment (that was `pdcurses.epk'
> ~170K). I remember someone told about incoming folder on sourceforge
> FTP... Does that exist? What's about pastebin?
> 
> I'm sorry, if it is the double post, it seemed for me that gmail reject
> the first one (Google disliked `pdcurses.epk').

Create a bugzilla "bug" for this (enhancement).  Then you can upload the
.epk file as a patch, etc.  Also a good place for the notes you have below.

Thanks

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] CYGPKG_PDCURSES: PDCurses package for eCos (an without  attachment)
  2009-03-26 18:45 ` Gary Thomas
@ 2009-03-26 20:55   ` Sergei Gavrikov
  0 siblings, 0 replies; 3+ messages in thread
From: Sergei Gavrikov @ 2009-03-26 20:55 UTC (permalink / raw)
  To: Gary Thomas; +Cc: eCos discuss list

On Thu, Mar 26, 2009 at 12:21:45PM -0600, Gary Thomas wrote:
> Sergei Gavrikov wrote:
> > The third attempt. Without the attachment (that was `pdcurses.epk'
> > ~170K). I remember someone told about incoming folder on sourceforge
> > FTP... Does that exist? What's about pastebin?
> > 
> > I'm sorry, if it is the double post, it seemed for me that gmail reject
> > the first one (Google disliked `pdcurses.epk').
> 
> Create a bugzilla "bug" for this (enhancement).  Then you can upload the
> .epk file as a patch, etc.  Also a good place for the notes you have below.

Gary, thank you! 

I do not know about. I'm sorry, the attachment (EPK) now here
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1000732

Sergei

P.S.

BTW, the reason was:
Hi. This is the qmail-send program at sourceware.org.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

<ecos-discuss@ecos.sourceware.org>:
ezmlm-reject: fatal: Sorry, I don't accept messages larger than 128000 bytes
+(#5.2.3)


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-26 18:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-26 18:24 [ECOS] CYGPKG_PDCURSES: PDCurses package for eCos (an without attachment) Sergei Gavrikov
2009-03-26 18:45 ` Gary Thomas
2009-03-26 20:55   ` Sergei Gavrikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).