The fprime/Os/Baremetal/CMakeLists.txt file always adds the Baremetal Os abstractions of File, FileSystem, IntervalTimer, Mutex, Queue, SystemResources, Task when defining the FPRIME_USE_BAREMETAL_SCHEDULER flag. So even if an external package that attempts to create a specific Os abstraction (i.e. File), the Os/Baremetal/___.cpp versions will always be used instead of the external package.
Reproduce Bug
We can use the existing IntervalTimer.cpp file in fprime-arduino as an example, as that is expected to override the Os/Baremetal/IntervalTimer.cpp within fprime.
Simply call the IntervalTimergetRawTime() function. It will call the function inside of the fprimeOs/Baremetal version instead of fprime-arduino's version.
Suggestion
The FPRIME_USE_BAREMETAL_SCHEDULER flag should only replace the Task Scheduler to use the Baremetal implementation, not add all of the other Baremetal Os abstractions. The baremetal package(s) should be the ones adding those baremetal abstractions (see how fprime-arduino is doing it here.
Why
A File.cpp abstraction for the fprime-arduino package is currently in development as it is needed for fprime-artemis-cubesat to replace the Baremetal implementation, which currently does nothing.
Temporary Solution
The following lines were commented out in the CMake file:
Problem Description
The
fprime/Os/Baremetal/CMakeLists.txt
file always adds the Baremetal Os abstractions of File, FileSystem, IntervalTimer, Mutex, Queue, SystemResources, Task when defining theFPRIME_USE_BAREMETAL_SCHEDULER
flag. So even if an external package that attempts to create a specific Os abstraction (i.e. File), theOs/Baremetal/___.cpp
versions will always be used instead of the external package.Reproduce Bug
We can use the existing
IntervalTimer.cpp
file infprime-arduino
as an example, as that is expected to override theOs/Baremetal/IntervalTimer.cpp
withinfprime
.IntervalTimer
getRawTime()
function. It will call the function inside of thefprime
Os/Baremetal
version instead offprime-arduino
's version.Suggestion
The
FPRIME_USE_BAREMETAL_SCHEDULER
flag should only replace the Task Scheduler to use the Baremetal implementation, not add all of the other Baremetal Os abstractions. The baremetal package(s) should be the ones adding those baremetal abstractions (see howfprime-arduino
is doing it here.Why
A
File.cpp
abstraction for thefprime-arduino
package is currently in development as it is needed forfprime-artemis-cubesat
to replace the Baremetal implementation, which currently does nothing.Temporary Solution
The following lines were commented out in the CMake file:
Instead, these are linked within the Os abstraction of
fprime-arduino
here.For example, if I choose to override the Baremetal
File.cpp
version, I simply replace:with: