Skip to content

Cannot build dfu bootloader for blackpillv2 #1320

@HrMitrev

Description

@HrMitrev

Hi,
Recently I started a discussion #1299 about adding support for custom dfu bootloader for the blackpillv2 platform. It turns out that it's already implemented, even though I think it may not be necessary for the genuine chips. Unfortunatelly following this discussion, additional fw update methods may be beneficial.

The problem is that, even though there is a way to build a custom bootloader for the blackpillv2 platform, attemting to do so results in build error: make PROBE_HOST=blackpillv2 OPT_FLAGS='-Os' ENABLE_RTT=1 BMP_BOOTLOADER=1:

  BUILD   lib/stm32/f1
  BUILD   lib/stm32/f4
  BUILD   lib/lm4f
make[2]: Nothing to be done for 'all'.
make[2]: Nothing to be done for 'all'.
make[2]: Nothing to be done for 'all'.
Load address 0x08004000 for BMPBootloader
 GEN include/version.h
  CC      command.c
  CC      remote.c
  CC      platforms/common/usb.c
  CC      platforms/stm32/dfucore.c
platforms/stm32/dfucore.c: In function 'get_dev_unique_id':
platforms/stm32/dfucore.c:333:23: error: 'FLASH_BASE' undeclared (first use in this function); did you mean 'HASH_BASE'?
  333 |         max_address = FLASH_BASE + (fuse_flash_size << 10U);
      |                       ^~~~~~~~~~
      |                       HASH_BASE
platforms/stm32/dfucore.c:333:23: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [Makefile:119: dfucore.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:17: all] Error 2

If I build with make PROBE_HOST=blackpillv2 OPT_FLAGS='-DFLASH_BASE=0x8000000UL -Os' ENABLE_RTT=1 BMP_BOOTLOADER=1, the build succeeds, but the resulting binary seems non functional.

I don't have much experience with usb or bootloaders, but I'll be thrilled to try to resolve this if someone has an idea what should I look up. Best case scenario it's just simple build system bug.

The only FLASH_BASE macro I can find in the project is at libopencm3/include/libopencm3/pac55xx/memorymap.h:32, but I doubt it has something to do with the stm32 MCUs

Metadata

Metadata

Assignees

No one assigned

    Labels

    BMP FirmwareBlack Magic Probe Firmware (not PC hosted software)BugConfirmed bugRegressionBug caused by a regression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions