Closed Sayter99 closed 2 months ago
Interesting, I wonder if the newer versions of GCC are more strict on windows, can you try using an older version (say 13.2.1) and check if the problem persists?
This commit changed the default behavior to use the latest available GCC version and it may have impacted your problem
https://github.com/hexdae/toolchains_arm_gnu/commit/7080adcae04e6398f090a3f841278325dd3ecad8
Hmm, I added --specs=nano.specs
to the arm-none-eabi test in this PR https://github.com/hexdae/toolchains_arm_gnu/pull/56 and it passes in CI for windows
Can you show me your BUILD file?
The culprit is this genrule I used to generate a startup object file.
genrule(
name = "core_startup",
srcs = ["Core/Startup/startup_stm32f429vitx.s"],
outs = ["startup_stm32f429vitx.o"],
cmd = "$(execpath @arm_none_eabi//:gcc) -DHAL_BOARD=3 -c -x assembler-with-cpp --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o $@ $<",
tools = ["@arm_none_eabi//:gcc"],
)
cc_binary(
name = "core_elf",
srcs = [
"Core/Src/main.c",
":core_startup",
],
additional_linker_inputs = [
"STM32F429VITX_FLASH.ld",
],
copts = common_copts(),
linkopts = [
"-Tja3_io/STM32F429VITX_FLASH.ld",
"-Wl,--gc-sections",
"-Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group",
] + common_linkopts(),
target_compatible_with = [
"@platforms//cpu:arm",
"@platforms//os:none",
],
visibility = ["//ja3_io:__subpackages__"],
deps = [
":core_lib",
":ethernet_hub",
":inf_hal",
":lwip",
":middleware_freertos",
":middleware_lwip",
":middleware_usb_device",
":stm32f4xx_hal_driver",
":usb_device",
],
)
I am realizing that
--specs=nano.specs
here, instead, it should be a linkopt to the binary@arm_none_eabi//:gcc
tool in genrule
cannot access specs files (in the past, it was working), but I think it is fine, as I now refactor the above genrule
by cc_library
cc_library(
name = "startup",
srcs = ["Core/Startup/startup_stm32f429vitx.s"],
linkopts = ["-Tja3_io/STM32F429VITX_FLASH.ld"],
target_compatible_with = ["@platforms//os:none"],
deps = ["STM32F429VITX_FLASH.ld"],
alwayslink = True,
)
cc_binary( name = "core_elf", srcs = [ "Core/Src/main.c", ], copts = common_copts(), features = ["generate_linkmap"], linkopts = [ "-Wl,--gc-sections", "-Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group", "--specs=nano.specs", "--specs=nosys.specs", ] + common_linkopts(), target_compatible_with = [ "@platforms//cpu:arm", "@platforms//os:none", ], visibility = ["//ja3_io:subpackages"], deps = [ ":core_lib", ":ethernet_hub", ":inf_hal", ":lwip", ":middleware_freertos", ":middleware_lwip", ":middleware_usb_device", ":startup", ":stm32f4xx_hal_driver", ":usb_device", ], )
Closing this issue as I can build my target again.
when building cc_library target with
--specs=nano.specs
copts, I got the following error, although I can see the spec file underlib
folder.It seems that this issue only occurs on Windows, below is my environment
It was working with ea916f4724eb47de8f1c22f7fed99faa05208a1e