MansOS new platform
Suppose you want to add a new hardware platform for MansOS. Here is a list of tasks and files you need to create or edit.
First, choose a unique but short name for your platform, such as XYZ, which is used in this document.
Then you will have to create and adapt makefiles for the build process and source code for HPL and HAL layers.
Make system
Make system is located in /mos/make.
- Add XYZ in Makefile.options to the list of platforms:
PLATFORMS ?= pc telosb ...
- Create a new Makefile.XYZ under the platforms directory. This makefile will be included by the main make system.
This file must refer to the platform specific code that needs included for the header file locations and compilation of the application. It also defines how to upload the compiled code to the target platform.
Arch - Architecture
Unless your main processor or controller (such as msp430) architecture is already supported, add a directory under /mos/arch/ named XYZ and place all the platform code there.
HPL - Chips
Add code for all the chips your platform will use. Hopefully some are already implemented. For the new chips create a directory under /mos/hpl/chips/ and place all the source files specific to this chip there.
HAL - Platforms
Add a directory under /mos/platforms/ named XYZ and place all the platform code there.
For example, you will need to define LEDs for the platform.
HIL - Interface
There should be no changes in /mos/hil/ code. However, you may look up this code because it is calling the code that you will be adding. This is where you may spot the proper names for the include files to use in yout HAL section, such as usart_hal.h.
Compilers
If you are using a compiler that is related to gcc, such as msp430-gcc, you may not need to add special handling for the compiler flags. Compiler specific make details are defined in Makefile.gcc Another compiler that MansOS is using for certain platforms such as nrf is SDCC.
If you are using another type of compiler, you may specify the options in the platforms/makefile.XYZ file, or include a separate file if the compiler is widely used for other platforms or will be in the near future.
Test
Test the build process on a simple application first, such as Blink.
cd apps/demo/Blink make XYZ
Once the compilation seems to work, you may want to test the upload process to tyhe actual platform:
make XYZ upload