This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
CYGPKG_PDCURSES: PDCurses package for eCos (an without attachment)
- From: Sergei Gavrikov <sergei dot gavrikov at gmail dot com>
- To: eCos discuss list <ecos-discuss at ecos dot sourceware dot org>
- Date: Thu, 26 Mar 2009 20:04:39 +0200
- Subject: [ECOS] CYGPKG_PDCURSES: PDCurses package for eCos (an without attachment)
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