[Tinyos-devel] Bug in Stm25pLogP.nc

Chieh-Jan (Mike) Liang cliang4 at jhu.edu
Wed Jun 6 13:48:00 PDT 2007


Please correct me if I am wrong, but there is a bug in 
Sector.readDone[uint8_t id](...) in tos/chips/stm25p/Stm25pLogP.nc. The 
lines in question are:

320 uint8_t block = addr >> BLOCK_SIZE_LOG2;
...
329 if (++block < (call Sector.getNumSectors[ id ]()*BLOCKS_PER_SECTOR))

block is 8-bit, or 0 - 255. In the extreme case, I can have my log 
volume occupy the whole STM25P flash (16 sectors), which would make the 
right-hand side of the condition 256. Therefore, line 329 will always 
return FALSE.

My proposal is to change line 320 to "uint16_t block = (addr >> 
BLOCK_SIZE_LOG2) & 0xFF;"

Thank you

Mike


More information about the Tinyos-devel mailing list