Build System¶
Mira comes with a build system based on GNU Makefiles to build, link and flash the example applications. It assumes the needed programs are in the program search path (PATH).
Example¶
A minimal Makefile using Mira's build system is:
PROJECT_NAME = our_app
TARGET ?= nrf52832ble-os
LIBDIR ?= $(CURDIR)/../../..
SOURCE_FILES = \
main.c
include $(LIBDIR)/Makefile.include
Variables¶
The following variables can be set in makefiles (or on the command line to make):
- CFLAGS - arguments passed to the compiler.
- LDSCRIPT - the name of the linker script used (default depends on TARGET).
- LDSCRIPT_DIR - where
$(LDSCRIPT)
is (default depends on TARGET). - LIBDIR - dir where the mira archive is.
- LIBNAME - default libmira.a, usually never changed.
- PROJECT_NAME - the name of the project. It becomes part of the generated output files.
- SOURCE_FILES - the source files, subdirectories also works.
- TARGET - a pair of MCU and library type, available targets can be seen in the
$(LIBDIR)/platforms
dir. - V - set to 1 to turn on verbose output from make.
- ROOTDIR - output files directory. Defaults to $(CURDIR).
Extra variables for nRF52 targets¶
- APPROTECT_DISABLED - set to yes to disable setting app protect.
- ISR_VECTOR_FILE - for nrf52-targets, set when a custom
isr_vector.c
file is used. - LFCLK_SOURCE - valid values are
CRYSTAL
,EXTERNAL_BYPASS_ENABLED
andEXTERNAL_BYPASS_DISABLED
. Used to control LFCLK source.
Extra variables for mkw41z targets¶
- STARTUP_FILE - points out the
startup_MKW41Z4.S
file, if not provided uses a default one.
make targets¶
all (the default target) and target¶
Builds a hex and elf file for the application. The names will be $(PROJECT_NAME)-$(TARGET).elf
/hex
.
To build for a different target, either update the TARGET
line in
the Makefile or write TARGET=mkw41z-os
, TARGET=nrf52840ble-os
etc
after make
.
miradocs¶
Starts a python webserver that serves Mira's documentation and opens it in the browser. For security reasons it opens a random port on localhost.
flashall¶
Builds (if needed) and tries to flash all connected boards.
flash.serial¶
Use this target to flash a single board. Available serial numbers can be shown with:
To flash the board with ID 123456789
run: make flash.123456789
.
flashbut.serial¶
This target flashes all connected boards, except the one with the provided serial number.
clean¶
The clean target removes the files that are created for the current $(TARGET)
.
C definitions/macros¶
- MIRA_STACK_CONFIG_OS - for *-os targets
Extra definitions For mkw41z¶
- MIRA_PLATFORM_MKW41Z
Extra definitions for nrf52832¶
- MIRA_PLATFORM_NRF52832BLE
- NRF52832_XXAA
Extra definitions for nrf52840¶
- MIRA_PLATFORM_NRF52840BLE
- NRF52840_XXAA
- MIRA_MULTICHAN_AVAILABLE