Using stemwin library

Hi
How I can use stemwin library?
http://www.st.com/web/en/catalog/tools/PF259225

Any body can help me?
I just want use the static library (.a). How I can use in yotta?

Have you tried to create your own module, and there in source folder, create CMakeLists.txt file to add that static library, using add_library (http://www.cmake.org/cmake/help/v3.0/command/add_library.html).

An example of custom CMakeLists.txt file from k64f hal :https://github.com/ARMmbed/mbed-hal-k64f/blob/master/source/CMakeLists.txt, just for illustration.

1 Like

Hi
Thank you for response
I create new module with “mbed-stemwin” name. and create file in source

add_library(mbed-stemwin STATIC IMPORTED)
set_property(TARGET mbed-stemwin PROPERTY IMPORTED_LOCATION "./STemWin526_CM4_GCC.a")

set_target_properties(mbed-stemwin PROPERTIES
    LINKER_LANGUAGE C
)

but when run yt build create error

FAILED: : && /home/yyy/adamgreen-gcc4mbed-3b4f8cb/gcc-arm-none-eabi/bin/arm-none-eabi-g++   -fno-exceptions -fno-unwind-tables -Wl,--gc-sections -Wl,--sort-common -Wl,--sort-section=alignment -Wl,-wrap,main -mcpu=cortex-m4 -mthumb -T"/home/vahid/blinky2/yotta_targets/stm32f429i-disco-gcc/CMake/../ld/STM32F429ZI.ld" -Wl,-Map,source/blinky2.map -Wl,--start-group source/CMakeFiles/blinky2.dir/home/vahid/blinky2/source/blinky.cpp.o  ym/mbed-drivers/source/mbed-drivers.a -lmbed-stemwin ym/mbed-hal/yotta_dummy_lib_mbed_hal/mbed-hal.a ym/cmsis-core/yotta_dummy_lib_cmsis_core/cmsis-core.a ym/minar/source/minar.a ym/core-util/source/core-util.a ym/mbed-hal-st/yotta_dummy_lib_mbed_hal_st/mbed-hal-st.a ym/cmsis-core-st/yotta_dummy_lib_cmsis_core_st/cmsis-core-st.a ym/minar-platform/yotta_dummy_lib_minar_platform/minar-platform.a ym/mbed-hal-st-stm32f4/source/mbed-hal-st-stm32f4.a ym/cmsis-core-stm32f4/source/cmsis-core-stm32f4.a ym/minar-platform-mbed/source/minar-platform-mbed.a ym/mbed-hal-st-stm32cubef4/source/mbed-hal-st-stm32cubef4.a ym/mbed-hal-st-stm32f429zi/source/mbed-hal-st-stm32f429zi.a ym/cmsis-core-stm32f429xi/source/cmsis-core-stm32f429xi.a ym/mbed-drivers/source/mbed-drivers.a ym/mbed-hal/yotta_dummy_lib_mbed_hal/mbed-hal.a ym/cmsis-core/yotta_dummy_lib_cmsis_core/cmsis-core.a ym/minar/source/minar.a ym/core-util/source/core-util.a ym/mbed-hal-st/yotta_dummy_lib_mbed_hal_st/mbed-hal-st.a ym/cmsis-core-st/yotta_dummy_lib_cmsis_core_st/cmsis-core-st.a ym/minar-platform/yotta_dummy_lib_minar_platform/minar-platform.a ym/mbed-hal-st-stm32f4/source/mbed-hal-st-stm32f4.a ym/cmsis-core-stm32f4/source/cmsis-core-stm32f4.a ym/minar-platform-mbed/source/minar-platform-mbed.a ym/mbed-hal-st-stm32cubef4/source/mbed-hal-st-stm32cubef4.a ym/mbed-hal-st-stm32f429zi/source/mbed-hal-st-stm32f429zi.a ym/cmsis-core-stm32f429xi/source/cmsis-core-stm32f429xi.a ym/compiler-polyfill/yotta_dummy_lib_compiler_polyfill/compiler-polyfill.a ym/ualloc/source/ualloc.a ym/dlmalloc/source/dlmalloc.a -Wl,-wrap,_malloc_r -Wl,-wrap,_calloc_r -Wl,-wrap,_realloc_r -Wl,-wrap,_free_r -Wl,-wrap,_sbrk_r ym/uvisor-lib/source/uvisor-lib.a -lstdc++ -lsupc++ -lm -lc -lgcc -lstdc++ -lsupc++ -lm -lc -lgcc -Wl,--end-group  --specs=nano.specs -o source/blinky2 && cd /home/vahid/blinky2/build/stm32f429i-disco-gcc/source && /home/vahid/adamgreen-gcc4mbed-3b4f8cb/gcc-arm-none-eabi/bin/arm-none-eabi-objcopy -O binary blinky2 blinky2.bin && cd /home/vahid/blinky2/build/stm32f429i-disco-gcc/source && /home/vahid/adamgreen-gcc4mbed-3b4f8cb/gcc-arm-none-eabi/bin/arm-none-eabi-objcopy -O binary blinky2 blinky2.bin
/home/vahid/adamgreen-gcc4mbed-3b4f8cb/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld: cannot find -lmbed-stemwin

Thank you I fixed this.

Can you share with us how did you fixed it?

add_library(mbed-stemwin_s STATIC IMPORTED)
set_property(TARGET mbed-stemwin_s PROPERTY IMPORTED_LOCATION "STemWin522_CM4_GCC.a")

add_library(mbed-stemwin mbed-stemwin.c)
target_link_libraries(mbed-stemwin mbed-stemwin_s)

could you share the libary with me? Or provide more details?

There’s a guide here to creating a yotta module for an existing binary library.

Note that doing this does severely limit the portability of your module though, so if possible import the source of the library into a yotta module which can be recompiled for different platforms :wink:

Thanks, I’ll have a look