[SOLVED] Use of precompiled library

Working libraries, libraries being ported and related hardware
Post Reply
User avatar
blue-man
Posts: 51
Joined: Mon Mar 23, 2020 5:02 pm

[SOLVED] Use of precompiled library

Post by blue-man »

I want to ask if it is possible to use an precompiled library?

Here is an example for it: download/file.php?id=176&sid=bd03c2e776 ... cc98b0a32d

What i have found is the description here: https://arduino.github.io/arduino-cli/l ... ification/ with
precompiled - (available from Arduino IDE 1.8.6/arduino-builder 1.4.0) (optional) set to true to allow the use of .a (archive) and .so (shared object) files. The .a/.so file must be located at src/{build.mcu} where {build.mcu} is the architecture name of the target the file was compiled for. Ex: cortex-m3 for the Arduino DUE. The static library should be linked as an ldflag.
So i added in .../arduino15/packages/STM32/hardware/stm32/1.8.0/libraries/SrcWrapper/library.properties

Code: Select all

precompiled=true
and .../arduino15/packages/STM32/hardware/stm32/1.8.0/libraries/SrcWrapper/src/sc_math.a

But it still errors out with

Code: Select all

APM-Test.ino.cpp:(.text.loop+0xbc): undefined reference to `sc_math_sin(float)'
Any ideas?
Last edited by blue-man on Sun May 10, 2020 4:58 pm, edited 1 time in total.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Use of precompiled library

Post by fpiSTM »

As explained in the library specification, you have to put it in the src/{build.mcu} not in src/ where {build.mcu} is the architecture name of the target the file was compiled for.

Not that the core will not support the APM32 as only STM32 is supported.
Instead of modifying the core you should create your own library with the lib and a dedicated include.
User avatar
blue-man
Posts: 51
Joined: Mon Mar 23, 2020 5:02 pm

Re: Use of precompiled library

Post by blue-man »

fpiSTM wrote: Sun May 10, 2020 10:19 am As explained in the library specification, you have to put it in the src/{build.mcu} not in src/ where {build.mcu} is the architecture name of the target the file was compiled for.
What will be the path "src/{build.mcu}" ?
Is it the tmp path for compilation?
fpiSTM wrote: Sun May 10, 2020 10:19 am Not that the core will not support the APM32 as only STM32 is supported.
Instead of modifying the core you should create your own library with the lib and a dedicated include.
Of course this is not an STM32 - this is just an experiment, to proof if there is really an FPU that can be used. ;)
viewtopic.php?f=62&t=264

The manufacturer tries to hide his "secrets" in a precompiled library.
This is part of an SDK.
User avatar
blue-man
Posts: 51
Joined: Mon Mar 23, 2020 5:02 pm

Re: Use of precompiled library

Post by blue-man »

fpiSTM wrote: Sun May 10, 2020 10:19 am As explained in the library specification, you have to put it in the src/{build.mcu} not in src/ where {build.mcu} is the architecture name of the target the file was compiled for.
It's the same result with .../arduino15/packages/STM32/hardware/stm32/1.8.0/libraries/SrcWrapper/src/stm32/sc_math.a
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Use of precompiled library

Post by fpiSTM »

stm32 is not the {build.mcu}... cortex-m3 is ;)

So:

Code: Select all

src/cortex-m3/sc_math.a
User avatar
blue-man
Posts: 51
Joined: Mon Mar 23, 2020 5:02 pm

Re: Use of precompiled library

Post by blue-man »

fpiSTM wrote: Sun May 10, 2020 1:10 pm stm32 is not the {build.mcu}... cortex-m3 is ;)

So:

Code: Select all

src/cortex-m3/sc_math.a
Yes - Thanks a lot!

Now the compiled library is used.

But it seems to lead to much incompatibility problems. :D

Code: Select all

~/.arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Os --specs=nano.specs -Wl,--defsym=LD_FLASH_OFFSET=0 -Wl,--defsym=LD_MAX_SIZE=65536 -Wl,--defsym=LD_MAX_DATA_SIZE=20480 -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -T.../arduino15/packages/STM32/hardware/stm32/1.8.0/variants/PILL_F103XX/ldscript.ld -Wl,-Map,/tmp/arduino_build_910235/APM-Test.ino.map -L~/.arduino15/packages/STM32/tools/CMSIS/5.5.1/CMSIS/DSP/Lib/GCC/ -larm_cortexM3l_math -o /tmp/arduino_build_910235/APM-Test.ino.elf -L/tmp/arduino_build_910235 -Wl,--start-group /tmp/arduino_build_910235/sketch/APM-Test.ino.cpp.o /tmp/arduino_build_910235/sketch/SrcWrapper.cpp.o .../arduino15/packages/STM32/hardware/stm32/1.8.0/libraries/SrcWrapper/src/cortex-m3/sc_math.a /tmp/arduino_build_910235/core/PeripheralPins.c.o /tmp/arduino_build_910235/core/variant.cpp.o -L.../arduino15/packages/STM32/hardware/stm32/1.8.0/libraries/SrcWrapper/src/cortex-m3 /tmp/arduino_build_910235/core/core.a -lc -Wl,--end-group -lm -lgcc -lstdc++
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: .../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7-m/nofp/libgcc.a(_arm_addsubsf3.o): in function `__aeabi_fsub':
(.text+0x8): multiple definition of `__aeabi_fsub'; .../arduino15/packages/STM32/hardware/stm32/1.8.0/libraries/SrcWrapper/src/cortex-m3/sc_math.a(fpu.o):..\..\User\FPU\fpu.c:(.text+0x234): first defined here
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: .../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7-m/nofp/libgcc.a(_arm_addsubsf3.o): in function `__aeabi_fadd':
(.text+0xc): multiple definition of `__aeabi_fadd'; .../arduino15/packages/STM32/hardware/stm32/1.8.0/libraries/SrcWrapper/src/cortex-m3/sc_math.a(fpu.o):..\..\User\FPU\fpu.c:(.text+0x210): first defined here
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: .../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7-m/nofp/libgcc.a(_arm_addsubsf3.o): in function `__aeabi_ui2f':
(.text+0x16c): multiple definition of `__aeabi_ui2f'; .../arduino15/packages/STM32/hardware/stm32/1.8.0/libraries/SrcWrapper/src/cortex-m3/sc_math.a(fpu.o):..\..\User\FPU\fpu.c:(.text+0x4d6): first defined here
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: warning: .../arduino15/packages/STM32/hardware/stm32/1.8.0/libraries/SrcWrapper/src/cortex-m3/sc_math.a(fpu.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_910235/core/core.a(startup_stm32yyxx.S.o): in function `LoopFillZerobss':
(.text.Reset_Handler+0x26): undefined reference to `SystemInit'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_910235/sketch/APM-Test.ino.cpp.o: in function `loop':
APM-Test.ino.cpp:(.text.loop+0xbc): undefined reference to `sc_math_sin(float)'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_910235/core/core.a(wiring_digital.c.o): in function `pinMode':
wiring_digital.c:(.text.pinMode+0x2e): undefined reference to `pin_in_pinmap'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: wiring_digital.c:(.text.pinMode+0x36): undefined reference to `pwm_stop'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: wiring_digital.c:(.text.pinMode+0x62): undefined reference to `pin_function'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: wiring_digital.c:(.text.pinMode+0x82): undefined reference to `_Error_Handler'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_910235/core/core.a(wiring_digital.c.o): in function `digitalWrite':
wiring_digital.c:(.text.digitalWrite+0x40): undefined reference to `GPIOPort'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: wiring_digital.c:(.text.digitalWrite+0x44): undefined reference to `pin_map_ll'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_910235/core/core.a(wiring_digital.c.o): in function `digitalRead':
wiring_digital.c:(.text.digitalRead+0x44): undefined reference to `GPIOPort'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: wiring_digital.c:(.text.digitalRead+0x48): undefined reference to `pin_map_ll'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_910235/core/core.a(wiring_time.c.o): in function `millis':
wiring_time.c:(.text.millis+0x0): undefined reference to `getCurrentMillis'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_910235/core/core.a(HardwareSerial.cpp.o): in function `HardwareSerial::_rx_complete_irq(serial_s*)':
HardwareSerial.cpp:(.text._ZN14HardwareSerial16_rx_complete_irqEP8serial_s+0x8): undefined reference to `uart_getc'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_910235/core/core.a(HardwareSerial.cpp.o): in function `HardwareSerial::write(unsigned char)':
HardwareSerial.cpp:(.text._ZN14HardwareSerial5writeEh+0x24): undefined reference to `uart_enable_tx'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: HardwareSerial.cpp:(.text._ZN14HardwareSerial5writeEh+0x48): undefined reference to `serial_tx_active'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: HardwareSerial.cpp:(.text._ZN14HardwareSerial5writeEh+0x52): undefined reference to `uart_attach_tx_callback'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_910235/core/core.a(HardwareSerial.cpp.o): in function `HardwareSerial::HardwareSerial(void*, bool)':
HardwareSerial.cpp:(.text._ZN14HardwareSerialC2EPvb+0x50): undefined reference to `pinmap_pin'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: HardwareSerial.cpp:(.text._ZN14HardwareSerialC2EPvb+0x5c): undefined reference to `pinmap_pin'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_910235/core/core.a(HardwareSerial.cpp.o): in function `HardwareSerial::enableHalfDuplexRx()':
HardwareSerial.cpp:(.text._ZN14HardwareSerial18enableHalfDuplexRxEv+0x26): undefined reference to `uart_enable_rx'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_910235/core/core.a(HardwareSerial.cpp.o): in function `HardwareSerial::begin(unsigned long, unsigned char)':
HardwareSerial.cpp:(.text._ZN14HardwareSerial5beginEmh+0x4c): undefined reference to `_Error_Handler'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: HardwareSerial.cpp:(.text._ZN14HardwareSerial5beginEmh+0x60): undefined reference to `uart_init'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: HardwareSerial.cpp:(.text._ZN14HardwareSerial5beginEmh+0x74): undefined reference to `uart_attach_rx_callback'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_910235/core/core.a(main.cpp.o): in function `premain()':
main.cpp:(.text.startup._Z7premainv+0x4): undefined reference to `HAL_NVIC_SetPriorityGrouping'
.../arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_910235/core/core.a(board.c.o): in function `init':
board.c:(.text.init+0x0): undefined reference to `hw_config_init'
collect2: error: ld returned 1 exit status
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: [SOLVED] Use of precompiled library

Post by fpiSTM »

You should create a dedicated library because I guess the pre compiled lib replace all other objects of the SrcWrapper library
User avatar
blue-man
Posts: 51
Joined: Mon Mar 23, 2020 5:02 pm

Re: [SOLVED] Use of precompiled library

Post by blue-man »

Of course.

But now this is not interesting any more. viewtopic.php?p=2710#p2710 ;)
Post Reply

Return to “Libraries & Hardware”