Trial to enhance the porting guide

Hello RIOT developers, I have now made some experience with RIOT-OS and I'm working on a port to the STM32L073. My problem is sometimes to understand the relationship between the OS parts. The source code documentation via Doxygen is nice, but not sufficient to get a real understanding about the architecture of RIOT and I'm a unhappy to find out how some parts are working by "surfing" through the source code. Therefore I will try to enhance the porting guide and therefore I will ask you (maybe) some silly questions.....but I think the questions I will ask are somehow unclear to a RIOT newbie. The first question I have is about the xtimer. What is the "official" purpose of this timer. What should be realised via the xtimer and what should be realised by the other timers. The second question - which event triggers the thread context switching? Scheduled by timers?

Best regards Bernhard Best regards, Bernhard

Hi Bernard,

Regarding the scheduling of threads: http://riot-os.org/api/group__core__sched.html Is this insufficient, or did you just overlook it?

Cheers, Ludwig

Hi Bernhard,

it's been a while :-). Nice to see you are on RIOT again! I agree that the wiki might need some enhancements here and there. It is editable for anyone and I'd be happy if you could fill some gaps when porting your board. I'll try to answer your questions

In contrast to other OSes we did not want to have several timers for different use cases. In RIOT you'll find two timer APIs: (i) periph/timer and (ii) xtimer. (i) was intended to provide the slimmest possible abstraction on top of real hardware timers. (ii) is a unified API which makes use of the periph timer. It takes values in seconds (not in ticks) and converges between both, it handles intervals longer than overflow periods, it is able to multiplex a single hardware timer and in the end it "hides" the complexity of multiple timers on diverse hardware.

Ludwig already pointed you to the scheduler doxy. In short there are the following "events" that cause a context switch (afaik): - external interrupts jump into the ISR (obviosly) - a higher prioritized task/thread occurrs (e.g. in ISR context or so) (- a higher prioritized is woken up manually) - manually yielding a thread - ending a thread or letting it sleep

That's (nearly) all I know.

Regards Peter