Page 70 - Fister jr., Iztok, Andrej Brodnik, Matjaž Krnc and Iztok Fister (eds.). StuCoSReC. Proceedings of the 2019 6th Student Computer Science Research Conference. Koper: University of Primorska Press, 2019
P. 70
sh commands (prefix 00) are simple write commands that Modem Flow Read/Write
can be used either in the Bootstrap or the full Operating
System mode. The predefined nature of the flash allows us Restart Flash Procedure Flash storage
to overwrite any scenario and core software. The command
starts with a location in the microcontroller flash, followed Write raw data into sector Original rom image
by the length of the data to be written and the binary data
itself. The structure can repeat to the end of the packet. Write raw data into sector Mutable rom image

2.3.2 Settings Commands Schedule settings
Verify hashes
The settings command (prefix 01) is attached to a scenario
and therefore used with the Scenario id to find the location of Restart and Flash
the settings block in microcontroller flash. The predefined Re-Initialize settings
length provides safety from overflows. This structure can Restart and run new rom
repeat to the end of the packet.
Time
2.3.3 Control Commands
Figure 5: Timeline of a ota flash and re-initialization
Control commands are used to control task using their no- (left) with the flash layout (right)
tification variable directly and can, in most cases, be only
run within the full operating system mode. This structure block is initialized. Finally, the tasks of the scenario are run
is composed of 3 bytes that are available as parameters sent and placed into a infinite wait state.
to the task.
2.6 Conclusion
2.3.4 System Control Commands
The inspiration for designing such a system derives from a
System control commands use the same pattern as sim- separate student project designing a floating sensor device,
ple control commands, but they use the predefined system intended for data gathering in the ocean. As such, proposed
namespace. These commands can be used in either Boot- implementation centers around the need for an embedded
strap or Operating System mode and are used for tasks like autonomous system with the primary goal of collecting data
flashing, rebooting, and other non-scenario tasks. depending on detected conditions, available energy reserves,
and network availability or cost. The lifetime of such a de-
2.4 Over-the-air flash procedure vice is expected to exceed a year. Therefore the system also
takes into account the need for remote over the air system
Changing any part of the software, including the Bootstrap, updates and changing of execution parameters.
system procedures, and scenarios can is accomplished with
the flash procedure using system control commands. Current anticipated technical difficulties, regarding a work-
ing implementation on an actual microcontroller, revolves
The procedure should be started by resetting the mutable around physical memory or flash partitioning for remote up-
image on the flash storage with an exact copy of the original dates, memory allocation and number of tasks being able
software in the microcontroller flash. The next steps are to run or ques being able to exist as buffers and operating
done using the flash commands to write changes into the data storage, and the ability to correctly estimate the power
mutable image. The last step is sending the flash system available to the system for proper task execution.
command with the hash of the image that we want to write
into the boot storage. 3. REFERENCES

If the prepared image hash does not match the provided [1] R. Goyette. An analysis and description of the inner
value, a critical message is sent to the server, and the pro- workings of the freertos kernel. Carleton University, 5,
cedure is broken off. If the hash does match, the system is 2007.
rebooted, the new image is written to the appropriate sector,
and the bootstrap procedure started. [2] J. Hutcheson and M. Laurin. Network flexibility of the
iridium (r) global mobile satellite system. 1995.
In the event of a critical failure, the server can send a com-
mand that flashes the original image to the appropriate lo-
cation and repeats the bootstrap procedure. Alternatively,
if desired, a complete custom image cand be sent at the
expense of increased network data usage.

2.5 Bootstrap

Bootstrapping the system involves loading all the scenarios
into memory. All the generic scenarios are stored in consec-
utive fixed width blocks with a header. The loader reads the
header of each block for a magic number to see if the block
contains a scenario and tests the checksum. If successful,
the settings pointer is checked and if needed, the settings

StuCoSReC Proceedings of the 2019 6th Student Computer Science Research Conference 70
Koper, Slovenia, 10 October
   65   66   67   68   69   70   71   72   73   74   75