Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
skruglewicz
Level 4
Level 4
50 sign-ins First like received 5 solutions authored

I would like to create a library  to be used to connect to an external sensor using a PSoC 6 board that is supported in ModusToolbox. I have two boards #CY8CKIT-06S2

CY8CKIT-062S4 

CY8CKIT-062S2-43012 

I need some direction on where to start and some examples in the Knowledge base on the Anatomy of a library in MTB? I have not been able to find any information on where to or how to do this. There does not seem to be any Tutorials or videos on the topic? Any help would be appreciated.

Thanks in Advance

 

0 Likes
1 Solution

Thank you @Andri-setyabudi  and @MuhammadNanda_K 

I was able to get my own custom library developed and was able to use it from another project in ModusToolbox. The blog you suggested, answered all my questons. Enhance ModusToolbox™: Adding Custom Libraries for Better Efficiency. It gives a comprehensive guide on how to create and import third-party libraries into ModusToolbox

The example is available to download, but I had problems building on two versions of MTB 2.4 and 3.0

  • MTB 3.0 Problem in make fileRESULTS:
  • MTB 2.4 Problem with getlibs command..

OK so now I followed the directions according to the article, and created the library from scratch, using MTB3.1  and it worked great. SUCCESS!!

I used 

  • MTB3.1 and the PSoC62S2 board
  • in the workspace: C:\CY8_psoc62S2-WIFI-BE\Test1 

skruglewicz_0-1689140773267.png

 

The guide outlines two methods to create ustom libraries: the neat way and the easy way.

The neat way involves using the Eclipse IDE for ModusToolbox™ to create a static library. This method ensures that the library is built using the ModusToolbox™-compatible ARM Cross GCC toolchain. By creating a C project, adding the necessary source and header files, and configuring the project properties, you can build the static library within ModusToolbox™.

The easy way involves manually creating the custom library using the GCC toolchain. This method requires compiling the source files using the arm-none-eabi-gcc command and then generating a library using the ar command. The resulting static library file and header files can be used in ModusToolbox™ projects.

When it comes to using custom libraries in ModusToolbox™, the guide also presents two approaches: the easy way and the neat way.

The easy way involves copying the library file and header files to a specific directory within your project. ModusToolbox™ projects automatically search for header files and archives in the project directory, so this method is straightforward. You can then invoke the functions provided by the library and compile the project.

The neat way, on the other hand, involves manually modifying the project's makefile. You add the path of the header files to the INCLUDES variable and the path of the library archive file and its name to the LDFLAGS variable. This method provides more control and is recommended for complex projects with multiple static libraries. After making these modifications, you can compile the project and verify that the library's functions are working as expected.

This is a great article and helped me to create my own libraries.

Thanks again for directing me to the article.

 

 

 

View solution in original post

7 Replies
Andri-setyabudi
Level 5
Level 5
50 likes received 50 sign-ins 25 solutions authored

Hi @skruglewicz , 

Modustoolbox using standard GCC, so you can we can create our own library based on it. 
We need to provide the header .h and source .c files to our project. 
If we have the library file, we can put the library in the project directly by create a Source Folder 
Right Click on the project > New > Source Folder

Andrisetyabudi_0-1689040452355.png

And we can copy our header .h and source .c file inside that folder. 

Or if our library file is in the other path of directory, we can add on the list through the makefile

SOURCES+=path/to/file/Source1.c
INCLUDES+=path/to/headers.h
Please follow this document\

But if you want to create the custom precompiled library, please refer to this blog

Warm regards

Andri

Thank you 

Your reference to  blog, is just what I am looking for. I will try it and report back to you on my comments.

Regards

Steve K

Boston Massachusetts, USA

0 Likes

Thank you @Andri-setyabudi  and @MuhammadNanda_K 

I was able to get my own custom library developed and was able to use it from another project in ModusToolbox. The blog you suggested, answered all my questons. Enhance ModusToolbox™: Adding Custom Libraries for Better Efficiency. It gives a comprehensive guide on how to create and import third-party libraries into ModusToolbox

The example is available to download, but I had problems building on two versions of MTB 2.4 and 3.0

  • MTB 3.0 Problem in make fileRESULTS:
  • MTB 2.4 Problem with getlibs command..

OK so now I followed the directions according to the article, and created the library from scratch, using MTB3.1  and it worked great. SUCCESS!!

I used 

  • MTB3.1 and the PSoC62S2 board
  • in the workspace: C:\CY8_psoc62S2-WIFI-BE\Test1 

skruglewicz_0-1689140773267.png

 

The guide outlines two methods to create ustom libraries: the neat way and the easy way.

The neat way involves using the Eclipse IDE for ModusToolbox™ to create a static library. This method ensures that the library is built using the ModusToolbox™-compatible ARM Cross GCC toolchain. By creating a C project, adding the necessary source and header files, and configuring the project properties, you can build the static library within ModusToolbox™.

The easy way involves manually creating the custom library using the GCC toolchain. This method requires compiling the source files using the arm-none-eabi-gcc command and then generating a library using the ar command. The resulting static library file and header files can be used in ModusToolbox™ projects.

When it comes to using custom libraries in ModusToolbox™, the guide also presents two approaches: the easy way and the neat way.

The easy way involves copying the library file and header files to a specific directory within your project. ModusToolbox™ projects automatically search for header files and archives in the project directory, so this method is straightforward. You can then invoke the functions provided by the library and compile the project.

The neat way, on the other hand, involves manually modifying the project's makefile. You add the path of the header files to the INCLUDES variable and the path of the library archive file and its name to the LDFLAGS variable. This method provides more control and is recommended for complex projects with multiple static libraries. After making these modifications, you can compile the project and verify that the library's functions are working as expected.

This is a great article and helped me to create my own libraries.

Thanks again for directing me to the article.

 

 

 

MuhammadNanda_K
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 50 likes received

Hello @skruglewicz ,

You can try to follow as @Andri-setyabudi has explained.
(Thanks Andri for your sharing)

If you still have issue, please kindly inform us again.

Thank you and regards,
Muhammad Nanda

Thank you for responding . I will follow the blog refered to by @Andri-setyabudi  I'll let you both know how it goes.

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 50 likes received

Hello Steve K@skruglewicz ,

You are welcome. 🙂
Hopefully you can get the solution on your workarounds.

Any progress / issue, you can inform us.

Thank you and regards,
Muhammad Nanda

 

0 Likes
MuhammadNanda_K
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 50 likes received

Dear @skruglewicz ,

Glad to hear that your workarounds produce good result.
Thank you also for sharing, that hopefully this can be beneficial for the community! 🙂

I will close this thread then.

Thank you and regards,
Muhammad Nanda