Overview
This document covers how LaminarOS is structured within its Github repo.
Requirements
CMake and GNU are required to build this library, please follow this guide for the necessary tools: Firmware Development Environment Setup
Folder Structure
The following is the current folder structure of the LOS github repo. This folder structure should not have to change too much in the future.
LaminarOS
-CMakeLists.txt
-/Los_Interface
-Src
-Inc
-/Los_Drivers
-Src
-Inc
-/Los_Core
-Src
-Inc
-/Boardfiles
-/nucleof401re
-/nucleol552zeq
-/Tools
Lets go through each directory and present what type of files should be going in there. Although not a directory, the CMakeLists.txt is the file responsible for compiling every single file within the LOS project into a library (.a) file (you do not have to know how this file works unless major changes are to be made to the folder structure).
As for LOS_Interface, LOS_Driver, and LOS_Core, each of these directories has a Src and Inc folder. No further folder should be added to these directories. The Src folder are for source files and the Inc folder are for the header files.
It is likely that any configuration header files will go into the LOS_Interface/Inc/ directory.
The Boardfiles directory holds subdirectories to the board package that LOS should have support for. Within those subdirectories, should lie the STM32CubeIDE generated project along with all the generated files.
Finally, the Tools directory holds any scripts or software tools that would be useful for development. Currently, there is a build bash script that will build the CMakeLists.txt and compile the code all in one step with argument to select the board package to build for.
Adding Support for a New Board Package
How the CMake Works
Proposal
LOS will act as a “library” for ZP software and any other projects that would like to utilize the interface. To avoid any unforeseeable issues with building LOS within other projects in STM32CubeIDE (remember the project files are within the LOS repo) we will be using CMake and Makefiles to build our project.
LOS will have a local CMake file that will build interface, drivers, and core along with all boardfiles. A CMake arg can be used to build for the different boardfile projects.
Other software (such as ZP) that will be using LOS will have their own CMake to build their project files along with LOS.
Since main.c will be in LOS in the boardifles directory, it has to have some way to initialize the freeRTOS threads from ZP sw without know of their existence to avoid having it depend on anything from ZP sw. To do this, LOS interface will define a weak function (“LOS_init_threads”?) that will be overridden by ZP sw. Ideally, some part of ZPsw overides this function and call the LOS interface to initialize the freeRTOS threads for all state machines, most notable AM, PM, and TM. Then in main() the function will be called, initializing all threads and the kernel will be started. This way LOS doesn’t have to know about the threads being run, not depending on ZP sw.
Add Comment