fix microbit1 compiler flags to clear bss section properly #2411
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CFLAGS are not actually passed to .S files, we need ASFLAGS for that
also there is easier way to use
main()
as_start()
via -D__START=main - this also verifies flags are passed properly otherwise it fails in linker not finding_start
This can be merged as is for microbit1 however there are unclear issues with makefiles.
1.
nrf51 adds .o file to PRECOMPILED_OBJS here https://github.com/espruino/Espruino/blob/master/make/family/NRF51.make#L15 and this works fine, however nrf52 has .S files there in many places like here https://github.com/espruino/Espruino/blob/master/make/family/NRF52.make#L25 except here https://github.com/espruino/Espruino/blob/master/make/family/NRF52.make#L63
When I tried to put .S to nrf51 makefile instead of .o it did not pass ASFLAGS properly (nor CFLAGS) so the .o variant is a good one here.
However when I tried to add same lines
to BANGLEJS board file it worked fine despite .S! Or maybe it uses the
.o
makefile variant here too (?)Why there are .S files in PRECOMPILED_OBJS ?
And btw it saves about 300 bytes in BANGLE build -
1688b free
vs1380b free
2.
targetlibs/nrf5x_12/components/toolchain/gcc/gcc_startup_nrf5(2|1).o files are not cleared on
make clean
so if you try to build locally for two boards with different flags old .o file with different flags gets reused. Won't affect pipeline builds so can be merged for microbit1 despite possible other nrf51 builds not having the flag.