Since the development of application software is separated from kernel development, a slightly different build process is necessary. This guide explains how to create a new user program from scratch.
Prerequisites
Before starting this guide, it is expected that you have installed the necessary tools to build and upload the kernel to the microcontroller. Basic knowledge of make and git is necessary. If you are working with the "Orbit" satellite repositories, you must go through the main readme to make certain that you have all the existing repositories installed and that you are able to build them.
Repository
The process loading feature of the OS makes it easy to develop your entire
application in a separate git repository, with your own git history, branches,
issue tracking etc. Examples of such repositories can be found at
GitLab in the erlends-os/usr
group.
This project group contains various demo applications.
If you want to contribute to one of the existing projects, simply request access from the owner. If you want to create a project, the process is simple:
- Create a repository in the correct group and at the correct GitLab instance/server. Remember to set the repository visibility as public if you want to go open source.
- Add a simple readme for your project. There is a nice link you can use that appears after creating the repository. Type a sentence or two describing the program, you may fill in the details later.
- Clone the repository and copy the files from the hello world demo that you
can find in the
programs
directory to get started. This repository contains a working makefile setup, a licence, gitignore and a mostly empty main program file. - Change the name of your program in the makefile, and alter the top licence
text in
main.c
. The name must be unique. If the name is not unique you may end up overwriting someone elses program when you upload it to the device.
Repository Management
Although the rules for the repositories outside of the kernel is not as strict, it is highly recommended that you follow the same rules. Using them will greatly help you with organizing your work. Otherwise, note that the owner of the repository you are contributing to may have set a separate ruleset for you to follow. Keeping code styles consistent will help others understand the code.
Building
Once you are ready to build and run your program, simply run make
in the
repository root directory. You may want to double check that you set the name
of your program in the makefile, which is the name of the executable file. If
the compilation succeeded you will find an elf file in the build directory
with your program name on it.
In order to upload the program over a serial link, start by clearing the
command promt in your serial terminal, then exit the serial terminal. In the
repository, run make flash
. This will run a special program called transfer
which will upload your program to the board over the serial link. You should
see a progress bar and the message Checksum OK
if the transfer is successful.
You may then re-open the serial terminal and start your program at the prompt
by typing its name.