/firmware/hal/src/stm32f2xx/usb_hal.c:435: undefined reference to `HAL_ServicedIRQn’
collect2: error: ld returned 1 exit status
make[1]: *** [/target/.elf] Error 1
…/build/module.mk:222: recipe for target ‘/target/.elf’ failed
make: *** [target/.bin] Error 2
make[1]: Leaving directory ‘/firmware/main’
It’s literally the difference of switching the little optimization flag on or off, I’m not sure why I’m getting this error at all.
Makefile:16: recipe for target ‘target/smartfin.bin’ failed
This is probably best done only for monolithic debug builds, since you may run out of space for some system parts in a modular build without optimization.
Are you building monolithic firmware?
The problem is that the linker failed. The cause could be that it could not provide linkage from system firmware compiled with -Os to user-code compiled without it, but I’m not sure.
You can eliminate this problem by using a monolithic build which will recompile everything without the -Os but you may have trouble fitting into memory without the optimizations.
Which makefile is Eclipse using?
On the command line you’d need to build from the correct directory - meaning with the respective makefile. For Eclipse I suppose you need to select the correct one some other way.
$(TARGETBIN) : $(source)
cd “$(FIRMWARE)/main” && make all PLATFORM=$(PLATFORM) APPDIR="$(APPDIR)" $(MAKEOPTS)
clean :
cd “$(FIRMWARE)/modules” && make clean all PLATFORM=$(PLATFORM) APPDIR="$(APPDIR)" $(MAKEOPTS)
(sorry I don’t know how to format code here)
So when you execute a make, you cd into the firmware_dir/main and make with the appropriate arguments.
Upon a clean, you cd into modules and make clean that? (I think that part is weird, but I don’t really know).
But I can just cd and execute the commands from the command line, the output is the same.
```text
// your block of text (for C++ you'd use ```cpp)
where each set of these accent graves lives on its own line without anything else (including blanks) on the same line
And for the `makefile` I'm not an expert, but I think it's just the first one that provides the entry point and then traverses from `makefile` to `makefile` as long the relative references can be solved.