-
Notifications
You must be signed in to change notification settings - Fork 139
Date on the BeagleBone
The BeagleBone Black and the BeagleBone Green have no on-board battery so that the system date gets lost at every reboot and get reset to the 26th of August 2013. This means that every time you power up the board, you may have troubles if you want to rely on the date for any of the things you are doing.
For this reason, the date on the board is set every time there is a chance or a need to do so. The date on the board is set to the same date as your computer in the following cases:
- every time you connect to the IDE. The
node.js
server running on the board will ask the date to your web browser and use that value to set the date on the board. - the build scripts (
build_project.sh
orbuild_pd_heavy.sh
) will set the date on the board invoking thedate
command on your machine, before copying the files to the board. - if you connect the board to a wired or wireless network
The building process, which compiles the C/C++ files on the board into object files and then links them together to create the executable binary file which is ultimately executed, heavily relies on the modification date of the source and output files.
Every time the build process is started, the make
program, which takes care of it, checks if each output file is more recent than its respective source file. If that is the case, the output file is considered to be "up-to-date" and the build process is not repeated for that file. The underlying reason for this is that compiling files and linking them takes time and you do not want to re-compile all the files every time you change a line on one of them.
The process described above works just fine in systems where the date is mostly monotonically increasing, where "mostly" means that occasional skews of a few seconds or fractions of seconds happen when the date is synchronized to an external server.
If the date on Bela is not synchronized with an external reference, troubles could happen during the build process. Typically, it could happen that a modified source file does not get recompiled, or the executable file does not get re-linked. An easy solution for this is to remove the .o
build files and the executable file. This can be done by calling make
with the projectclean
target, as explained [here](The Bela Makefile).
Luckily, this is not needed most of the time, virtually never, but it is good to remember it in case you ever get the weird behaviour of your changes to the source files not being reflected on the built program.