[Tinyos-devel] TinyOS on Cortex M3?

Paul Kimelman paul at nikoosha.com
Thu Mar 13 11:26:32 PDT 2008


...
> possible to read a value from memory (byte, half, word, or bit),

Note that Thumb-2 fully supports read from memory by: byte (sign and unsign 
extend), half (sign and unsign extend), word, double-word, and of course CM3 
supports bit (bit-band). All that said, it is important to remember that because 
it uses 32-bit registers, you want your local variables to be 32-bits when at 
all possible (locals are in registers most of the time, in the stack if must be, 
but stack is also word oriented); so int and unsigned locals, your memory bound 
variables can be bit, byte, half, or word happily. The code generation for 
dealing with local variables as short or char for arithmetic and many logical 
uses is not pretty. So, this should be considered when porting code (especially 
since the opposite is the case with 8 and 16 bit parts).

...
> .could be good for T2 atomic data transferring.....

Yes, any time you can get away from critical sections, it is a big advantage. 
The FIFO feed/drain model between a device ISR and a task is an optimal one for 
messaging since you add no overhead. Further, critical sections tend to create 
interrupt jitter and worse, interrupt alignment (interrupts tend to start 
occurring together since the critical section aligns them on the enable). Of 
course, that said, CM3 is optimized for interrupt stacking. It will tail chain 
(does not pop and repush registers) and it will favor late arriving high 
priority interrupts (so avoid a nested preemption and also ensuring best 
response time).

> Finally the bit-band . . . .The bit band not only allows for memory
>> savings (when you use boolean data), but can be used for critical data 
>> as well. Writes to the bit-band area are atomic in HW (implicit RMW of 
>> word cannot be split by an ISR). .
> .
> .
> also good for atomic data like in a radio stack, or a sensor like an 
> image sensor
> where the data is flowed along in "synchronous" mode small chunks, 
> without interrupts,
> and has to be atomic.  Image sensor CCD rows could fill up a bit band 
> and then you empty that into packets...

Yes, this works well when you have to do col/row swaps during read in or read 
out. It also avoids the shift/OR loop problems.

> Sounds nice, but...  not starting that port today :-)
> Are you?

Nope, sorry. I have enough on my plate right now. It is something I would look 
at in late Summer (if no one else has done it) as the timeline matches up with 
some other things going on.

Regards, paul

> John Griessen



More information about the Tinyos-devel mailing list