[riot-users] [Newbie] Design guidance

Kaspar Schleiser kaspar at schleiser.de
Mon Aug 3 16:39:09 CEST 2015


Hey,

On 08/03/2015 03:51 PM, jerome wrote:
> - 2 queues
> - 3 Timers
> - 1 thread + main one
> Is it possible to run such design on small devices? Not too ambitious?
That should well be possible!

> Is there somewhere an abacus with typical application complexity for a
> given hardware ?
Usually you will run into memory problems first, as every thread needs 
it's own stack.

Simple threads might be OK with a 200byte stack (like our idle thread), 
printf needs ~1k of extra stacksize. So in ~2k stack, you can do a lot. 
If you've got 16k to spare, 10 threads is not ambitious, depending on 
what exactly they're doing.

> 4) I saw somewhere in the source code a strange excerpt dealing with
> message-queue where there 's  a problem if 2 messages come (the message
> queue is sized to one only message) so a new one is created...
> Strange, why not sizing the queue to 2 ?
IIRC that is taken from one of the test cases.

The issue is that a thread in that test is waiting for messages from an 
ISR. The ISR cannot block on sending a message, so if it tries to send a 
message while the thread is busy, that message gets lost. By design of 
the test that thread can at most miss one message, so it set's up a 
message queue that can hold exactly that message.

Cheers,
Kaspar


More information about the users mailing list