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...") |
m |
||
(9 intermediate revisions by 2 users not shown) | |||
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 === |
||
Line 21: | Line 22: | ||
* Right-click on the LIB folder and select “Properties” |
* Right-click on the LIB folder and select “Properties” |
||
* In “C/C++ Build > Settings”, un-check the box that says “Exclude resource from build” |
* In “C/C++ Build > Settings”, un-check the box that says “Exclude resource from build” |
||
+ | [[File:Pic2.png]] |
||
* Click “Apply and Close” |
* Click “Apply and Close” |
||
Line 29: | Line 31: | ||
* Click “Add” |
* Click “Add” |
||
* Add “../LIB” as new directory path |
* Add “../LIB” as new directory path |
||
+ | [[File:Pic3.png]] |
||
* Click “OK” |
* Click “OK” |
||
* Click “Move Up” to move ../LIB to the first position in the list |
* Click “Move Up” to move ../LIB to the first position in the list |
||
+ | [[File:Pic4.png]] |
||
=== Remove existing library from the project === |
=== Remove existing library from the project === |
||
Line 36: | Line 40: | ||
* In the project properties, go to: “C/C++ Build > Settings > MCU Linker > Managed Linker Script” |
* In the project properties, go to: “C/C++ Build > Settings > MCU Linker > Managed Linker Script” |
||
* In the “Library” pull-down menu, choose “No libraries” |
* In the “Library” pull-down menu, choose “No libraries” |
||
+ | [[File:Pic5.png]] |
||
* When prompted, click “Yes” to rebuild the index |
* When prompted, click “Yes” to rebuild the index |
||
+ | [[File:Pic6.png]] |
||
=== In source files that make calls to the SEGGER Runtime Library, include “__libc.h” (starting with a double-underscore) === |
=== In source files that make calls to the SEGGER Runtime Library, include “__libc.h” (starting with a double-underscore) === |
||
+ | [[File:Pic7.png]] |
||
=== Build the project === |
=== Build the project === |
||
Line 61: | Line 68: | ||
* Consider cleaning the project before building it |
* Consider cleaning the project before building it |
||
− | + | Refer to the SEGGER Runtime Library User Guide in the Doc folder for additional information |
Latest revision as of 11:19, 25 June 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
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
Refer to the SEGGER Runtime Library User Guide in the Doc folder for additional information