FLASH_BOOTLDR_PAYLOAD_SIZE_KB invalid value
whitepard opened this issue · 2 comments
When I tried to compile this project under Windows 10 + MinGW I got an error:
In file included from main.c:19:0:
main.c: In function 'main':
flash_config.h:3:39: error: implicit declaration of function '$' [-Werror=implicit-function-declaration]
#define FLASH_BOOTLDR_PAYLOAD_SIZE_KB $((128 - 4))
^
main.c:401:27: note: in expansion of macro 'FLASH_BOOTLDR_PAYLOAD_SIZE_KB'
imagesize > FLASH_BOOTLDR_PAYLOAD_SIZE_KB*1024/4 ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1.exe: all warnings being treated as errors
Makefile:36: recipe for target 'main.o' failed
mingw32-make.exe: *** [main.o] Error 1
which clearly shows, that value of FLASH_BOOTLDR_PAYLOAD_SIZE_KB variable is generated incorrectly.
To circumvent this issue I substituted this line of Makefile:
FLASH_BOOTLDR_PAYLOAD_SIZE_KB =
with this one:
FLASH_BOOTLDR_PAYLOAD_SIZE_KB = (
Without the "shell" magic, you get:
#define FLASH_BOOTLDR_PAYLOAD_SIZE_KB (128 - 4)
in the config file instead of:
#define FLASH_BOOTLDR_PAYLOAD_SIZE_KB 124
Which for constant definition purpose (as an int) is equivalent. However here (main.c):
"@internal Flash /0x08000000/"
STR(FLASH_BOOTLDR_SIZE_KB) "*001Ka,"
STR(FLASH_BOOTLDR_PAYLOAD_SIZE_KB) "*001Kg",
This will result in the string being
"@internal Flash /0x08000000/4001Ka,128-4001Kg"
instead of
"@internal Flash /0x08000000/4001Ka,124001Kg"
Which might not be a big deal (some DFU clients just ignore it) but it is indeed different and breaks the string definition. I do not see it as an acceptable solution.
Perhaps there's a different way of doing the calculation in the Makefile that I'm not aware. I'm not a mingw user, sorry I can't help you here.
Oh BTW one issue is enough, you can close the other one :)
Hi. Thanks for your reply.
The solution to this is adding msys/bin subdirectiry of your MinGW installation to your PATH variable, then everything works like a charm. No source code modifications required. To tell more, my previously proprosed "solution" allows to compile without errors, but makes bootloader unusable: you get memory not writable error from dfu-util when trying to download a binary to the chip.