This page gives more detailed information on how to use the IOH libraries in custom projects when using the LPCXpresso IDE. For more general information regarding using IOH libraries in custom project or for detailed instructions for Keil MDK and IAR EWARM, visit .
Note: This guide assumes the IOH I2S library is to be added to a project, hence the 'I2S' references. For other IOH libraries, 'I2S' should be replaced with the library name.
1. Add the IOH library (libioh_*lpcxpresso.a) to the project
The first step is to configure the LPCXpresso project to link against the IOH library. Open the project properties. Browse to 'Settings', then 'Libraries'. Add the library name (minus the 'lib' prefix) to the first box ('Libraries (-l)'), the library location to the second box ('Library search path (-L)').
2. Add the path where the library's header file resides to the project’s include path
The next step is to add the file location of the library's header file to the include path of the project. Still in the project properties, browse to 'Settings', then 'Includes'. Add the location to the 'Include paths (-I)' box.
3. #include the IOH header file in the source code of the application
The IOH header file must be included in the source code of the project (e.g. main.c) by using the following preprocessor directive:
4. Configure the linker to place the IOH related sections in the IOH SRAM
All IOH parts have an SRAM region reserved for I/O Handler. When starting IOH, usually by calling the library's init() function, I/O Handler expects this memory region to be loaded with the IOH data provided by the IOH library. This means this data must be stored in Flash and copied to the IOH SRAM upon startup. A convenient way to do this, is by using scatter loading. With scatter loading, the linker and c-library are instructed to program certain data sections (IOH data) into Flash, and copy it to the specifed region (IOH SRAM) upon start up. This requires a linker script. When using LPCXpresso, this is taken care of automatically when selecting an IOH-enabled part and using the 'Manage Linker Script' option active
5. Enable the IOH SRAM (SRAM1) before C-library initialization
The copying of data from the 'load region' to the 'execution region' when using scatter loading (explained above) is executed by the c-library just before main() gets called. It's important that both regions are enabled when the copying is initiated. After power-on, the IOH SRAM on the LPC11E/U37H is disabled (clock disabled in the SYSAHBCLKCTRL register), so it must be enabled before the scatter loading is initiated. The startup file included in LPCXpresso for IOH-enabled parts automatically enable the SRAM in time.
6. Interact with IOH via the library's API
The final step is to interact from the application with IOH. This can be done through the library's API. Each library comes with an application note explaining how to use the library and what data structures and functions are available, and with one or more application examples showing how to use the library. This application note and application example provide an easy way to get started. They can be downloaded from the main .