Ram Gandikota
/
IOTMetronome
FRDM K64F Metronome
pal/Source/Port/Readme.md@0:dbad57390bd1, 2017-05-14 (annotated)
- Committer:
- ram54288
- Date:
- Sun May 14 18:37:05 2017 +0000
- Revision:
- 0:dbad57390bd1
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ram54288 | 0:dbad57390bd1 | 1 | ## PAL porting guide |
ram54288 | 0:dbad57390bd1 | 2 | |
ram54288 | 0:dbad57390bd1 | 3 | This document describes the process of PAL porting to different operating systems. During the process, you need to work |
ram54288 | 0:dbad57390bd1 | 4 | with the [**Port**](https://github.com/ARMmbed/mbed-client-pal/tree/master/Source/Port) folder that contains two sub-folders: *[Platform-API](https://github.com/ARMmbed/pal/tree/master/Source/Port/Platform-API)* and *[Reference-Impl](https://github.com/ARMmbed/pal/tree/master/Source/Port/Reference-Impl)*. |
ram54288 | 0:dbad57390bd1 | 5 | |
ram54288 | 0:dbad57390bd1 | 6 | ### Platform-API |
ram54288 | 0:dbad57390bd1 | 7 | |
ram54288 | 0:dbad57390bd1 | 8 | The *[Platform-API](https://github.com/ARMmbed/pal/tree/master/Source/Port/Platform-API)* folder contains the header files declaring the interfaces that MUST be implemented by the platform. The APIs are documented in the header files and the Doxygen documentation with the same content is also available. |
ram54288 | 0:dbad57390bd1 | 9 | The documentation declares the input/output parameters, return values and the eventual special return values. |
ram54288 | 0:dbad57390bd1 | 10 | The header file names are related to the PAL modules they are declaring. For example: |
ram54288 | 0:dbad57390bd1 | 11 | |
ram54288 | 0:dbad57390bd1 | 12 | ``` |
ram54288 | 0:dbad57390bd1 | 13 | pal_plat_rtos.h --> presents the RealTime OS APIs required by the |
ram54288 | 0:dbad57390bd1 | 14 | services and Must be implemented by platform. |
ram54288 | 0:dbad57390bd1 | 15 | ``` |
ram54288 | 0:dbad57390bd1 | 16 | |
ram54288 | 0:dbad57390bd1 | 17 | <span class="notes">The APIs are called directly from the *Service* implementation layer. Therefore, you MUST NOT change them.</span> |
ram54288 | 0:dbad57390bd1 | 18 | |
ram54288 | 0:dbad57390bd1 | 19 | ### Reference-Impl |
ram54288 | 0:dbad57390bd1 | 20 | |
ram54288 | 0:dbad57390bd1 | 21 | The *[Reference-Impl](https://github.com/ARMmbed/pal/tree/master/Source/Port/Reference-Impl)* folder contains the reference platform implementations in their respective folders. |
ram54288 | 0:dbad57390bd1 | 22 | Each OS folder contains a list of folders of the required PAL modules to be implemented by the platform, for example: |
ram54288 | 0:dbad57390bd1 | 23 | |
ram54288 | 0:dbad57390bd1 | 24 | ``` |
ram54288 | 0:dbad57390bd1 | 25 | Networking --> contains networking related files. |
ram54288 | 0:dbad57390bd1 | 26 | ``` |
ram54288 | 0:dbad57390bd1 | 27 | |
ram54288 | 0:dbad57390bd1 | 28 | ### Porting to a new platform |
ram54288 | 0:dbad57390bd1 | 29 | |
ram54288 | 0:dbad57390bd1 | 30 | 1. Add a new platform folder to the *[Reference-Impl](https://github.com/ARMmbed/pal/tree/master/Source/Port/Reference-Impl)* folder. |
ram54288 | 0:dbad57390bd1 | 31 | 2. Add the module folders into the new platform folder. |
ram54288 | 0:dbad57390bd1 | 32 | 3. Read the relevent API/Module documentation. |
ram54288 | 0:dbad57390bd1 | 33 | 4. Start coding. |
ram54288 | 0:dbad57390bd1 | 34 | |
ram54288 | 0:dbad57390bd1 | 35 | #### Essential header files |
ram54288 | 0:dbad57390bd1 | 36 | |
ram54288 | 0:dbad57390bd1 | 37 | Here is a list of tips that can help in porting: |
ram54288 | 0:dbad57390bd1 | 38 | |
ram54288 | 0:dbad57390bd1 | 39 | * Include the **[pal.h](https://github.com/ARMmbed/pal/blob/master/Source/PAL-Impl/Services-API/pal.h)** file; it includes all the required headers from PAL, such as `pal_errors.h` and `pal_macros.h`. |
ram54288 | 0:dbad57390bd1 | 40 | * Read the **[pal_errors.h](https://github.com/ARMmbed/pal/blob/master/Source/PAL-Impl/Services-API/pal_errors.h)** file to find out how to map the platform errors to the PAL errors. |
ram54288 | 0:dbad57390bd1 | 41 | * Read the **[pal_macros.h](https://github.com/ARMmbed/pal/blob/master/Source/PAL-Impl/Services-API/pal_macros.h)** to find helpful PAL macros. |
ram54288 | 0:dbad57390bd1 | 42 | * Include the **pal_(MODULE).h** file to get the relevant data structures. |