0% found this document useful (0 votes)
414 views7 pages

How To Create and Use Static Library in MCUXpresso IDE - Ver3

This document discusses how to create and use static libraries in MCUXpresso IDE for Kinetis and LPC microcontrollers. It provides steps to create a static library project, add source code files, and generate the library file. It then shows how to add the static library to a user application project by including the header file, specifying the library and path in linker settings, adding sample code, and verifying the library function works by debugging. While "Smart Update" makes it convenient for LPC devices, static libraries for Kinetis products must be added manually. The steps presented provide a guide for using static libraries across supported MCU families in MCUXpresso IDE.

Uploaded by

Pablo Martinez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
414 views7 pages

How To Create and Use Static Library in MCUXpresso IDE - Ver3

This document discusses how to create and use static libraries in MCUXpresso IDE for Kinetis and LPC microcontrollers. It provides steps to create a static library project, add source code files, and generate the library file. It then shows how to add the static library to a user application project by including the header file, specifying the library and path in linker settings, adding sample code, and verifying the library function works by debugging. While "Smart Update" makes it convenient for LPC devices, static libraries for Kinetis products must be added manually. The steps presented provide a guide for using static libraries across supported MCU families in MCUXpresso IDE.

Uploaded by

Pablo Martinez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

How to create and use static library

in MCUXpresso IDE

For the previous KDS or CodeWarrior users, they may not create and use static library under
MCUXpresso IDE without a hitch, because the methods are not exactly same.

MCUXpresso IDE supports adding static library in user project with “Smart Update” wizard. This
feature is derived from LPCXpresso IDE. However, “Smart Update” wizard is only available for
natively supported LPC products in MCUXpresso 10.1.0 and lower versions. It will support all
LPC and Kinetis product in MCUXpresso IDE future release.

For MCUXpresso natively supported LPC product, using “Smart Update” to add library is very
convenient. User can learn its usage from this article:

https://community.nxp.com/message/630594

For Kinetis product, the only way to add library to project is by hand.

This article will take an example with MK64F demo, illustrating how to create and use static
library under MCUXpresso IDE step by step. It will also be good for all LPC and Kinetis users to
understand how user project works with external static libraries under MCUXpresso.

1. Create a static library in MCUXpresso IDE

step 1. Create a new project via “Quickstart Panel”, “New project…”

“Quickstart Panel” is an important concept in MCUXpresso IDE (and will become even more so
in the future) rather than the "standard Eclipse functionality" that was in KDS and CodeWarrior.
step 2: Select device
Step 3 Fill library project name, set Project Type as “C Static Library”. To simplify project, set
board as “Empty board files”, uncheck all Project Options. Then click “Finish”

Step 4. In the new created project, remove all the source files. We will add our own library
source files
Step 5. Then add add.c and add.h to the source folder

Step 6. Add these two files to IDE Project Explore. Rebuild project, lib file will be generated. The
GNU tools require libraries to be named libMK64F_LIB.a
2. Adding user static library in user application

Step 1. Create a new application project with wizard. Select project type as “C Project”. Then
“Finish”

Step 2. Add “add.h” and “libMK64F_LIB.a” to MK64F_APP


Step 3. Add library and path to linker properties settings

NOTE: We only specify library_name in Libraries (-l). For example, if you have a library called
libMK64F_LIB.a, we specify MK64F_LIB in the Linker Libraries settings. We also need to specify
the location that we have placed the library archive in the Library search path (-L) setting.

Refer article: https://community.nxp.com/message/630664

Step 4. Add source code in c file.


Step 5. Build project and launch debugger. Step over the code, we can see library function
works.

You might also like