-
Notifications
You must be signed in to change notification settings - Fork 295
Application Build system
A new build system using python has been added recently. It will coexist with the system using make for some time and will replace it eventually. Currently the new build system works with the thumb2 target only. Il will be extended to the orther targets soon.
Using the new system is quite simple. Locate the BUILD object in the OS object of your OIL file. You should have something like that (example taken from examples/thumb2/cortex-m4/stf32f4-discovery/readbutton_isr):
BUILD = TRUE {
TRAMPOLINE_BASE_PATH = "../../../../..";
APP_SRC = "readbutton_isr.c";
APP_NAME = "readbutton_isr_exe";
CFLAGS = "-g -O0 -Wall -Wno-unused-but-set-variable -Wformat";
CFLAGS = "-std=c99 -mcpu=cortex-m4 -Wmissing-field-initializers";
CFLAGS = "-mthumb -mfloat-abi=soft -mfpu=fpv4-sp-d16 -nostartfiles";
ASFLAGS = "-g -Wall -mcpu=cortex-m4 -mthumb --fatal-warnings";
ASFLAGS = "-mfloat-abi=soft -mfpu=fpv4-sp-d16";
LDFLAGS = "--fatal-warnings --warn-common --no-undefined";
LDFLAGS = "-L/usr/local/dev-arm/i386-Darwin-arm-gcc-4.9.2/arm-eabi/lib/thumb";
LDFLAGS = "-lc -L/usr/local/dev-arm/i386-Darwin-arm-gcc-4.9.2/lib/gcc/arm-eabi/4.9.2";
LDFLAGS = "-lgcc -Map=readbutton_isr.map";
COMPILER = "arm-eabi-gcc";
ASSEMBLER = "arm-eabi-as";
LINKER = "arm-eabi-ld";
COPIER = "arm-eabi-objcopy";
};
And add a SYSTEM = PYTHON;inside the BUILD object.
Run goil on the OIL file: goil --target=thumb2/cortex-m4/STM32F4-Discovery --templates=../../../../../goil/templates readbutton_isr.oil.
Two files related to the build system are generated: make.py and build.py. make.py contains the rules and the build commands used to compile the OIL file itself. Dependencies are set on the OIL file and on all the included OIL files. build.py contains the rules and the build commands used to compile the C files of the application, of the OS and those that have been generated by the OIL compilation. make.py calls build.py so it is not needed to launch build.py directly, use only make.py.
The application is now built by executing make.py: ./make.py. 2 build goals are provided by default: all and clean. Launching ./make.py without any argument or with argument all are equivalent. ./make.py clean cleans up all the files.
On some target platform, additional build goals may be available. For instance on thumb2/cortex-m4/STM32F4-Discovery the goal burn allow to burn the flash with the application.