-
Notifications
You must be signed in to change notification settings - Fork 2
Code development
The following assumes you are using a unix-based platform (Linux, MacOS, or WSL on Windows). That means you have access to make, git, etc, and is intended for development on a personal machine. The Cornell LNX machines (such as lnx4189) already have the appropriate tools installed.
Download the following:
- GCC compiler. arm-none-eabi gcc compiler version 8-2018q4 Select the appropriate one for your platform
- FreeRTOS. Download the source code for FreeRTOS version 10.2.1 This is all that is strictly necessary.
If you want to use an IDE there are two options.
- Eclipse CDT. This is the basic Eclipse IDE for C/C++ programming. To make things easier it is suggested to grab it from this specialized version for microcontrollers. Install the binary from 'downloads' on this page. This includes not just the Eclipse and CDT but also specializations for working with ARM microcontrollers.
- An alternative is Visual Studio Code. This more modern IDE is good but takes some tweaking to get it to work with makefile projects. You need to generate a
compile_commands.jsonfile to make cross-references work properly, and also need to define custom rules to invokemake.
The code for the MCU must be developed on a branch that is not the master branch. The master branch is protected -- you can only submit pull requests to the master branch, not push directly to master.
The pull requests undergo a continuous integration build as described in the top level README file and then the PR must be reviewed by someone before being merged.
Best practice is to rebase the branch to the master before submitting a pull request.
The code can be pulled from the repo as follows.
git clone [email protected]:apollo-lhc/cm_mcu.git
At this point all the usual git commands are available. You'll want to make your own branch to develop there. Easiest thing is to make the branch on github (e.g. with the branch my-branch-name) and then switch to the branch in your local repo via
git checkout my-branch-name
on your local machine.
You need to make sure the downloaded compiler is in your path. Then, in your shell, you need to set up one environment variable to point the build at your FreeRTOS code
export FREERTOS_ROOT=/base/of/install/FreeRTOS/Source
The last two parts of the above directory path are internal to the FreeRTOS source code tree.
To build the code you just type
make
Possible flags to consider are DEBUG=1 for a debug build and VERBOSE=1 to see how the compile commands are invoked. All other regular make options should work too.
make -j DEBUG=1 VERBOSE=1
for a debug build with full screen printout.
- After downloading the code, start eclipse and import the code via File>New>Makefile Project with existing code.
- Set the build to use the ARM compiler by opening the project preferences, navigate to C/C++ Build>Settings, and select "Gnu Tools for ARM Embedded". (If you don't have this option you need to install the ARM for embedded extension for Eclipse)
The build should mostly work now, but some tweaks need to be added to get rid of the red squiggly lines in the IDE.
- In the project settings, click on C/C+++ General>Paths and symbols.
- Under 'includes' for C the following include directories.
The python package compiledb can be used for this purpopse. Once installed (e.g. with pip) call it with
compiledb make -w VERBOSE=1
Both the -w flag and the verbose build are required.