Skip to content

Commit

Permalink
Merge pull request #1398 from bitcraze/rik/bl
Browse files Browse the repository at this point in the history
Enhance Makefile for OOT app layer builds
  • Loading branch information
gemenerik committed Aug 8, 2024
2 parents 44ef098 + 2e77b88 commit 515dedc
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/development/oot.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ If you have header files in another folder, use `EXTRA_CFLAGS` in the Makefile t
EXTRA_CFLAGS += -I$(PWD)/src/inc
```

And since you are providing a config file by way of `$(OOT_CONFIG)` you do not need to run any make command to create a config like `make menuconfig` or `make defconfig`. Just a simple `make` will suffice.
OOT builds can be configured with [Kbuild](https://www.bitcraze.io/documentation/repository/crazyflie-firmware/master/development/kbuild/) using terminal interfaces like `make menuconfig` or by loading a default configuration, such as with `make cf2_defconfig`. Any definitions in $(OOT_CONFIG) will override conflicting settings.

## OOT estimators
The `config` file needs to enable ESTIMATOR_OOT, and can also set other config options:
Expand Down
4 changes: 4 additions & 0 deletions docs/userguides/app_layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ obj-y += your-app.o

You can look at the applications in the `examples/` folder of the firmware repository.

## Configuring the app layer

The app layer can be configured with [Kbuild](https://www.bitcraze.io/documentation/repository/crazyflie-firmware/master/development/kbuild/). Default configurations can be loaded by running `make cf2_defconfig` in the app directory. Terminal based user interfaces ('menuconfig', 'nconfig', 'gconfig', 'xconfig') can be used to configure the app layer by e.g. running `make menuconfig` in the app directory. Note that if there are any conflicting settings, the values defined in `app-config` will take priority.

## Building the app layer

In order to build the app layer, go to the root folder of the app example and run:
Expand Down
38 changes: 34 additions & 4 deletions tools/make/oot.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,50 @@ OOT_CONFIG ?= $(OOT)/oot-config

OOT_ARGS ?= -C $(CRAZYFLIE_BASE) OOT=$(OOT) EXTRA_CFLAGS="$(EXTRA_CFLAGS)"

CONFIG ?= alldefconfig
DEFAULT_CONFIG ?= alldefconfig

ifneq ($(OOT_USES_CXX),)
OOT_ARGS += OOT_USES_CXX=1
endif

.PHONY: all clean
.PHONY: all clean menuconfig nconfig xconfig gconfig cload

%_defconfig:
@if [ -f $(CRAZYFLIE_BASE)/configs/$@ ]; then \
echo "Loading defconfig $@ from configs folder"; \
$(MAKE) KBUILD_OUTPUT=$(OOT)/build $(OOT_ARGS) KCONFIG_ALLCONFIG=configs/$@ $(DEFAULT_CONFIG); \
else \
echo "Defconfig $@ not found in configs folder"; \
exit 1; \
fi

all:
$(MAKE) KBUILD_OUTPUT=$(OOT)/build $(OOT_ARGS) KCONFIG_ALLCONFIG=$(OOT_CONFIG) $(CONFIG)
$(MAKE) KBUILD_OUTPUT=$(OOT)/build $(OOT_ARGS) -j 12
@if [ ! -f $(OOT)/build/.config ]; then \
$(MAKE) KBUILD_OUTPUT=$(OOT)/build $(OOT_ARGS) $(DEFAULT_CONFIG); \
fi
@if [ -f $(OOT_CONFIG) ]; then \
echo "Merging $(OOT_CONFIG) into .config"; \
$(CRAZYFLIE_BASE)/scripts/kconfig/merge_config.sh -O $(OOT)/build -m $(OOT)/build/.config $(OOT_CONFIG); \
else \
echo "$(OOT_CONFIG) does not exist"; \
fi
$(MAKE) KBUILD_OUTPUT=$(OOT)/build $(OOT_ARGS) oldconfig
$(MAKE) KBUILD_OUTPUT=$(OOT)/build $(OOT_ARGS)

clean:
$(MAKE) KBUILD_OUTPUT=$(OOT)/build $(OOT_ARGS) clean

menuconfig:
$(MAKE) KBUILD_OUTPUT=$(OOT)/build $(OOT_ARGS) menuconfig

nconfig:
$(MAKE) KBUILD_OUTPUT=$(OOT)/build $(OOT_ARGS) nconfig

xconfig:
$(MAKE) KBUILD_OUTPUT=$(OOT)/build $(OOT_ARGS) xconfig

gconfig:
$(MAKE) KBUILD_OUTPUT=$(OOT)/build $(OOT_ARGS) gconfig

cload:
$(MAKE) KBUILD_OUTPUT=$(OOT)/build $(OOT_ARGS) cload

0 comments on commit 515dedc

Please sign in to comment.