Difference between revisions of "How to use the SEGGER Runtime Library with NXP's MCUXpresso"
(Created page with "In order to use the SEGGER Runtime Library in the MCUXpresso IDE, follow these steps: === Preparations === * Download and install MCUXpresso from nxp.com * Download and unzi...") |
|||
Line 16: | Line 16: | ||
=== Copy the SEGGER Runtime Library LIB folder into your MCUXpresso project === |
=== Copy the SEGGER Runtime Library LIB folder into your MCUXpresso project === |
||
+ | [[File:Pic1.png]] |
||
=== Make sure the LIB folder is part of the project === |
=== Make sure the LIB folder is part of the project === |
Revision as of 01:08, 29 March 2019
In order to use the SEGGER Runtime Library in the MCUXpresso IDE, follow these steps:
Contents
- 1 Preparations
- 2 Create a new project for the NXP MCU of your choice or import an SDK example project
- 3 Copy the SEGGER Runtime Library LIB folder into your MCUXpresso project
- 4 Make sure the LIB folder is part of the project
- 5 Add LIB folder to the list of include paths
- 6 Remove existing library from the project
- 7 In source files that make calls to the SEGGER Runtime Library, include “__libc.h” (starting with a double-underscore)
- 8 Build the project
- 9 Refer to the SEGGER Runtime Library User Guide in the Doc folder for additional information
Preparations
- Download and install MCUXpresso from nxp.com
- Download and unzip emLib-C from segger.com
- This will yield two folders:
LIB Doc
Create a new project for the NXP MCU of your choice or import an SDK example project
- Skip this step if you already have your own project
- Make sure the project builds without errors
Copy the SEGGER Runtime Library LIB folder into your MCUXpresso project
Make sure the LIB folder is part of the project
- Right-click on the LIB folder and select “Properties”
- In “C/C++ Build > Settings”, un-check the box that says “Exclude resource from build”
- Click “Apply and Close”
Add LIB folder to the list of include paths
- Right-click on the project node in the project explorer and select “Properties”
- Go to “C/C++ Build > Settings > MCU C Compiler > Includes”
- Click “Add”
- Add “../LIB” as new directory path
- Click “OK”
- Click “Move Up” to move ../LIB to the first position in the list
Remove existing library from the project
- In the project properties, go to: “C/C++ Build > Settings > MCU Linker > Managed Linker Script”
- In the “Library” pull-down menu, choose “No libraries”
- When prompted, click “Yes” to rebuild the index
In source files that make calls to the SEGGER Runtime Library, include “__libc.h” (starting with a double-underscore)
Build the project
- You will most likely encounter linker errors related to functions like __assert(), __putchar(), and __getchar()
- You need to implement these functions in your project according to your needs before the project will build correctly.
- Dummy implementation of __putchar():
int __putchar(int ch, __printf_tag_ptr pvoid) { return 1; }
- Dummy implementation of __getchar():
int __getchar(void) { return 1; }
- Basic implementation of __assert():
void __assert(const char *expression, const char *filename, int line) { for(;;) ; }
- After implementing these functions, your project should build without errors
- Consider cleaning the project before building it