Toolchain¶
This page describes needed tools and shows how to build MiraOS examples.
Needed tools¶
- GCC for ARM
- GNU Make
- Python 3
- J-Link
For nRF targets¶
The versions used to build and test Mira are noted here.
For NXP targets¶
The versions used to build and test Mira are noted here.
Compiling and flashing¶
Building¶
Mira comes with a build system based on Makefile
s to build, link and
flash the example applications. It assumes the needed programs are
in the program search path (PATH).
To build an application, simple runt the command make
in the application directory, and soemthing similar to the below will show:
~/libmira/examples/miraos/blink$ make
CC blink.c
CC ../../libmira/platform/nrf52832-os/isr_vector.c
LD blink-nrf52832-os.elf
OBJCOPY blink-nrf52832-os.hex
Now the application has been built and can be flashed/uploaded to the board.
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
.
The available targets can be seen in the libmira/platform
folder.
If the application you want to build is moved, you may need to
tell the build system where libmira
has been unpacked.
That is done by either changing the Makefile or writing
LIBDIR=/path/to/libmira
after make
.
Flashing¶
To flash the application, make sure the board(s) are connected to the computer and run the following command:
~/libmira/examples/miraos/blink$ make flashall
The application will be uploaded to all connected boards. If you wish to upload to only one of the connected boards, you need to specify the board ID. First, to find out the IDs we can use the nrfjprog
tool to list the IDs of the connected boards:
~/libmira/examples/miraos/blink$ nrfjprog --ids
987654321
123456789
000112233
To flash the board with ID 123456789
run this command:
~/libmira/examples/miraos/blink$ make flash.123456789
Note: The targets flash and flashall will first rebuild the application if needed.
Cleaning your build¶
To clean the build to get back to a clean state, run make
with the clean
target:
~/libmira/examples/miraos/blink$ make clean
rm -rf obj_nrf52832-os
rm -f blink-nrf52832-os.*