Hi:
I want to link a static library in the mcusw code. I have generated the. a library file.
How can I link this library file?What changes do I need to make in the makefile please?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
You should be able to link it where needed by including the static library in the appropriate Makefile. For example, if you look at the MCSPI App, you can see an example of linking the SCI Client Direct Library
File: /ti-processor-sdk-rtos-j721e-evm-07_03_00_07/mcusw/mcal_drv/mcal/examples/Spi/mcspi_app/makefile
EXT_LIB_LIST_COMMON += $(sciclient_direct_LIBPATH)/$(SOC)/$(CORE)/$(BUILD_PROFILE_$(CORE))/$(sciclient_direct_LIBNAME).$(LIBEXT)
Once added to the EXT_LIB_LIST_COMMON list, it will get pulled into the build, see the PDK for how EXT_LIB_LIST_COMMON eventually gets added to the LNK_LIBS list, and this gets added to the linker command in the core-specific build file (makerules/rules_ti_cgt_arm.mk for example).
Regards,
Erick
Hi Erick
If I want to call the function of the static library under main_tirtos.c , the path is /home/tda4/TDA4_QNX/PSDKRA/mcusw/mcuss_demos/profiling/can/main_tirtos.c,
Which makefile should I modify? Please provide detailed instructions on how to modify it.
Regards,
Mingfei
Hi Mingfei,
The makefile should be mcusw/mcuss_demos/profiling/can/makefile.
As you can see, the main_tirtos.c is mentioned in this makefile, if you want to link a static library that is accessible to the file, this would be a good place to do it. I would suggest adding it with the other libraries, perhaps around line 19:
# List all the external ibs required by the application
EXT_LIB_LIST_COMMON += $(csl_LIBPATH)/$(SOC)/$(ISA_EXT)/$(BUILD_PROFILE_$(CORE))/$(csl_LIBNAME).$(LIBEXT)
EXT_LIB_LIST_COMMON += <Your library>
For your main_tirtos.c to compile, you will also need to add the necessary header files with the function prototypes or variables you will be bringing in.
Regards,
Erick