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