[ECOS] Nano using PDCurses for eCos

Steven Clugston steven.clugston@newcastle.ac.uk
Fri Apr 17 03:06:00 GMT 2009

> If you just want to edit config files, it's better to implement own
> editor, call it `femto' then :-)
> http://en.wikipedia.org/wiki/SI_prefix
> It seems for me that nano is enough bloat stuff for eCos targets.

Nano does far more than I realised and I agree that most of it is bloat for what I need like calls to external programs for spell checking and wide character and NLS support etc, but it's a choice between writing an editor from scratch or hacking nano to work by disabling the bloat using its existing config mechanism. I think the latter should take less time/effort. It's a shame there's not a #define NANO_FEMTO mode to strip off even more than NANY_TINY does.

> Yesterday evening I did grab the latest stable nano sources (2.0.9)
> from here http://www.nano-editor.org, and tried to  > build it. After
> configure and some tweaks I got The GNU nano editor for the eCos
> i386linux target just in 110K using those PDCurses package and dummy
> driver.

> I should not have told about until a try. Steven, I have to finalize
> and test the build (at the least using eCos
> FS_RAM), I have to add the real terminal driver to PDCurses. I do hope this will occur the next weekend and then I will
> share a full story somewere on the web (some guys are nervious if they cannot read here only a digest about eCos kernel
> gears and cpu parts :-) There are a few hints the below

I know this is bordering on another general programming discussion, but its because of the issues which ecos throws up that I'm discussing it and it just might interest some other ecos user out there one day.

> I configured the nano as: --enable-tiny --disable-nls --disable-utf8;
> I have a bit tweaked config.h to point on that
> which things are absent in eCos, made a peace with Linux/GNU (pwd, mkstemp, signals, getopt) and I got the executable.
> There is alone rule in my eCos Makefile


I've actually got nano 2.0.7 to compile to a binary with modifying any of the actual nano source. It seems to run on my PowerPC board now. I can't tell if it works yet as it doesn't accept any input, but the main screen fires up. For some reason my raw binary is around 413Kb which seems quite big, but I probably could have disabled more stuff in CDL like unneeded hardware packages.

Here's what I did:

I just ran configure on the source in Linux to get the basic config.h file and then modified that to disable most headers and things that are not present in ecos and enabled NANO_TINY as well.

To get the termios stuff and unix signals to compile I had to use the POSIX compatibility layer package and enable POSIX signals and disable the ISO C signals infrastructure.

I made a compat.h and compat.c to replace the missing function calls with dummy ones like you did with your TCL experiment.

I also 'borrowed' the GNU/Linux versions of strnlen.c and getopt.c for now. There's a CDL option to supply comandline args to main{}, so maybe an ecos implementation of getopt() might be useful to have in a compatability package or something.

No doubt that it will come off the rails as soon as it hits one of the dummy calls, but hopefully with some more work it will be able to load a file off a jffs2 partition, edit it, and save it back.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: compat.c
URL: <http://sourceware.org/pipermail/ecos-discuss/attachments/20090417/3da58b8e/attachment.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: compat.h
URL: <http://sourceware.org/pipermail/ecos-discuss/attachments/20090417/3da58b8e/attachment.h>
-------------- next part --------------
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list