Error when making firmware from root

While trying to build all modules for photon (i.e. from the root of the repository), an error occurs:

/var/folders/m9/797xgb9x7cb2qhkxy1tfsjmr0000gn/T//ccP0vMQN.ltrans0.ltrans.o: In function `main':
firmware/bootloader/src/main.c:177: undefined reference to `HAL_Core_Read_Backup_Register'
firmware/bootloader/src/main.c:230: undefined reference to `HAL_Core_Write_Backup_Register'
firmware/bootloader/src/main.c:242: undefined reference to `HAL_Core_Write_Backup_Register'
firmware/bootloader/src/main.c:324: undefined reference to `is_application_valid'
firmware/bootloader/src/main.c:359: undefined reference to `is_application_valid'
firmware/bootloader/src/main.c:392: undefined reference to `HAL_DFU_USB_Init'
/var/folders/m9/797xgb9x7cb2qhkxy1tfsjmr0000gn/T//ccP0vMQN.ltrans1.ltrans.o: In function `__DSB':
firmware/bootloader/./MCU/STM32F2xx/CMSIS/Include/core_cmInstr.h:343: undefined reference to `USB_OTG_dev'
../hal/src/photon/lib/FreeRTOS/STM32F2xx.a(waf_platform.o): In function `platform_erase_flash':
/Users/mat1/dev/spark/photon-wiced/WICED/platform/MCU/STM32F2xx/WAF/waf_platform.c:151: undefined reference to `platform_watchdog_kick'
/Users/mat1/dev/spark/photon-wiced/WICED/platform/MCU/STM32F2xx/WAF/waf_platform.c:163: undefined reference to `platform_watchdog_kick'
collect2: error: ld returned 1 exit status
make[1]: *** [../build/target/bootloader/platform-6-lto/bootloader.elf] Error 1
make: *** [bootloader] Error 2

Steps to reproduce from scratch:

git clone https://github.com/spark/firmware.git
cd firmware
git checkout latest
make PLATFORM=photon

The build finished fine when building for the core (“make PLATFORM=core”)

1 Like

There’s a known issue in the bootloader where the build has regressed. For now, please build from main. Thanks :smile:

Please pull from latest, you’ll find this is fixed now. Thanks for reporting it. I’m adding additional checks to our CI build so that these problems don’t slip through again.

Thanks for the quick fix, just checked it and it works now.

However, I was under the impression that it would create one big firmware file with everything in it, bootloader, system, user application etc. but that does not seem to happen. The resulting bin is only 11kb in size, same as when I run make from the ./main dir.

So what is the difference and the expected result when making from:
./
./main
./modules

And how would one go about to create complete firmware file?

The build documentation says this about the building in the root folder:

Running make in the top-level directory creates the bootloader and firmware binaries for your device, which are output to subdirectories of the build/target/ directory.

The top-level make is mainly a convenience to build bootloader and main projects.

So it's there to simply save you from running two sets of make commands. There is no target that will build a combined bootloader and main firmware.

There is a script that we used to build the manufacturing firmware that you might be able to modify. The script is in hal/src/photon/wiced_test_mfg_combined.mk. Currently it's dependent on a private WICED repo in order to build the wl.exe utility and manufacturing test firmware, but you don't need that so you could remove those targets. At the very least, the script should give you some insight how to build your own script to create combined binaries.

Hope that helps :smile:
mat

Great, thanks for the insight, I will have a go at that once I get the ymodem protocol working…