This user's guide describes the General Functions Library (GFLIB) for the family of
ARM Cortex M7F core-based microcontrollers. This library contains optimized
functions.
1.1.2
GFLIB supports several data types: (un)signed integer, fractional, and accumulator, and
floating point. The integer data types are useful for general-purpose computation; they
are familiar to the MPU and MCU programmers. The fractional data types enable
powerful numeric and digital-signal-processing algorithms to be implemented. The
accumulator data type is a combination of both; that means it has the integer and
fractional portions.The floating-point data types are capable of storing real numbers in
wide dynamic ranges. The type is represented by binary digits and an exponent. The
exponent allows scaling the numbers from extremely small to extremely big numbers.
Because the exponent takes part of the type, the overall resolution of the number is
reduced when compared to the fixed-point type of the same size.
The following list shows the integer types defined in the libraries:
• Unsigned 16-bit integer —<0 ; 65535> with the minimum resolution of 1
• Signed 16-bit integer —<-32768 ; 32767> with the minimum resolution of 1
• Unsigned 32-bit integer —<0 ; 4294967295> with the minimum resolution of 1
• Signed 32-bit integer —<-2147483648 ; 2147483647> with the minimum resolution
Data types
of 1
GFLIB User's Guide, Rev. 4, 12/2020
NXP Semiconductors5
Introduction
• Unsigned 64-bit integer —<0 ; 18446744073709551615> with the minimum
resolution of 1
• Signed 64-bit integer —<-9223372036854775808 ; 9223372036854775807> with
the minimum resolution of 1
The following list shows the fractional types defined in the libraries:
• Fixed-point 16-bit fractional —<-1 ; 1 - 2
• Fixed-point 32-bit fractional —<-1 ; 1 - 2
-15
> with the minimum resolution of 2
-31
> with the minimum resolution of 2
-15
-31
The following list shows the accumulator types defined in the libraries:
• Fixed-point 16-bit accumulator —<-256.0 ; 256.0 - 2-7> with the minimum
resolution of 2
The following list shows the floating-point types defined in the libraries:
• Floating point 32-bit single precision —<-3.40282 · 1038 ; 3.40282 · 1038> with the
minimum resolution of 2
1.1.3
API definition
-23
GFLIB uses the types mentioned in the previous section. To enable simple usage of the
algorithms, their names use set prefixes and postfixes to distinguish the functions'
versions. See the following example:
• lss—the types of the function inputs; if all the inputs have the same type as the
output, the inputs are not marked
The input and output types are described in the following table:
Table 1-1. Input/output types
TypeOutputInput
frac16_tF16s
Table continues on the next page...
GFLIB User's Guide, Rev. 4, 12/2020
6NXP Semiconductors
Chapter 1 Library
Table 1-1. Input/output types (continued)
TypeOutputInput
frac32_tF32l
acc32_tA32a
float_tFLTf
1.1.4Supported compilers
GFLIB for the ARM Cortex M7F core is written in C language or assembly language
with C-callable interface depending on the specific function. The library is built and
tested using the following compilers:
• MCUXpresso IDE
• IAR Embedded Workbench
• Keil µVision
For the MCUXpresso IDE, the library is delivered in the gflib.a file.
For the Kinetis Design Studio, the library is delivered in the gflib.a file.
For the IAR Embedded Workbench, the library is delivered in the gflib.a file.
For the Keil µVision, the library is delivered in the gflib.lib file.
The interfaces to the algorithms included in this library are combined into a single public
interface include file, gflib.h. This is done to lower the number of files required to be
included in your application.
1.1.5
Library configuration
GFLIB for the ARM Cortex M7F core is written in C language or assembly language
with C-callable interface depending on the specific function. Some functions from this
library are inline type, which are compiled together with project using this library. The
optimization level for inline function is usually defined by the specific compiler setting. It
can cause an issue especially when high optimization level is set. Therefore the
optimization level for all inline assembly written functions is defined by compiler
pragmas using macros. The configuration header file RTCESL_cfg.h is located in:
specific library folder\MLIB\Include. The optimization level can be changed by
modifying the macro value for specific compiler. In case of any change the library
functionality is not guaranteed.
GFLIB User's Guide, Rev. 4, 12/2020
NXP Semiconductors7
Library integration into project (MCUXpresso IDE)
Similarly as optimization level the High-speed functions execution suppport can be
enable by defined symbol RAM_OPTIM_LOW (RAM_OPTIM_MEDIUM or
RAM_OPTIM_HIGH) or disable by not defining any of these macrors. symbol
RTCESL_MMDVSQ_OFF in project setting described in the High-speed functions
execution suppport cheaper for specific compiler.
1.1.6Special issues
1. The equations describing the algorithms are symbolic. If there is positive 1, the
number is the closest number to 1 that the resolution of the used fractional type
allows. If there are maximum or minimum values mentioned, check the range
allowed by the type of the particular function version.
2. The library functions that round the result (the API contains Rnd) round to nearest
(half up).
1.2
Library integration into project (MCUXpresso IDE)
This section provides a step-by-step guide on how to quickly and easily include GFLIB
into any MCUXpresso SDK example or demo application projects using MCUXpresso
IDE. This example uses the default installation path (C:\NXP\RTCESL
\CM7F_RTCESL_4.6_MCUX). If you have a different installation path, use that path
instead.
1.2.1
High-speed functions execution suppport
Some RT (or other) platforms contain high-speed functions execution support by
relocating all functions from the default Flash memory location to the RAM location for
much faster code access. The feature is important especially for devices with a slow Flash
interface. This section shows how to turn the RAM optimization feature support on and
off.
1. In the MCUXpresso SDK project name node or on the left-hand side, click Properties
or select Project > Properties from the menu. A project properties dialog appears.
2. Expand the C/C++ Build node and select Settings. See Figure 1-1.
3. On the right-hand side, under the MCU C Compiler node, click the Preprocessor
node. See Figure 1-1.
GFLIB User's Guide, Rev. 4, 12/2020
8NXP Semiconductors
Chapter 1 Library
Figure 1-1. Defined symbols
4. On the right-hand side of the dialog, click the Add... icon located next to the Defined
symbols (-D) title.
5. In the dialog that appears (see Figure 1-2), type the following:
• RAM_RELOCATION — to turn the RAM optimization feature support on
If the define is defined, all RTCEL functions are put to the RAM.
Figure 1-2. Symbol definition
6. Click OK in the dialog.
7. Click OK in the main dialog.
The device reference manual shows how the__RAMFUNC(RAM) atribute works in connection
with your device.
GFLIB User's Guide, Rev. 4, 12/2020
NXP Semiconductors9
Library integration into project (MCUXpresso IDE)
1.2.2Library path variable
To make the library integration easier, create a variable that holds the information about
the library path.
1. Right-click the MCUXpresso SDK project name node in the left-hand part and click
Properties, or select Project > Properties from the menu. A project properties dialog
appears.
2. Expand the Resource node and click Linked Resources. See Figure 1-3.
Figure 1-3. Project properties
3. Click the New… button in the right-hand side.
4. In the dialog that appears (see Figure 1-4), type this variable name into the Name
box: RTCESL_LOC.
5. Select the library parent folder by clicking Folder…, or just type the following path
into the Location box: C:\NXP\RTCESL\CM7F_RTCESL_4.6_MCUX. Click OK.
GFLIB User's Guide, Rev. 4, 12/2020
10NXP Semiconductors
Chapter 1 Library
Figure 1-4. New variable
6. Create such variable for the environment. Expand the C/C++ Build node and click
Environment.
7. Click the Add… button in the right-hand side.
8. In the dialog that appears (see Figure 1-5), type this variable name into the Name
box: RTCESL_LOC.
9. Type the library parent folder path into the Value box: C:\NXP\RTCESL
\CM7F_RTCESL_4.6_MCUX.
10. Tick the Add to all configurations box to use this variable in all configurations. See
Figure 1-5.
11. Click OK.
12. In the previous dialog, click OK.
GFLIB User's Guide, Rev. 4, 12/2020
NXP Semiconductors11
Library integration into project (MCUXpresso IDE)
Figure 1-5. Environment variable
1.2.3
Library folder addition
To use the library, add it into the Project tree dialog.
1. Right-click the MCUXpresso SDK project name node in the left-hand part and click
New > Folder, or select File > New > Folder from the menu. A dialog appears.
2. Click Advanced to show the advanced options.
3. To link the library source, select the Link to alternate location (Linked Folder)
option.
4. Click Variables..., select the RTCESL_LOC variable in the dialog, click OK, and/or
type the variable name into the box. See Figure 1-6.
5. Click Finish, and the library folder is linked in the project. See Figure 1-7.
GFLIB User's Guide, Rev. 4, 12/2020
12NXP Semiconductors
Chapter 1 Library
Figure 1-6. Folder link
Figure 1-7. Projects libraries paths
1.2.4
Library path setup
GFLIB requires MLIB to be included too. These steps show how to include all dependent
modules:
1. Right-click the MCUXpresso SDK project name node in the left-hand part and click
Properties, or select Project > Properties from the menu. The project properties
dialog appears.
2. Expand the C/C++ General node, and click Paths and Symbols.
3. In the right-hand dialog, select the Library Paths tab. See Figure 1-9.
4. Click the Add… button on the right, and a dialog appears.
GFLIB User's Guide, Rev. 4, 12/2020
NXP Semiconductors13
Library integration into project (MCUXpresso IDE)
5. Look for the RTCESL_LOC variable by clicking Variables…, and then finish the
path in the box by adding the following (see Figure 1-8): ${RTCESL_LOC}\MLIB.
6. Click OK, and then click the Add… button.
7. Look for the RTCESL_LOC variable by clicking Variables…, and then finish the
path in the box by adding the following: ${RTCESL_LOC}\GFLIB.
8. Click OK, you will see the paths added into the list. See Figure 1-9.
Figure 1-8. Library path inclusion
Figure 1-9. Library paths
9. After adding the library paths, add the library files. Click the Libraries tab. See
Figure 1-11.
10. Click the Add… button on the right, and a dialog appears.
11. Type the following into the File text box (see Figure 1-10): :mlib.a
12. Click OK, and then click the Add… button.
13. Type the following into the File text box: :gflib.a
14. Click OK, and you will see the libraries added in the list. See Figure 1-11.
GFLIB User's Guide, Rev. 4, 12/2020
14NXP Semiconductors
Chapter 1 Library
Figure 1-10. Library file inclusion
Figure 1-11. Libraries
15. In the right-hand dialog, select the Includes tab, and click GNU C in the Languages
list. See Figure 1-13.
16. Click the Add… button on the right, and a dialog appears. See Figure 1-12.
17. Look for the RTCESL_LOC variable by clicking Variables…, and then finish the
path in the box to be: ${RTCESL_LOC}\MLIB\Include
18. Click OK, and then click the Add… button.
19. Look for the RTCESL_LOC variable by clicking Variables…, and then finish the
path in the box to be: ${RTCESL_LOC}\GFLIB\Include
20. Click OK, and you will see the paths added in the list. See Figure 1-13. Click OK.
Figure 1-12. Library include path addition
GFLIB User's Guide, Rev. 4, 12/2020
NXP Semiconductors15
Library integration into project (Keil µVision)
Figure 1-13. Compiler setting
Type the #include syntax into the code where you want to call the library functions. In
the left-hand dialog, open the required .c file. After the file opens, include the following
lines into the #include section:
#include "mlib_FP.h"
#include "gflib_FP.h"
When you click the Build icon (hammer), the project is compiled without errors.
1.3
Library integration into project (Keil µVision)
This section provides a step-by-step guide on how to quickly and easily include GFLIB
into an empty project or any MCUXpresso SDK example or demo application projects
using Keil µVision. This example uses the default installation path (C:\NXP\RTCESL
\CM7F_RTCESL_4.6_KEIL). If you have a different installation path, use that path
instead. If any MCUXpresso SDK project is intended to use (for example hello_world
project) go to Linking the files into the project chapter otherwise read next chapter.
GFLIB User's Guide, Rev. 4, 12/2020
16NXP Semiconductors
Chapter 1 Library
1.3.1NXP pack installation for new project (without MCUXpresso
SDK)
This example uses the NXP MKV58F1M0xxx22 part, and the default installation path
(C:\NXP\RTCESL\CM7F_RTCESL_4.6_KEIL) is supposed. If the compiler has never
been used to create any NXP MCU-based projects before, check whether the NXP MCU
pack for the particular device is installed. Follow these steps:
1. Launch Keil µVision.
2. In the main menu, go to Project > Manage > Pack Installer….
3. In the left-hand dialog (under the Devices tab), expand the All Devices > Freescale
(NXP) node.
4. Look for a line called "KVxx Series" and click it.
5. In the right-hand dialog (under the Packs tab), expand the Device Specific node.
6. Look for a node called "Keil::Kinetis_KVxx_DFP." If there are the Install or Update
options, click the button to install/update the package. See Figure 1-14.
7. When installed, the button has the "Up to date" title. Now close the Pack Installer.
Figure 1-14. Pack Installer
GFLIB User's Guide, Rev. 4, 12/2020
NXP Semiconductors17
Library integration into project (Keil µVision)
1.3.2New project (without MCUXpresso SDK)
To start working on an application, create a new project. If the project already exists and
is opened, skip to the next section. Follow these steps to create a new project:
1. Launch Keil µVision.
2. In the main menu, select Project > New µVision Project…, and the Create New
Project dialog appears.
3. Navigate to the folder where you want to create the project, for example C:
\KeilProjects\MyProject01. Type the name of the project, for example MyProject01.
Click Save. See Figure 1-15.
Figure 1-15. Create New Project dialog
4. In the next dialog, select the Software Packs in the very first box.
5. Type '' into the Search box, so that the device list is reduced to the devices.
6. Expand the node.
7. Click the MKV58F1M0xxx22 node, and then click OK. See Figure 1-16.
Figure 1-16. Select Device dialog
8. In the next dialog, expand the Device node, and tick the box next to the Startup node.
See Figure 1-17.
GFLIB User's Guide, Rev. 4, 12/2020
18NXP Semiconductors
9. Expand the CMSIS node, and tick the box next to the CORE node.
Chapter 1 Library
Figure 1-17. Manage Run-Time Environment dialog
10. Click OK, and a new project is created. The new project is now visible in the lefthand part of Keil µVision. See Figure 1-18.
Figure 1-18. Project
11. In the main menu, go to Project > Options for Target 'Target1'…, and a dialog
appears.
GFLIB User's Guide, Rev. 4, 12/2020
NXP Semiconductors19
Library integration into project (Keil µVision)
12. Select the Target tab.
13. Select Use Single Precision in the Floating Point Hardware option. See Figure 1-18.
Figure 1-19. FPU
1.3.3
High-speed functions execution support
Some RT (or other) platforms contain high-speed functions execution support by
relocating all functions from the default Flash memory location to the RAM location for
much faster code access. The feature is important especially for devices with a slow Flash
interface. This section shows how to turn the RAM optimization feature support on and
off.
1. In the main menu, go to Project > Options for Target 'Target1'…, and a dialog
appears.
2. Select the C/C++ tab. See .
3. In the Include Preprocessor Symbols text box, type the following:
• RAM_RELOCATION — to turn the RAM optimization feature support on
If the define is defined, all RTCEL functions are put to the RAM.
GFLIB User's Guide, Rev. 4, 12/2020
20NXP Semiconductors
Figure 1-20. Preprocessor symbols
4. Click OK in the main dialog.
Chapter 1 Library
The device reference manual shows how the__attribute__ ((section ("ram"))) atribute
works in connection with your device.
1.3.4
Linking the files into the project
GFLIB requires MLIB to be included too. The following steps show how to include all
dependent modules.
To include the library files in the project, create groups and add them.
1. Right-click the Target 1 node in the left-hand part of the Project tree, and select Add
Group… from the menu. A new group with the name New Group is added.
2. Click the newly created group, and press F2 to rename it to RTCESL.
3. Right-click the RTCESL node, and select Add Existing Files to Group 'RTCESL'…
from the menu.
4. Navigate into the library installation folder C:\NXP\RTCESL
\CM7F_RTCESL_4.6_KEIL\MLIB\Include, and select the mlib_FP.h file. If the file
does not appear, set the Files of type filter to Text file. Click Add. See Figure 1-21.
GFLIB User's Guide, Rev. 4, 12/2020
NXP Semiconductors21
Library integration into project (Keil µVision)
Figure 1-21. Adding .h files dialog
5. Navigate to the parent folder C:\NXP\RTCESL\CM7F_RTCESL_4.6_KEIL\MLIB,
and select the mlib.lib file. If the file does not appear, set the Files of type filter to
Library file. Click Add. See Figure 1-22.
Figure 1-22. Adding .lib files dialog
6. Navigate into the library installation folder C:\NXP\RTCESL
\CM7F_RTCESL_4.6_KEIL\GFLIB\Include, and select the gflib_FP.h file. If the
file does not appear, set the Files of type filter to Text file. Click Add.
7. Navigate to the parent folder C:\NXP\RTCESL\CM7F_RTCESL_4.6_KEIL\GFLIB,
and select the gflib.lib file. If the file does not appear, set the Files of type filter to
Library file. Click Add.
8. Now, all necessary files are in the project tree; see Figure 1-23. Click Close.
GFLIB User's Guide, Rev. 4, 12/2020
22NXP Semiconductors
Figure 1-23. Project workspace
Chapter 1 Library
1.3.5
Library path setup
The following steps show the inclusion of all dependent modules.
1. In the main menu, go to Project > Options for Target 'Target1'…, and a dialog
appears.
2. Select the C/C++ tab. See Figure 1-24.
3. In the Include Paths text box, type the following paths (if there are more paths, they
must be separated by ';') or add them by clicking the … button next to the text box:
Type the #include syntax into the code. Include the library into a source file. In the new
project, it is necessary to create a source file:
1. Right-click the Source Group 1 node, and Add New Item to Group 'Source Group
1'… from the menu.
2.
Select the C File (.c) option, and type a name of the file into the Name box, for
example 'main.c'. See Figure 1-25.
GFLIB User's Guide, Rev. 4, 12/2020
24NXP Semiconductors
Chapter 1 Library
Figure 1-25. Adding new source file dialog
3. Click Add, and a new source file is created and opened up.
4. In the opened source file, include the following lines into the #include section, and
create a main function:
#include "mlib_FP.h"
#include "gflib_FP.h"
int main(void)
{
while(1);
}
When you click the Build (F7) icon, the project will be compiled without errors.
1.4
Library integration into project (IAR Embedded
Workbench)
This section provides a step-by-step guide on how to quickly and easily include the
GFLIB into an empty project or any MCUXpresso SDK example or demo application
projects using IAR Embedded Workbench. This example uses the default installation
path (C:\NXP\RTCESL\CM7F_RTCESL_4.6_IAR). If you have a different installation
path, use that path instead. If any MCUXpresso SDK project is intended to use (for
example hello_world project) go to Linking the files into the project chapter otherwise
read next chapter.
GFLIB User's Guide, Rev. 4, 12/2020
NXP Semiconductors25
Library integration into project (IAR Embedded Workbench)
1.4.1New project (without MCUXpresso SDK)
This example uses the NXP MKV58F1M0xxx22 part, and the default installation path
(C:\NXP\RTCESL\CM7F_RTCESL_4.6_IAR) is supposed. To start working on an
application, create a new project. If the project already exists and is opened, skip to the
next section. Perform these steps to create a new project:
1. Launch IAR Embedded Workbench.
2. In the main menu, select Project > Create New Project… so that the "Create New
Project" dialog appears. See Figure 1-26.
Figure 1-26. Create New Project dialog
3. Expand the C node in the tree, and select the "main" node. Click OK.
4. Navigate to the folder where you want to create the project, for example, C:
\IARProjects\MyProject01. Type the name of the project, for example, MyProject01.
Click Save, and a new project is created. The new project is now visible in the lefthand part of IAR Embedded Workbench. See Figure 1-27.
GFLIB User's Guide, Rev. 4, 12/2020
26NXP Semiconductors
Chapter 1 Library
Figure 1-27. New project
5. In the main menu, go to Project > Options…, and a dialog appears.
6. In the Target tab, select the Device option, and click the button next to the dialog to
select the MCU. In this example, select NXP > KV5x > NXP MKV58F1M0xxx22.
Select VFPv5 single precision in the FPU option. Click OK. See Figure 1-28.
Figure 1-28. Options dialog
GFLIB User's Guide, Rev. 4, 12/2020
NXP Semiconductors27
Library integration into project (IAR Embedded Workbench)
1.4.2High-speed functions execution suppport
Some RT (or other) platforms contain high-speed functions execution support by
relocating all functions from the default Flash memory location to the RAM location for
much faster code access. The feature is important especially for devices with a slow Flash
interface. This section shows how to turn the RAM optimization feature support on and
off.
1. In the main menu, go to Project > Options…, and a dialog appears.
2. In the left-hand side column, select C/C++ Compiler.
3. In the right-hand side of the dialog, click the Preprocessor tab (it can be hidden on
the right; use the arrow icons for navigation).
4. In the text box (in Defined symbols: (one per line)), type the following (See Figure
1-29):
• RAM_RELOCATION — to turn the RAM optimization feature support on
If the define is defined, all RTCEL functions are put to the RAM.
Figure 1-29. Defined symbols
5. Click OK in the main dialog.
The device reference manual shows how the __ramfunc atribute works in connection with
your device.
GFLIB User's Guide, Rev. 4, 12/2020
28NXP Semiconductors
Chapter 1 Library
1.4.3Library path variable
To make the library integration easier, create a variable that will hold the information
about the library path.
1. In the main menu, go to Tools > Configure Custom Argument Variables…, and a
dialog appears.
2. Click the New Group button, and another dialog appears. In this dialog, type the
name of the group PATH, and click OK. See Figure 1-30.
Figure 1-30. New Group
3. Click on the newly created group, and click the Add Variable button. A dialog
appears.
4. Type this name: RTCESL_LOC
5. To set up the value, look for the library by clicking the '…' button, or just type the
installation path into the box: C:\NXP\RTCESL\CM7F_RTCESL_4.6_IAR. Click
OK.
6. In the main dialog, click OK. See Figure 1-31.
Figure 1-31. New variable
GFLIB User's Guide, Rev. 4, 12/2020
NXP Semiconductors29
Library integration into project (IAR Embedded Workbench)
1.4.4Linking the files into the project
GFLIB requires MLIB to be included too. The following steps show the inclusion of all
dependent modules.
To include the library files into the project, create groups and add them.
1. Go to the main menu Project > Add Group…
2. Type RTCESL, and click OK.
3. Click on the newly created node RTCESL, go to Project > Add Group…, and create
a MLIB subgroup.
4. Click on the newly created node MLIB, and go to the main menu Project > Add
Files… See Figure 1-33.
5. Navigate into the library installation folder C:\NXP\RTCESL
\CM7F_RTCESL_4.6_IAR\MLIB\Include, and select the mlib_FP.h file. (If the file
does not appear, set the file-type filter to Source Files.) Click Open. See Figure 1-32.
6. Navigate into the library installation folder C:\NXP\RTCESL
\CM7F_RTCESL_4.6_IAR\MLIB, and select the mlib.a file. If the file does not
appear, set the file-type filter to Library / Object files. Click Open.
Figure 1-32. Add Files dialog
7. Click on the RTCESL node, go to Project > Add Group…, and create a GFLIB
subgroup.
8. Click on the newly created node GFLIB, and go to the main menu Project > Add
Files….
9. Navigate into the library installation folder C:\NXP\RTCESL
\CM7F_RTCESL_4.6_IAR\GFLIB\Include, and select the gflib_FP.h file. (If the file
does not appear, set the file-type filter to Source Files.) Click Open.
10. Navigate into the library installation folder C:\NXP\RTCESL
\CM7F_RTCESL_4.6_IAR\GFLIB, and select the gflib.a file. If the file does not
appear, set the file-type filter to Library / Object files. Click Open.
11. Now you will see the files added in the workspace. See Figure 1-33.
GFLIB User's Guide, Rev. 4, 12/2020
30NXP Semiconductors
Loading...
+ 125 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.