This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

newlib sw architecture vision on bare-metal



Hi list,

I'd like to call myself a newlib newbie, although I've been relying on
newlib for some time now already.
Anyhow, after having googled around for undefined references to _exit,
_kill, _getpid and _sbrk and having found the most bizarre answers to
these kind of issues, I realized that I'm probably not understanding
very well the software architecture that newlib is supposed to be framed
within.

I'm trying to learn such architecture through the assumptions made by
newlib. A sketch that possibly fits could be the following:

http://www.altera.com/devices/processor/images/n2-emb-peripherals-small.gif

According to it, the most suitable place for the above mentioned
function's implementations would be in the Hardware Abstraction Layer of
the target. Is this a good choice?

Also, I assume that newlib does not expects (relies) on a OS in a
bare-metal implementation.
But, assuming an OS exists, are there principles to follow in the way
the two packages (OS and newlib) relate one with each other?

For example, would it be correct to have accesses to low level
peripherals pass through the OS control (OS on top of newlib sw package)?
Or should the OS just take care of sharing the CPU among tasks and let
the low level peripherals access be managed directly by newlib (OS side
by side with newlib)?

I'm a bit confused cause I've always imagined the OS to be the tool for
different user codes to share common resources. So I wonder for instance
why I do find "reentrant" function definitions in newlib.

Reentrancy issues are generally avoided by asserting atomicity for a
piece of code (disabling interrupts), or via semaphores/mutex locking.
Typically interrupts disabling is wisely used for very small operations,
whereas OS mutexes and semaphores are used in those cases where the
procedure requires a rather long amount of time/computational power.. Is
and how is reentrancy managed in newlib as it is agnostic of the concept
of OS in bare-metal implementation?

I think the answers to my questions should be found in a reference
manual or somewhere in a well documented format, so if you know
references I'd appreciate if you could share.

Thanks,
RM



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]