Hi!

On Wed, 7 May 2008, jiwen zhang wrote:

> Hello all :
>   when i read the file TOSBootM.nc , there are some things i can' t 
> understand !
>
>  1. The external flash is divided into three slots , *i want to know the size 
> of every slot ? are they identical ?*
>  from reading the TOSBootM , i think the *structure of every slot *is that:
>
> for example , slot 0 :
>                 ----------------------------------------------------
>                          DELUGE_IDENT_SIZE (128 Bytes)
>                 ----------------------------------------------------
>
>                      DELUGE_CRC_BLOCK_SIZE(256 Bytes)
>
>                 -----------------------------------------------------
>                                   PAGE 0
>                                   PAGE 1
>                                   ...........
>                                   ...........
>
>
> and *PAGE structure* is that :
>
>                  ---------------------------------------------
>                        Internal flash Address  (4 Bytes)
>                  ---------------------------------------------
>                               Page length(4 Byte)
>                  --------------------------------------------
>                           Effective Image data()
>                   -------------------------------------------
> Am i right ?  i am not sure the page structure , if i am not right , can
> someone give me an explain ?

You are almost right: what you call pages are called sections.

> 2. Question about the function of  programImage(ex_flash_addr_t startAddr)
>
>      .....
>      .....
>
>
>    while ( secLength ) {
>
>      pageAddr = newPageAddr = intAddr / TOSBOOT_INT_PAGE_SIZE;
>
>      call ExtFlash.startRead(curAddr);
>      // fill in ram buffer for internal program flash sector
>      do {
>
> // check if secLength is all ones
> if ( secLength == 0xffffffff ) {
>   call ExtFlash.stopRead();
>   return FAIL;
> }
>
> buf[(uint16_t)intAddr % TOSBOOT_INT_PAGE_SIZE] = call ExtFlash.readByte();
> intAddr++; curAddr++;
>
> if ( --secLength == 0 ) {
>   intAddr = extFlashReadAddr();
>   secLength = extFlashReadAddr();
>   curAddr = curAddr + 8;
> }
>
> newPageAddr = intAddr / TOSBOOT_INT_PAGE_SIZE;
>
>      } while ( pageAddr == newPageAddr && secLength );
>      call ExtFlash.stopRead();
>
>      call Leds.set(pageAddr);
>
>      // write out page
>      if (call ProgFlash.write(pageAddr*TOSBOOT_INT_PAGE_SIZE, buf,
>          TOSBOOT_INT_PAGE_SIZE) == FAIL) {
> return R_PROGRAMMING_ERROR;
>      }
>    }
>
> i don't know *how the programme jump out the while cycle*.  because the
> condition of jumping out the while cycle is that "secLength <= 0" , but in
> the while  , there is some sentences :
>
>     if ( --secLength == 0 ) {
>   intAddr = extFlashReadAddr();
>   secLength = extFlashReadAddr();
>   curAddr = curAddr + 8;
> }
>
> *so when secLength == 0 , it will be given a new value (which is the next
> page size ?) , how does it jump out ?*
>
> *is it possible that it jump out from here ? :*
>
> if ( secLength == 0xffffffff ) {
>   call ExtFlash.stopRead();
>   return FAIL;
> }
>
> i am not sure, can someone give me an explain ?

The secLength will be zero because the image is padded with zeros. If the 
image is an exact number of pages the reprogramming might fail. I'll try 
to reproduce this bug tomorrow.

--
Razvan ME

> 2008/5/7, jiwen zhang <[EMAIL PROTECTED]>:
>>
>> Hello :
>>    thank you very much for your reply, Razvan ME.
>>    i have found it .
>>
>>
>>
>>
>> 2008/5/7, Razvan Musaloiu-E. <[EMAIL PROTECTED]>:
>>>
>>> Hi!
>>>
>>> On Tue, 6 May 2008, jiwen zhang wrote:
>>>
>>> Hello all :
>>>>  Recently , i an researching the deluge, and find a problem in TOSBootM.
>>>>  In the function programImage(ex_flash_addr_t startAddr) , there is a 
>>>> sentence
>>>>  #if defined(PLATFORM_TELOSB)
>>>>   if (intAddr != TOSBOOT_END) {
>>>> #elif defined(PLATFORM_MICAZ) || defined(PLATFORM_IRIS)
>>>>   if (intAddr != 0) {
>>>>      ....
>>>>      ....
>>>>
>>>>   I can't find where TOSBOOT_END is defined . if i am using the platform 
>>>> telosb , maybe it does't work .
>>>>   can someone give me an answer ?
>>>>
>>>
>>> TOSBOOT_END is defined in tinyos-2.x/tos/lib/tosboot/Makefile.
>>>
>>> --
>>> Razvan ME
>>>
>>>   I am using Tinyos2.x .
>>>>   thank you !!
>>>>
>>>>
>>
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to