RESOLVED: Boot Loader Compile Error: 'Factory_Reset_SysFlag' undeclared

I figured it was time to play around with my own bootloader, just for fun, since I don't have a need as such.

However, after cloning and attempting to build the source ...

$ git clone https://github.com/spark/bootloader.git
$ cd bootloader/build
$ make clean
$ make

... I end up with a compile error ...

../src/main.c: In function 'main':
../src/main.c:143:16: error: 'Factory_Reset_SysFlag' undeclared (first use in this function)
  if (0xAAAA == Factory_Reset_SysFlag)
                ^

I'm sorry capt'n, but I canny find a single reference to Factory_Reset_SysFlag anywhere on the ship!

$ cd ~/sparkcore
$ ls -1F
bootloader/
core-common-lib/
core-communication-lib/
core-dryertimer/
core-firmware/
gcc-arm-none-eabi-4_8-2013q4/
shields/
spark-arm@
    
$ find . -type f -exec grep -ln Factory_Reset_SysFlag {} \;
./bootloader/src/main.c
 
$ _

(except in bootloader/main.c, of course)

Nor in the universe captain!

Google Result: Your search - spark Factory_Reset_SysFlag - did not match any documents.

It is extern’ed in core-common-lib/SPARK_Firmware_Driver/inc/hw_config.h

I think you need the normal local build repros to build the boot loader, but I have never tried myself.

1 Like

Not on my system it aint. How odd. Ah. Maybe some git pulls are in order? ...

AHHA! That fixed it. :blush:

Thanks for the clue.

Except that now the same reference is causing a bail out at link time ...

Building target: bootloader.elf
Invoking: ARM Sourcery Windows GCC C Linker
arm-none-eabi-gcc -T"../linker/linker_stm32f10x_md.ld" -nostartfiles -Xlinker --gc-sections -L"../../core-common-lib/build" -Wl,-Map,bootloader.map -mcpu=cortex-m3 -mthumb -g3 -gdwarf-2 -o "bootloader.elf"  ./startup/startup_stm32f10x_md.o  ./src/dfu_mal.o ./src/flash_if.o ./src/main.o ./src/spi_if.o ./src/stm32_it.o ./src/usb_desc.o ./src/usb_istr.o ./src/usb_prop.o   -lcore-common-lib
./src/main.o: In function `main':
[...]/sparkcore/bootloader/build/../src/main.c:319: undefined reference to `Factory_Reset_SysFlag'
collect2: error: ld returned 1 exit status

RESOLVED: Oh, silly me. I didn't re-build everything else first, after the git pulls, above. All sorted now.