Module build system

miknix Aljaž Srebrnič

Introduction

The menu config has been reworked to be entirely modular, that is, make config now automatically generates the module list according to the modules available in the modules/ directory. Basically, if you want to create a new "test" module, you just have to do the following:

  1. Put test.c and test.h into modules/ directory
  2. Create modules/test.cfg with something like the example below
  3. Then your module MUST export a mod_test_init() function. This function will be called upon chronos initialization. This is the place where you should register into the message bus, for example. If your "test" module is to be shown in the menu, you should also call menu_add_entry().

This effectively removed a lot of #ifdefs and most importantly, removed cross-code dependencies and decreased firmware size.

Module config file syntax

Suppose you are implementing a "date" module. The first section in the config file must be the module name in UPPERCASE. Then you can optionally add other sections always prefixed with the module name. They represent optional functionality which is provided by your module. Consider the following config file:

[DATE]
name = Date
default = true
help = Shows current date

[DATE_DOW]
name = Day of Week
default = true
help = Shows day of week in date

When doing make config, this config file will be displayed as

Modules
[ X] Date
[ X]  +- Day of Week

Selecting those items will make the build system automatically define CONFIG_DATE and CONFIG_DATE_DOW in config.h. The build system will also automatically add mod_date_init() into modinit.c. mod_init() is called during firmware initialization.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks