-
Notifications
You must be signed in to change notification settings - Fork 132
Arduino ide does not put variant files in the archive and Sloeber does #1005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I know. The core/variants folder should not be put in the archive. Most boards do not have a problem with this but some do. Sloeber does this now hard coded. |
@stevstrong |
I'm currently testing the fix. |
You probably figured out, those functions from my link are the ones in |
No I still have not figured it out yet. I fear I need more explanation to figure it out. (read I need it spelled out ;-) ) |
I have been diving a little deeper into this issue and this is my current understanding: I'm currently testing the fix for 2. Because of 1 I can not add the board to my backwards compatibility test. |
If you check it in, or provide a patch I'll test it. I just got the source building and running. |
@stevstrong has the same problem. He just chose to fix it differently. |
OK. I'm not good with gcc compile commands so it simply didn't make sense to me. |
I pushed the fix. if all goes well the build engine will pick it up tonight and tomorrow it will be available on the nightly update site. |
I recompiled the plugin from source and it all works as expected now! Thanks! The sloeber link now looks correctly like the arduino one: |
good :-) |
I'm using the core from https://github.com/rogerclarkmelbourne/Arduino_STM32, when I compile and link in the Arduino IDE it produces a good binary. When compiled and linked in sloeber it doesn't produce the same results.
I narrowed it down to the way it links. With the Arduino IDE, all the .o files from the variant directory end up in the {object_files} array. With sloeber, those files get stuff into the archive file. When it links, you can see that it is not placing the variant .o files in the proper order:
arduino link command:
"/home/user1/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -Os -Wl,--gc-sections -mcpu=cortex-m3 "-T/home/user1/Arduino/hardware/arduino_stm32/STM32F1/variants/generic_stm32f103c/ld/bootloader_20.ld" "-Wl,-Map,/tmp/arduino_build_476970/zloe1.ino.map" "-L/home/user1/Arduino/hardware/arduino_stm32/STM32F1/variants/generic_stm32f103c/ld" -o "/tmp/arduino_build_476970/zloe1.ino.elf" "-L/tmp/arduino_build_476970" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "/tmp/arduino_build_476970/sketch/zloe1.ino.cpp.o" "/tmp/arduino_build_476970/core/wirish/start.S.o" "/tmp/arduino_build_476970/core/wirish/start_c.c.o" "/tmp/arduino_build_476970/core/wirish/syscalls.c.o" "/tmp/arduino_build_476970/core/board.cpp.o" "/tmp/arduino_build_476970/core/wirish/boards.cpp.o" "/tmp/arduino_build_476970/core/wirish/boards_setup.cpp.o" "/tmp/arduino_cache_244275/core/core_arduino_stm32_STM32F1_genericSTM32F103C_device_variant_STM32F103C8,upload_method_DFUUploadMethod,cpu_speed_speed_72mhz,opt_osstd_f86f3cb45e926d46fff8a1442c383d28.a" -Wl,--end-group
sloeber link command:
"/home/user1/sloeber//arduinoPlugin/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -Os -Wl,--gc-sections -mcpu=cortex-m3 "-T/home/user1/Arduino/hardware/arduino_stm32/STM32F1/variants/generic_stm32f103c/ld/bootloader_20.ld" "-Wl,-Map,/home/user1/Documents/sloeber-workspace/zloe1/Release/zloe1.map" "-L/home/user1/Arduino/hardware/arduino_stm32/STM32F1/variants/generic_stm32f103c/ld" -o "/home/user1/Documents/sloeber-workspace/zloe1/Release/zloe1.elf" "-L/home/user1/Documents/sloeber-workspace/zloe1/Release" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group ./sloeber.ino.cpp.o /home/user1/Documents/sloeber-workspace/zloe1/Release/arduino.ar -Wl,--end-group Finished building: zloe1.elf
The difference between the two is that the variant object files (start.S.o, start_c.c.o, syscalls.c.o ... etc) get put into the archive when using sloeber and aren't individually provided via the {object_files} This causes the sketch to fail because some of the functions in those .o files are marked weak so the user can override them in their sketch. However when the user doesn't override them, and sloeber puts them in an archive file, they end up coming from the libc library instead. The functions from the variant *.o files are meant to override the newlib functions like (_sbrk(), _open(), _close() ... etc).
I can get around this problem by copying the variant *.c files into my sketch directory. However, it doesn't seem like sloeber is mimicking arduino-builder behavior in this case.
I have the "aggressively cache" flag checked in the Arduino IDE and the variant files are always provided as individual .o files.
At that point I started looking at the arduino-builder source. It always seems to puts the files from the variant in the object_files list not in the archive file.
In the arduino-builder you can see the function:
archiveFile, objectFiles, err := compileCore(ctx, coreBuildPath, coreBuildCachePath, buildProperties)
https://github.com/arduino/arduino-builder/blob/3f9e2f06c6346b559c20f9e3591f14966cd33097/phases/core_builder.go#L62
You can see that the variantFiles are placed in the objectFiles, not the archiveFiles:
return archiveFile, variantObjectFiles, nil
https://github.com/arduino/arduino-builder/blob/3f9e2f06c6346b559c20f9e3591f14966cd33097/phases/core_builder.go#L133
The text was updated successfully, but these errors were encountered: