Hi Leon,
"ReprogramGuard.okToProgramDone" is an event signaled by other
components. Maybe you were confused with
"ReprogramGuard.okToProgram()" command called in
"NetProg.programImageAndReboot", and
"ReprogramGuard.okToProgramDone()" event?
Mike
On May 10, 2009, at 8:37 AM, Leon Steenkamp wrote:
> In tos\lib\net\Deluge\extra\NetProgM.nc there is the following:
>
> --<SNIP>--
> command error_t NetProg.programImageAndReboot(uint32_t imgAddr)
> {
> reprogramImgAddr = imgAddr;
> return call ReprogramGuard.okToProgram();
> }
>
> event void ReprogramGuard.okToProgramDone(bool ok)
> {
> BootArgs bootArgs;
>
> if (!ok) {
> // The voltage is too low. Nothing to do.
> return;
> }
>
> atomic {
> call IFlash.read(TCAST(uint8_t*
> COUNT(sizeof(bootArgs)),TOSBOOT_ARGS_ADDR), &bootArgs,
> sizeof(bootArgs));
>
> bootArgs.imageAddr = reprogramImgAddr;
> bootArgs.gestureCount = 0xff;
> bootArgs.noReprogram = FALSE;
> bootArgs.address = TOS_NODE_ID;
>
> call IFlash.write(TCAST(uint8_t*
> COUNT(sizeof(bootArgs)),TOSBOOT_ARGS_ADDR), &bootArgs,
> sizeof(bootArgs));
>
> // reboot
> netprog_reboot();
> }
> }
> --<SNIP>--
>
> I am using TelosB platform and when NetProg.programImageAndReboot is
> called not much happens and I guess its because
> ReprogramGuard.okToProgram() is called with no argument. And if (!
> ok) is always true.
>
> Am I missing something? or is there a problem with the code? I
> changed the "if (!ok)" to "if (ok)", the node now reboots but it
> does not seem to be reprogrammed.
>
> Leon
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help