I’m trying to figure out how to create a single binary that contains both the particle firmware and my application code (to make it easier to burn firmware with a JTAG programmer on a large number of boards), while still maintaining my application source code in a directory outside of the firmware directory. It wasn’t obvious to me how to do this after looking at the readme in the firmware repo. Can anyone point me in the right direction?
@alanwells, while Mat will definetly give you the pro answer, I can only point you to the make parameter MODULAR=n when building locally, which generates a combined bin for system-part1, system-part2 and your user-part.
So this should help out till Mat gets your input to provide the pro answer
make clean all PLATFORM=<yourPlatform> MODULAR=n ...
It’s best to keep the system and application firmware separate (i.e. use our modular system) so that your electron follows the standard layout for devices, allowing application code to be separately compiled without also needing to flash the system firmware, which avoid additional data usage.
To create a complete image for the electron, we use
This combines the bootloader, as well as system and default application firmware for flashing via JTAG on a manufacturing line.
To use the makefile, pull the firmware repo, checkout the branch and then run:
make -f combined.mk
This will build the manufacturing image to firmware/build/releases/release-0.4.9-p10/
Flashing the manufacturing image
Ensure OPENOCD_HOME is defined that points to the location of your openOCD installation.
Hook up the Electron to the programmer shield and run
make -f combined.mk all openocd-flash
This will build the manufacturing image and flash it to the device, erasing all previous flash contents.
@mdma The above instructions made sense, but I’m getting a file error on the user-part.bin file:
dd if=../../../../firmware/build/target/user-part/platform-10-m/user-part.bin of=../../../../firmware/build/releases/release-0.4.8-rc.6-p10/user-part.bin conv=notrunc
dd: ../../../../firmware/build/target/user-part/platform-10-m/user-part.bin: No such file or directory
make: *** [user] Error 1
It appears the makefile is attempting to copy user-part.bin from /firmware/build/target/user-part.bin to /firmware/build/releases/release-0.4.8-rc.6-p10/user-part.bin. This file exists in the location where it is trying to copy it to, but not where it is trying to copy it from. Is it possible the paths for these two locations are accidentally reversed in this line: https://github.com/spark/firmware/blob/develop/hal/src/stm32/combined.mk#L90?
This looks like an intermediate problem - sometimes firmware overflows the space available until we have time to optimize.
It’s recommended you stick to use release branches unless there is a specific reason to use development branches. The latest release is found under master with other releases found under release/vX.Y.Z.