3. Launch Core and Scheduling - RIT-Launch-Initiative/Liftoff-Project GitHub Wiki
Intro
Launch-Core is a set of header-only libraries the software team develops to support development of other software we write. This ranges from non heap based data structures to networking standard implementations. The key purposes that launch-core is used in flight software is to have platform independent software (software that is not specific to one platform such as STM32 or Linux) and drivers that interface with our custom scheduler(s). Launch-Core uses a custom scheduler to reduce wasted time (i.e a busy communication protocol bus) and allows other tasks to run in the meantime.
Scheduler Macros
Fortunately, you don't need to know how the scheduler is implemented, just how to use it. However, it would be nice to know how it currently works under the hood. You can read about how to use the scheduler and its implementation here. General rule of thumb is, if you're calling a function that uses these macros, you must also use those macros.
HAL Abstractions
As mentioned previously, launch-core is meant to be platform independent. Therefore, if you were to use an STM32, you would not call HAL functions directly. Instead you would instantiate a class related to the controller you are trying to use that calls those functions under the hood. These classes are then passed into a class based implementation of the driver you are trying to support (dependency injection!). You can refer to platforms to see how a platform is implemented. You can also look at some of these peripherals to see how a device driver implementation interfaces with a controller class.
Exercises (Estimated Time: 15 minutes)
- Run
git submodule update --init
to get launch-core in your repository. - Uncomment the commented out lines in CMakeLists.txt. You will need to rerun
cmake ..
within your build folder before compiling. - Convert the functions you previously wrote to utilize launch-core. There are peripheral drivers already available for you to use you can just call. You should already know how this works under the hood based on the past chapter.
- Initialize the scheduler in your main code and run it.