Feburary 16, 2008
Recently I purchased an Ethernut
2.1 board for here at home as well as a couple for use at work.
These boards seem to be a nice
way to make a web based embedded application. The source code for
the library is completely open source. And you do get the entire
thing. This is nice, because several times I have refered to the
source code when the documentation was unclear as to how a function
The NUT/OS is a cooperative multitasking system.
This means that a thread will execute until it returns control
back to the operating system. The one advantage that this has is
that resourse sharing is a lot easier. I was a little skeptical
of the NUT/OS at first, but after actually using it, I have to say I
was quite impressed with it. It does seem to work as advertised.
It took a few tries to get a succesful compile with
WinAVR, but as soon as I got it to compile (all of the problems were
just setup...I did not need to modify any source) the examples ran just
fine, and then I began to modify them as a way of exploring how ethernut actually works.
The NUT/OS is very sophisticated as compared to
something like say uCOS. uCOS is preemptive, but it doesn't have
the sophisticated goodies that NUT/OS does. For instance, the IO
subsystem seems to be integrated very nicely into the OS.
I can highly recomend this product.
July 18, 2007
I have no idea if this is bullet proof
or not. But hey, it is free, how can you complain.
This is a very simple RTOS.
Sorry, right now,
there are no docs. And not all of the files in the zip really
have anything to do with it....yet.
Right now, you can create tasks, and
counting semaphore objects. Which is really all you need for
basic implementation of an RTOS.
I am surprised at how good it actually
I am not sure how it compares with say FreeRTOS, since I have
never used it.
extern void CreateTask(TCB *t, void (*task)(void *),char *stack, int
stacksize,int priority,char *name,void *arg);
extern void IrqSwap(void);
extern void InitTask(void);
extern void Yeild(void);
extern ECB *NewSemaphore(int InitCount,int Mode,char *name);
extern void CreateSemaphore(ECB *e,int InitCount,int Mode,char *n);
extern int PendSemaphore(ECB *e, int
Timeout); //wait for semaphore availiable
extern int PostSemaphore(ECB *e, int
Value); //signal semaphore availiable
extern void TimerTicker(void);
extern int TimeDelay(int mSec);
extern void Enable(char sr);
extern char Disable(void);
extern void StartOS(void);
extern void DoSwap(void);
extern void ExitInterrupt(void);
January 29, 2008
a BUG in this RTOS.
I am still not sure where, but I think I know where it might
Here is the problem.
It seems that a semaphore that is posted
interrupt routine seems to cause a TASK CONTROL BLOCK to somehow get
lost. I suspect that it is in the IRQ entry that the problem
located. When an interrupt occures, all of the 32 registers
pushed on the stack. In avr-gcc, registers r0 and r1 are
to be set to zero. However, they do on occasion get used
temporarily to do things. So, they could, sometimes, have
different values in them. Other C code gets executed durring
interrupt. It may be that having a strange value in either r0
r1 could cause a problem. I don't know. I changed
a little so that right after r1 and r0 is pushed, they are
cleared....oppss...forgot to clear r0....well, we shall see how what I
did does over night.
do believe I have fixed
that one bug. It seems that I was right. This is a
lesson...read the documentation...and take it seriously ;^).....
may download the latest version above...I have updated it.
free to do with this as
you please...but, you are not allowed to come whining to me if
something doesn't work right.
project....get the VGA
all up and running and write a windowing library to take advantage of
found another bug in the
RTOS...this one was much more minor. It was in the
function. When a semaphore times out, it is posted so that
task that was waiting on the semaphore can decide what to do next about
the resource that has not become availiable. However, I was
incrementing the EventCount object member. This caused wierd
behavior, so I added this line of code.
version of the RTOS is now posted above.
I have it
running on a test setup
using an ATmega2561 on an STK500/501 setup. The STK500/501 is
connected up to a Xilinx Spartan 3 Starter Board that is running a VGA
display and also a hardware timer. This was a kind of fun
up...Midi -> CV converter using the RTOS...I hope.
July 14, 2007
I can't believe it has been about 6
yearrs since I
first started using the AVR....alot of water has flowed under the AVR
bridge since then.
1. I originally used the Image Craft C
It is a good compiler, but I think I have now found a much
choice. And that is WinAVR.
1. It is
in conjuction with AVR Studio
theory, it can do C++
Support is spotty
has a few sharp edges
Documentation is sometimes difficult to find.
However, overall, it is the best
in my opinion, for the AVR. If you need a software
system, I can highly recomend AVR Studio (Atmel), WinAVR, and
JTAGICE Mk II (Atmel). The JTAGICE is the only thing you will
have to pay for. It is quite pricecy, but well, not
life is free.
And also, there are many free packages
that work with WinAVR, like FRERTOS.
2. I also originally used the
most of my projects. However, it, and it's successor, the
ATMega8515 do not have a JTAG interface, which makes using it a bit of
a problem when it comes to debugging firmware. I am now
to use the ATMega128 and ATMega2561. More than enough
space, plus 4K and 8K of ram respecfully.
I am also working on porting my RTOS
over to the the
AVR running under WinAVR. Right now, the only problem I am
is trying to figure out how to deal with interrupts. This is
as easy as it would seem. But, I am working on it.
Sept 30, 2001