I'm road testing the Ultra-Low Power Arm Cortex-M4 Darwin MCU EVM. In this posts I show how to create a Release configuration for Eclipse. |
I've written before that the Build part of the MAXIM SDK hasn't implemented Eclipse's commonly used CDT builder.
MAXIM uses make. That works perfectly. The steps to create a release version of your firmware are different though.
The makefile expects that you define the build goal as "release". Else it will compile all C code with debug info and symbols in the object and executable code.
Making a Release make file
I created a new file, called Makefile_release, in the project root.
It only contains three lines
MAKECMDGOALS=release include Makefile MXC_OPTIMIZE_CFLAGS=-Os LDFLAGS+= -Wl,--gc-sections,--print-memory-usage CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections # Disable assertion checking for release PROJ_CFLAGS := $(filter-out -DMXC_ASSERT_ENABLE,$(PROJ_CFLAGS))
It sets the make goal, and then calls the original makefile.
This takes care that we can define optimizing options and don't alter the behaviour of the Debug configuration.
It also sets the optimisation level higher. MAXIM's makefiles set it to -O1, so we override that.
Create a Release Configuration in Eclipse
You can just copy the Debug configuration and change the makefile.
Then, in that Release configuration, modify the Build command to this:
make --makefile=Makefile_release ECLIPSE=1
You can now clean the project and build the Release configuration.
The flags related to debug will be skipped by the make script.
Here's the resulting comman line for gcc:
arm-none-eabi-gcc -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wa,-mimplicit-it=thumb -Os -fsingle-precision-constant -ffunction-sections -fdata-sections -MD -Wall -Wdouble-promotion -Wno-format -c -fno-isolate-erroneous-paths-dereference -DTARGET=32660 -DTARGET_REV=0x4131 -DMXC_ASSERT_ENABLE -DRO_FREQ=80000000 -I. -ID:/Maxim/Firmware/MAX32660/Libraries/Boards/EvKit_V1/Include -ID:/Maxim/Firmware/MAX32660/Libraries/Boards/EvKit_V1/../Include -ID:/Maxim/Firmware/MAX32660/Libraries/MAX32660PeriphDriver/Include -ID:/Maxim/Firmware/MAX32660/Libraries/CMSIS/Device/Maxim/MAX32660/Include -ID:/Maxim/Firmware/MAX32660/Libraries/CMSIS/Include -o /d/users/jancu/workspace_eclipse_maxim/GPIO/build/main.o main.c
I believe you can also do this without an additional make file, by directly defining the MAKECMDGOALS value in the command line of make.
Anyway, this is how I did it, and it works. Critique is welcome.