AVR os-less OSAL Topic is solved

ChibiOS public support forum for topics related to the Atmel AVR family of micro-controllers.

Moderator: tfAteba

Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: AVR os-less OSAL

Post by Marco »

Ok, attached are two patches. One for the nop insructions in osal.h and the other one for hal_serial_lld.c.

Marco
Attachments
osal.h.patch.zip
Add nop after sei
(362 Bytes) Downloaded 617 times
hal_serial_lld.c.patch.zip
Improvements in hal_serial_lld.c
(588 Bytes) Downloaded 699 times
utzig
Posts: 359
Joined: Sat Jan 07, 2012 6:22 pm
Has thanked: 1 time
Been thanked: 20 times

Re: AVR os-less OSAL

Post by utzig »

Applied, thanks!
Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: AVR os-less OSAL

Post by Marco »

Hi,

I'd like to use a virtual timer in the AVR os-less OSAL. Is it possible to make the vtSetI and vtResetI functions public?

Marco
utzig
Posts: 359
Joined: Sat Jan 07, 2012 6:22 pm
Has thanked: 1 time
Been thanked: 20 times

Re: AVR os-less OSAL

Post by utzig »

Hi,

The rationale for it being the way it is, is something that only Giovanni will know. But IMO we could make vtIsArmedI, vtSetI and vtResetI public. I would suggest changing the names to something like osalVtIsArmedI, osalVtSetI, osalVtResetI.

Also it bothers me a lot that os-less/ARMCMx/osal.c and os-less/AVR/osal.c have the same contents. Maybe moving one of them to "common" and updating the makefiles?

Giovanni, what do you think?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: AVR os-less OSAL

Post by Giovanni »

Hi,

Those function do not belong to the "osal" namespace because the underlying OS could (and usually does) have its own timeout mechanism, see RT and NIL for example. RT has virtual timers, NIL does it differently.

Giovanni
Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: AVR os-less OSAL

Post by Marco »

Hi Giovanni,

I understand, but since there is no underlying OS there is no timeout mechanism available. Since the os-less OSAL already has a timers implementation i thought it can be made public so the application can use it as well.

Marco
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: AVR os-less OSAL

Post by Giovanni »

You can make it public, I didn't want to establish it as a standard OSAL API.

Perhaps I should make those VTs a GPL library and make those available even without the OS, it is an useful and well tested mechanism.

Giovanni
Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: AVR os-less OSAL

Post by Marco »

Yes that would be a good solution i think. On the other hand, i guess that means the user needs it's own timer implementation if he doesn't want GPL?

Marco
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: AVR os-less OSAL

Post by Giovanni »

It could be Apache 2.0, no problems, but in that case I couldn't add a "tickless" mode like in RT. Note that the timers in OSAL are a stripped down version of those in RT.

Giovanni
Marco
Posts: 128
Joined: Tue Apr 16, 2013 8:22 pm
Has thanked: 4 times
Been thanked: 11 times

Re: AVR os-less OSAL

Post by Marco »

I'm not sure if the following makes sense, but how about having two different implementations? A ticked version as Apache 2.0 and a tickless version as GPL? You can always use the ticked version but if you need a better (lower power) version then you need the tickless one.

Marco
Post Reply