EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Embedded kernel with C source?

Started by Unknown November 11, 2006
Hi.

I'm looking for a 32-bit kernel with preemptive multitasking (realtime
is not required).  It should be simple & lightweight, and be written in
hardware independant C (with full sourcecode).  Considering that my
project requires a TCP/IP stack, I would prefer a kernel for which such
support modules have already been ported.

This is for replacing an 8-bit system to PowerPC.  While I do want to
port the applications, I can't keep the old kernel.  It was a custom
development with lots of ASM code.  I'll have to either re-code the old
kernel or choose an existing one.

I'm not really up-to-date about my options.  I believe to recall that
there was a book about a kernel with sourcecode, and a reader community
actively supporting it.  I heard of several commercial options too. I
don't which ones are lightweight and come with source code.

And then there is Linux, but it has too big a memory footprint and will
be difficult to tame.  For example, my system requires a very special
VMM.  Since Linux comes with its own VMM, it will be hard to integrate
my requirements with Linux' VMM dependancies.

In general I prefer something smaller than Linux, something that can be
stripped to maybe 2K-16K plus my VMM plus the TCP/IP stack.

I'd really appreciate your input about this topic.  What kernels do you
suggest?

Kind regards,
Marc

jetmarc@hotmail.com wrote:
> I'm looking for a 32-bit kernel with preemptive multitasking (realtime > is not required). It should be simple & lightweight, and be written in > hardware independant C (with full sourcecode).
Impossible mission. There's no such thing as a hardware-independent way in pure C to interrupt one stream of execution and jump into the middle of another where you jumped out of it earlier. Simple cooperative multitasking schedulers can be done in pure C with a bit of care. Pre-emptive ones can't.
Hans-Bernhard Br�ker wrote:
> jetmarc@hotmail.com wrote: > >> I'm looking for a 32-bit kernel with preemptive multitasking (realtime >> is not required). It should be simple & lightweight, and be written in >> hardware independant C (with full sourcecode). > > > Impossible mission. There's no such thing as a hardware-independent way > in pure C to interrupt one stream of execution and jump into the middle > of another where you jumped out of it earlier. Simple cooperative > multitasking schedulers can be done in pure C with a bit of care. > Pre-emptive ones can't. >
Look in Embedded Systems Programming magazine a couple of issues back. There's a preemptive multitasker that does just that, as long as your tool chain lets you jump straight to a C function from an interrupt. Tasks must run to completion (i.e. there are no task loops), which turns some 'ordinary' RTOS programming paradigms on their heads, but it looks like a solid way to code a very lightweight multi-tasker. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
jetmarc@hotmail.com wrote:

> Hi. > > I'm looking for a 32-bit kernel with preemptive multitasking (realtime > is not required). It should be simple & lightweight, and be written in > hardware independant C (with full sourcecode). Considering that my > project requires a TCP/IP stack, I would prefer a kernel for which such > support modules have already been ported. > > This is for replacing an 8-bit system to PowerPC. While I do want to > port the applications, I can't keep the old kernel. It was a custom > development with lots of ASM code. I'll have to either re-code the old > kernel or choose an existing one. > > I'm not really up-to-date about my options. I believe to recall that > there was a book about a kernel with sourcecode, and a reader community > actively supporting it. I heard of several commercial options too. I > don't which ones are lightweight and come with source code. > > And then there is Linux, but it has too big a memory footprint and will > be difficult to tame. For example, my system requires a very special > VMM. Since Linux comes with its own VMM, it will be hard to integrate > my requirements with Linux' VMM dependancies. > > In general I prefer something smaller than Linux, something that can be > stripped to maybe 2K-16K plus my VMM plus the TCP/IP stack. > > I'd really appreciate your input about this topic. What kernels do you > suggest? > > Kind regards, > Marc >
You're thinking of MicroC/OS-II, affectionately known as "MuCOS". It does require some assembly (if you're going to do traditional context switches you have to have some assembly in there somewhere), but (a) the amount of assembly code necessary is very well defined, and (b) there are a gazillion ports for the OS, so the Power PC will be covered. So wipe your nose and get a copy. It comes with a license to use it free for 'educational' purposes, but if you sell product you have to pay a one-time fee per board design that is, if I'm not mistaken, in the $1xxx range (compare to all the other royaltee-free OS's out there that want $10K to $50K). For something that'll be completely free, check out ECOS. It's been _years_ since I've paid any attention to it, so I have absolutely no idea of how well it's been accepted by the user community, but anything's worth a look. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
On 11 Nov 2006 01:47:42 -0800, jetmarc@hotmail.com wrote:

>I'm looking for a 32-bit kernel with preemptive multitasking (realtime >is not required). It should be simple & lightweight, and be written in >hardware independant C (with full sourcecode). Considering that my >project requires a TCP/IP stack, I would prefer a kernel for which such >support modules have already been ported. > >This is for replacing an 8-bit system to PowerPC. While I do want to >port the applications, I can't keep the old kernel. It was a custom >development with lots of ASM code. I'll have to either re-code the old >kernel or choose an existing one.
If there are coders comfortable with the old design, why not recode it to the new platform. Most of the kernel can be done in C (or other HLL), while at most 10 % needs to be done in assembly (mainly related to stack switching). Paul

Tim Wescott wrote:

>> I'm looking for a 32-bit kernel with preemptive multitasking (realtime >> is not required). It should be simple & lightweight, and be written in >> hardware independant C (with full sourcecode).
Developing a basic kernel is not a big deal at all, so I would rather do it myself.
>> Considering that my >> project requires a TCP/IP stack, I would prefer a kernel for which such >> support modules have already been ported.
Ouch. The full functional TCP/IP stack is a heavy thing which is also deeply dependent upon the underlying OS. If it is sufficient to support for the UDP only, then "do it yourself" is not a bad option.
>> >> This is for replacing an 8-bit system to PowerPC. While I do want to >> port the applications, I can't keep the old kernel. It was a custom >> development with lots of ASM code. I'll have to either re-code the old >> kernel or choose an existing one.
It looks like the best option would be to rewrite the whole thing.
>> And then there is Linux, but it has too big a memory footprint and will >> be difficult to tame. For example, my system requires a very special >> VMM.
VMM on 8-bitter? Interesting :)
> You're thinking of MicroC/OS-II, affectionately known as "MuCOS". It > does require some assembly (if you're going to do traditional context > switches you have to have some assembly in there somewhere), but (a) the > amount of assembly code necessary is very well defined, and (b) there > are a gazillion ports for the OS, so the Power PC will be covered. So > wipe your nose and get a copy.
Talking about uC/OS, personally I don't like its architecture. Specifically, there are no such things as equal priorities and round robin scheduling in uC/OS. Also, the amount of the cryptic low level system calls and rules of what to do and what not to do is too big to feel comfortable. The system interface should be elegant and encapsulated.
> For something that'll be completely free, check out ECOS. It's been > _years_ since I've paid any attention to it, so I have absolutely no > idea of how well it's been accepted by the user community, but > anything's worth a look.
Was it any good? Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
jetmarc@hotmail.com wrote:

> Hi. > > I'm looking for a 32-bit kernel with preemptive multitasking (realtime > is not required). It should be simple & lightweight, and be written in > hardware independant C (with full sourcecode). Considering that my > project requires a TCP/IP stack, I would prefer a kernel for which such > support modules have already been ported. > > This is for replacing an 8-bit system to PowerPC. While I do want to > port the applications, I can't keep the old kernel. It was a custom > development with lots of ASM code. I'll have to either re-code the old > kernel or choose an existing one. > > I'm not really up-to-date about my options. I believe to recall that > there was a book about a kernel with sourcecode, and a reader community > actively supporting it. I heard of several commercial options too. I > don't which ones are lightweight and come with source code. > > And then there is Linux, but it has too big a memory footprint and will > be difficult to tame. For example, my system requires a very special > VMM. Since Linux comes with its own VMM, it will be hard to integrate > my requirements with Linux' VMM dependancies. > > In general I prefer something smaller than Linux, something that can be > stripped to maybe 2K-16K plus my VMM plus the TCP/IP stack. > > I'd really appreciate your input about this topic. What kernels do you > suggest?
What was specific about your VMM? I know some ofthers have mentioned a few small footprint OS's but if your VMM is in anyway Forth-like you may find FICL would be a useful choice. What it does not have you could easily add as the whole thing is extensible, just like Forth. There are TCP/IP capabilities in Forth and you may find the Forth vendors useful to you in that respect. -- ******************************************************************** Paul E. Bennett ....................<email://peb@amleth.demon.co.uk> Forth based HIDECS Consultancy .....<http://www.amleth.demon.co.uk/> Mob: +44 (0)7811-639972 Tel: +44 (0)1235-811095 Going Forth Safely ..... EBA. www.electric-boat-association.org.uk.. ********************************************************************
Vladimir Vassilevsky wrote:
> > > Tim Wescott wrote: > >>> I'm looking for a 32-bit kernel with preemptive multitasking (realtime >>> is not required). It should be simple & lightweight, and be written in >>> hardware independant C (with full sourcecode). > > > Developing a basic kernel is not a big deal at all, so I would rather do > it myself. > >>> Considering that my >>> project requires a TCP/IP stack, I would prefer a kernel for which such >>> support modules have already been ported. > > > Ouch. The full functional TCP/IP stack is a heavy thing which is also > deeply dependent upon the underlying OS. If it is sufficient to support > for the UDP only, then "do it yourself" is not a bad option. > >>> >>> This is for replacing an 8-bit system to PowerPC. While I do want to >>> port the applications, I can't keep the old kernel. It was a custom >>> development with lots of ASM code. I'll have to either re-code the old >>> kernel or choose an existing one. > > > It looks like the best option would be to rewrite the whole thing. > > > >>> And then there is Linux, but it has too big a memory footprint and will >>> be difficult to tame. For example, my system requires a very special >>> VMM. > > > VMM on 8-bitter? Interesting :) > > >> You're thinking of MicroC/OS-II, affectionately known as "MuCOS". It >> does require some assembly (if you're going to do traditional context >> switches you have to have some assembly in there somewhere), but (a) >> the amount of assembly code necessary is very well defined, and (b) >> there are a gazillion ports for the OS, so the Power PC will be >> covered. So wipe your nose and get a copy. > > > Talking about uC/OS, personally I don't like its architecture. > Specifically, there are no such things as equal priorities and round > robin scheduling in uC/OS. Also, the amount of the cryptic low level > system calls and rules of what to do and what not to do is too big to > feel comfortable. The system interface should be elegant and encapsulated. > > >> For something that'll be completely free, check out ECOS. It's been >> _years_ since I've paid any attention to it, so I have absolutely no >> idea of how well it's been accepted by the user community, but >> anything's worth a look. > > > Was it any good? >
I don't know. It was for some export controlled technology using a brand new processor. ECOS says you can't modify their stuff without publishing it, the state department says you can't publish stuff to potential enemies -- so we used MuCOS, and accepted it's peculiarities (it works just fine). -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
Tim Wescott wrote:
> Hans-Bernhard Br&#4294967295;ker wrote: >> jetmarc@hotmail.com wrote: >> >>> I'm looking for a 32-bit kernel with preemptive multitasking (realtime >>> is not required). It should be simple & lightweight, and be written in >>> hardware independant C (with full sourcecode).
...
> Tasks must run to completion (i.e. there are no task loops), which turns > some 'ordinary' RTOS programming paradigms on their heads, but it looks > like a solid way to code a very lightweight multi-tasker.
Here is my implementation of idea (SST) mentionad by Tim. http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_type=project&item_id=725 Don't worry that it is located on the AVR (8bit micro) forum - I use this code usually for ARM7 devices. Regards, -- Artur Lipowski
Tim Wescott wrote:

> Look in Embedded Systems Programming magazine a couple of issues back. > There's a preemptive multitasker that does just that, as long as your > tool chain lets you jump straight to a C function from an interrupt.
And since when are interrupts codable in hardware-independent C? Jumping straight to a C function may be possible, but how does it jump into the middle of a C function it interrupted, when the schedule comes back to it?

Memfault Beyond the Launch