Mercurial > ecos
comparison packages/services/curses/pdcurses/current/examples/README @ 2873:da0eeb594067
* ecos.db, services/curses/pdcurses/current/*: Initial check-in of
PDCurses port.
| author | jld |
|---|---|
| date | Sun, 10 May 2009 08:29:53 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 2872:5ae4b05913c1 | 2873:da0eeb594067 |
|---|---|
| 1 * PDCurses + eCos Application | |
| 2 --------------------------- | |
| 3 | |
| 4 It is possible to run a curses program in a separate eCos thread. Look | |
| 5 at the pdcecos_app.h, pdcecos_app.c, pdcecos_init.c, pdcecos_thread.c | |
| 6 sources for details. | |
| 7 | |
| 8 As you can see you should put own curses code inside a pdcecos_main() | |
| 9 function instead of traditional main() entry. In such a build you have | |
| 10 to link your executable with a pdcecos_app.o object file, and a curses | |
| 11 program must look as | |
| 12 | |
| 13 #include <curses.h> | |
| 14 ... | |
| 15 | |
| 16 int | |
| 17 pdcecos_main(int argc, char *argv[]) | |
| 18 { | |
| 19 initscr(); | |
| 20 ... | |
| 21 } | |
| 22 | |
| 23 The pdcecos_app.c has cyg_user_start() entry where a startup_thread() | |
| 24 creates and resumes itself there. The startup_tread() creates and | |
| 25 invokes a set of threads are defined in a __PDC_APP_TAB__. By default | |
| 26 only alone thread is registered in the table, it is pdcecos_thread(), | |
| 27 but you can expand the table. When the pdcecos_thread() is started, it | |
| 28 invokes the pdcecos_main() function -- your curses program. | |
| 29 | |
| 30 The "PDCECOS" thread uses a separate stack as well, you can change its | |
| 31 size by default is ( CYGNUM_HAL_STACK_SIZE_TYPICAL * 2 ). | |
| 32 | |
| 33 To build a PDCurses+eCos demo application, first generate a Make.params | |
| 34 file using the build_Make.params script which is placed under the eCos | |
| 35 `examples' directory and then just type 'make'. | |
| 36 | |
| 37 There is an example of running the pdcecos_app demo in GDB the below. As | |
| 38 you can see the "PDCECOS" thread starts and invokes pdcecos_main() then. | |
| 39 | |
| 40 (gdb) break pdcecos_main | |
| 41 Breakpoint 1 at 0x100111b: pdcecos_thread.c, line 93. | |
| 42 (gdb) continue | |
| 43 Starting program: pdcecos_app | |
| 44 SYSTEM INITIALIZATION in progress | |
| 45 data index = 4 | |
| 46 Creating system threads | |
| 47 Creating PDCECOS thread | |
| 48 Starting threads | |
| 49 Starting PDCECOS | |
| 50 SYSTEM THREADS STARTED! | |
| 51 | |
| 52 Breakpoint 1, pdcecos_main (argc=0, argv=0x0) | |
| 53 at pdcecos_thread.c:93 | |
| 54 88 initscr(); | |
| 55 Current language: auto; currently c | |
| 56 (gdb) continue | |
| 57 | |
| 58 Then you should see a message | |
| 59 | |
| 60 Hello PDCurses+eCos World! | |
| 61 | |
| 62 in a terminal program (minicom, hyperterm, etc.). | |
| 63 | |
| 64 | |
| 65 ------------------------------------------------------------------------ |
