|
| 1 | +.. _board_porting_guide: |
| 2 | + |
| 3 | +Board Porting Guide |
| 4 | +################### |
| 5 | + |
| 6 | +When building an application you must specify the target hardware and |
| 7 | +the exact board or model. Specifying the board name results in a binary that |
| 8 | +is suited for the target hardware by selecting the right Zephyr features and |
| 9 | +components and setting the right Zephyr configuration for that specific target |
| 10 | +hardware. |
| 11 | + |
| 12 | +A board is defined as a special configuration of an SoC with possible additional |
| 13 | +components. |
| 14 | +For example, a board might have sensors and flash memory implemented as |
| 15 | +additional features on top of what the SoC provides. Such additional hardware is |
| 16 | +configured and referenced in the Zephyr board configuration. |
| 17 | + |
| 18 | +The board implements at least one SoC and thus inherits all of the features |
| 19 | +that are provided by the SoC. When porting a board to Zephyr, you should |
| 20 | +first make sure the SoC is implemented in Zephyr. |
| 21 | + |
| 22 | +Hardware Configuration Hierarchy |
| 23 | +******************************** |
| 24 | + |
| 25 | +Hardware definitions in Zephyr follow a well-defined hierarchy of configurations |
| 26 | +and layers, below are thelayers from top to bottom: |
| 27 | + |
| 28 | +- Board |
| 29 | +- SoC |
| 30 | +- SoC Series |
| 31 | +- SoC Family |
| 32 | +- CPU Core |
| 33 | +- Architecture |
| 34 | + |
| 35 | +This design contributes to code reuse and implementation of device drivers and |
| 36 | +features at the bottom of the hierarchy making a board configuration as simple |
| 37 | +as a selection of features that are implemented by the underlying layers. The |
| 38 | +figures below shows this hierarchy with a few example of boards currently |
| 39 | +available in the source tree: |
| 40 | + |
| 41 | +.. figure:: board/hierarchy.png |
| 42 | + :width: 500px |
| 43 | + :align: center |
| 44 | + :alt: Configuration Hierarchy |
| 45 | + |
| 46 | + Configuration Hierarchy |
| 47 | + |
| 48 | + |
| 49 | +Hierarchy Example |
| 50 | + |
| 51 | ++------------+-----------+--------------+------------+--------------+---------+ |
| 52 | +|Board |FRDM K64F |nRF52 NITROGEN|nRF51XX |Quark SE C1000|Arduino | |
| 53 | +| | | | |Devboard |101 | |
| 54 | ++============+===========+==============+============+==============+=========+ |
| 55 | +|SOC |MK64F12 |nRF52832 |nRF51XX |Quark SE C1000|Curie | |
| 56 | ++------------+-----------+--------------+------------+--------------+---------+ |
| 57 | +|SOC Series |Kinetis K6x|Nordic NRF52 |Nordic NRF51|Quark SE |Quark SE | |
| 58 | +| |Series | | | | | |
| 59 | ++------------+-----------+--------------+------------+--------------+---------+ |
| 60 | +|SOC Family |NXP Kinetis|Nordic NRF5 |Nordic NRF5 |Quark |Quark | |
| 61 | ++------------+-----------+--------------+------------+--------------+---------+ |
| 62 | +|CPU Core |Cortex-M4 |Cortex-M4 |Cortex-M0+ |Lakemount |Lakemount| |
| 63 | ++------------+-----------+--------------+------------+--------------+---------+ |
| 64 | +|Architecture|ARM |ARM |ARM |x86 |x86 | |
| 65 | ++------------+-----------+--------------+------------+--------------+---------+ |
| 66 | + |
| 67 | + |
| 68 | +Architecture |
| 69 | +============ |
| 70 | +If your CPU architecture is already supported by Zephyr, there is no |
| 71 | +architecture work involved in porting to your board. If your CPU architecture |
| 72 | +is not supported by the Zephyr kernel, you can add support by following the |
| 73 | +instructions available at :ref:`architecture_porting_guide`. |
| 74 | + |
| 75 | +CPU Core |
| 76 | +======== |
| 77 | + |
| 78 | +Some OS code depends on the CPU core that your board is using. For |
| 79 | +example, a given CPU core has a specific assembly language instruction set, and |
| 80 | +may require special cross compiler or compiler settings to use the appropriate |
| 81 | +instruction set. |
| 82 | + |
| 83 | +If your CPU architecture is already supported by Zephyr, there is no CPU core |
| 84 | +work involved in porting to your platform or board. You need only to select the |
| 85 | +appropriate CPU in your configuration and the rest will be taken care of by the |
| 86 | +configuration system in Zephyr which will select the features implemented |
| 87 | +by the corresponding CPU. |
| 88 | + |
| 89 | +Platform |
| 90 | +======== |
| 91 | + |
| 92 | +This layer implements most of the features that need porting and is split into |
| 93 | +three layers to allow for code reuse when dealing with implementations with |
| 94 | +slight differences. |
| 95 | + |
| 96 | +SoC Family |
| 97 | +---------- |
| 98 | + |
| 99 | +This layer is a container of all SoCs of the same class that, for example |
| 100 | +implement one single type of CPU core but differ in peripherals and features. |
| 101 | +The base hardware will in most cases be the same across all SoCs and MCUs of |
| 102 | +this family. |
| 103 | + |
| 104 | +SoC Series |
| 105 | +---------- |
| 106 | + |
| 107 | +Moving closer to the SoC, the series is derived from an SoC family. A series is |
| 108 | +defined by a feautre set that serves the purpose of distinguishing different |
| 109 | +SoCs belonging to the same family. |
| 110 | + |
| 111 | +SoC |
| 112 | +--- |
| 113 | + |
| 114 | +Finally, an SoC is actual hardware component that is physically available on a |
| 115 | +board. |
| 116 | + |
| 117 | +Board |
| 118 | +===== |
| 119 | + |
| 120 | +A board implements an SoC with all its features, together with peripherals |
| 121 | +available on the board that differentiates the board with additional interfaces |
| 122 | +and features not available in the SoC. |
| 123 | + |
0 commit comments