1 | .. SPDX-License-Identifier: CC-BY-SA-4.0 |
---|
2 | |
---|
3 | .. Copyright (C) 2019 embedded brains GmbH & Co. KG |
---|
4 | .. Copyright (C) 2019 Sebastian Huber |
---|
5 | |
---|
6 | .. _QuickStartBSPBuild: |
---|
7 | |
---|
8 | Build a Board Support Package (BSP) |
---|
9 | =================================== |
---|
10 | |
---|
11 | You installed the tool suite in your installation prefix, made ready the source |
---|
12 | for two RTEMS source packages and if you are using a Git clone bootstrapped the |
---|
13 | RTEMS sources in the previous sections. We installed the tool suite in |
---|
14 | :file:`$HOME/quick-start/rtems/6` and unpacked the source in |
---|
15 | :file:`$HOME/quick-start/src`. |
---|
16 | |
---|
17 | You are now able to build :ref:`Board Support Packages (BSPs) <BSPs>` for all |
---|
18 | architectures you have an installed RTEMS tool suite. To build applications on |
---|
19 | top of RTEMS, you have to build and install a BSP for your target hardware. To |
---|
20 | select a proper BSP for your target hardware consult the :ref:`BSPs <BSPs>` |
---|
21 | chapter. We select the `erc32` BSP. The ``erc32`` BSP uses approximately 2.3G |
---|
22 | bytes of disk space when the testsuite is built and 44M bytes of space when |
---|
23 | installed. |
---|
24 | |
---|
25 | We will first show how to build the BSP using the RSB and then we will show how |
---|
26 | to build the same BSP `manually <QuickStartBSPBuild_Manual>`_. You only need to |
---|
27 | use one of the listed methods to build the BSP. |
---|
28 | |
---|
29 | In the output in this section the base directory :file:`$HOME/quick-start` was |
---|
30 | replaced by ``$BASE``. |
---|
31 | |
---|
32 | .. _QuickStartBSPBuild_RSB: |
---|
33 | |
---|
34 | RSB BSP Build |
---|
35 | ------------- |
---|
36 | |
---|
37 | The RSB build of RTEMS does not use the RTEMS source we made ready. It uses the |
---|
38 | RSB source you downloaded in a previous section. If you are using a release RSB |
---|
39 | source archive the BSP built is the released kernel image. If you are using a |
---|
40 | Git clone of the RSB the BSP will be version referenced in the RSB clone. |
---|
41 | |
---|
42 | To build the BSP with all the tests run this command: |
---|
43 | |
---|
44 | .. code-block:: none |
---|
45 | |
---|
46 | cd $HOME/quick-start/src/rsb/rtems |
---|
47 | ../source-builder/sb-set-builder --prefix=$HOME/quick-start/rtems/5 \ |
---|
48 | --target=sparc-rtems@rtems-ver-major@ --with-rtems-bsp=sparc/erc32 --with-rtems-tests=yes @rtems-ver-major@/rtems-kernel |
---|
49 | |
---|
50 | This command should output something like: |
---|
51 | |
---|
52 | .. code-block:: none |
---|
53 | |
---|
54 | RTEMS Source Builder - Set Builder, @rtems-ver-majminver@ |
---|
55 | Build Set: @rtems-ver-major@/rtems-kernel |
---|
56 | config: tools/rtems-kernel-@rtems-ver-major@.cfg |
---|
57 | package: sparc-rtems@rtems-ver-major@-kernel-erc32-1 |
---|
58 | building: sparc-rtems@rtems-ver-major@-kernel-erc32-1 |
---|
59 | sizes: sparc-rtems@rtems-ver-major@-kernel-erc32-1: 2.279GB (installed: 44.612MB) |
---|
60 | cleaning: sparc-rtems@rtems-ver-major@-kernel-erc32-1 |
---|
61 | reporting: tools/rtems-kernel-@rtems-ver-major@.cfg -> sparc-rtems@rtems-ver-major@-kernel-erc32-1.txt |
---|
62 | reporting: tools/rtems-kernel-@rtems-ver-major@.cfg -> sparc-rtems@rtems-ver-major@-kernel-erc32-1.xml |
---|
63 | installing: sparc-rtems@rtems-ver-major@-kernel-erc32-1 -> $BASE/ |
---|
64 | cleaning: sparc-rtems@rtems-ver-major@-kernel-erc32-1 |
---|
65 | Build Set: Time 0:03:09.896961 |
---|
66 | |
---|
67 | The RSB BSP build can be customised with following RSB command line options: |
---|
68 | |
---|
69 | ``--with-rtems-tests``: |
---|
70 | Build the test suite. If ``yes`` is provided all tests in the testsuite are |
---|
71 | build. If ``no`` is provided no tests are built and if ``samples`` is |
---|
72 | provided only the sample executables are built, e.g. |
---|
73 | ``--with-rtems-tests=yes``. The test executables are install under the BSP |
---|
74 | in the :file:`tests` directory and you can execute them with the |
---|
75 | :ref:`tester and run command <rtems-tester-command>`. |
---|
76 | |
---|
77 | ``--with-rtems-smp``: |
---|
78 | Build with SMP support. The BSP has to have SMP support or this option will |
---|
79 | fail with an error. |
---|
80 | |
---|
81 | ``--with-rtems-legacy-network``: |
---|
82 | Build the legacy network software. We recommend you use the current network |
---|
83 | support in the RTEMS BSP Library (libbsd) unless you need to maintain a |
---|
84 | legacy product. Do not use the legacy networking software for new |
---|
85 | developments. |
---|
86 | |
---|
87 | ``--with-rtems-bspopts``: |
---|
88 | Build the BSP with BSP specific options. This is an advanced option. Please |
---|
89 | refer to the BSP specific details in the :ref:`Board Support Packages |
---|
90 | (BSPs)` of this manual or the BSP source code in the RTEMS source |
---|
91 | directory. To supply a list of options quote then list with ``"``, e.g. |
---|
92 | ``--with-rtems-bspopts="BSP_POWER_DOWN_AT_FATAL_HALT=1"`` |
---|
93 | |
---|
94 | If you have built a BSP with the RSB, you can move on to |
---|
95 | :ref:`QuickStartBSPTest`. |
---|
96 | |
---|
97 | .. _QuickStartBSPBuild_Manual: |
---|
98 | |
---|
99 | Manual BSP Build |
---|
100 | ---------------- |
---|
101 | |
---|
102 | We manually build the BSP in four steps. The first step is to set your path. |
---|
103 | Prepend the RTEMS tool suite binary directory to your ``$PATH`` throughout the |
---|
104 | remaining steps. Run the command: |
---|
105 | |
---|
106 | .. code-block:: none |
---|
107 | |
---|
108 | export PATH=$HOME/quick-start/rtems/@rtems-ver-major@/bin:"$PATH" |
---|
109 | |
---|
110 | Check your installed tools can be found by running: |
---|
111 | |
---|
112 | .. code-block:: none |
---|
113 | |
---|
114 | command -v sparc-rtems@rtems-ver-major@-gcc && echo "found" || echo "not found" |
---|
115 | |
---|
116 | The output should be: |
---|
117 | |
---|
118 | .. code-block:: none |
---|
119 | |
---|
120 | found |
---|
121 | |
---|
122 | If ``not found`` is printed the tools are not correctly installed or the path |
---|
123 | has not been correctly set. Check the contents of the path |
---|
124 | :file:`$HOME/quick-start/rtems/@rtems-ver-major@/bin` manually and if |
---|
125 | :file:`sparc-rtems@rtems-ver-major@-gcc` is present the path is wrong. If the |
---|
126 | file cannot be found return to :ref:`QuickStartTools` and install the tools |
---|
127 | again. |
---|
128 | |
---|
129 | The second step is to configure the BSP. There are various BSP build |
---|
130 | configuration options available. Some options are BSP-specific. Each section |
---|
131 | in the INI-style configuration file ``config.ini`` instructs the build system to |
---|
132 | build a particular BSP variant (`sparc/erc32` in our case). We enable the build |
---|
133 | of the tests with the ``BUILD_TESTS = True`` option and use default values for |
---|
134 | everything else. For detailed information about the BSP build system, see |
---|
135 | :ref:`BSPBuildSystem`. |
---|
136 | |
---|
137 | .. code-block:: none |
---|
138 | |
---|
139 | cd $HOME/quick-start/src/rtems |
---|
140 | echo "[sparc/erc32]" > config.ini |
---|
141 | echo "BUILD_TESTS = True" >> config.ini |
---|
142 | ./waf configure --prefix=$HOME/quick-start/rtems/@rtems-ver-major@ |
---|
143 | |
---|
144 | The first invocation of ``./waf`` needs a bit of time (e.g. 10 seconds) since an |
---|
145 | internal cache file is populated. This command should output something like |
---|
146 | this. In this output the base directory :file:`$HOME/quick-start` was replaced |
---|
147 | by ``$BASE``. |
---|
148 | |
---|
149 | .. code-block:: none |
---|
150 | |
---|
151 | Setting top to : $BASE/quick-start/src/rtems |
---|
152 | Setting out to : $BASE/quick-start/src/rtems/build |
---|
153 | Configure board support package (BSP) : sparc/erc32 |
---|
154 | Checking for program 'sparc-rtems@rtems-ver-major@-gcc' : $BASE/quick-start/rtems/@rtems-ver-major@/bin/sparc-rtems@rtems-ver-major@-gcc |
---|
155 | Checking for program 'sparc-rtems@rtems-ver-major@-g++' : $BASE/quick-start/rtems/@rtems-ver-major@/bin/sparc-rtems@rtems-ver-major@-g++ |
---|
156 | Checking for program 'sparc-rtems@rtems-ver-major@-ar' : $BASE/quick-start/rtems/@rtems-ver-major@/bin/sparc-rtems@rtems-ver-major@-ar |
---|
157 | Checking for program 'sparc-rtems@rtems-ver-major@-ld' : $BASE/quick-start/rtems/@rtems-ver-major@/bin/sparc-rtems@rtems-ver-major@-ld |
---|
158 | Checking for program 'ar' : $BASE/quick-start/rtems/@rtems-ver-major@/bin/sparc-rtems@rtems-ver-major@-ar |
---|
159 | Checking for program 'g++, c++' : $BASE/quick-start/rtems/@rtems-ver-major@/bin/sparc-rtems@rtems-ver-major@-g++ |
---|
160 | Checking for program 'ar' : $BASE/quick-start/rtems/@rtems-ver-major@/bin/sparc-rtems@rtems-ver-major@-ar |
---|
161 | Checking for program 'gas, gcc' : $BASE/quick-start/rtems/@rtems-ver-major@/bin/sparc-rtems@rtems-ver-major@-gcc |
---|
162 | Checking for program 'ar' : $BASE/quick-start/rtems/@rtems-ver-major@/bin/sparc-rtems@rtems-ver-major@-ar |
---|
163 | Checking for program 'gcc, cc' : $BASE/quick-start/rtems/@rtems-ver-major@/bin/sparc-rtems@rtems-ver-major@-gcc |
---|
164 | Checking for program 'ar' : $BASE/quick-start/rtems/@rtems-ver-major@/bin/sparc-rtems@rtems-ver-major@-ar |
---|
165 | Checking for asm flags '-MMD' : yes |
---|
166 | Checking for c flags '-MMD' : yes |
---|
167 | Checking for cxx flags '-MMD' : yes |
---|
168 | Checking for program 'rtems-bin2c' : $BASE/quick-start/rtems/@rtems-ver-major@/bin/rtems-bin2c |
---|
169 | Checking for program 'gzip' : /usr/bin/gzip |
---|
170 | Checking for program 'rtems-ld' : $BASE/quick-start/rtems/@rtems-ver-major@/bin/rtems-ld |
---|
171 | Checking for program 'rtems-syms' : $BASE/quick-start/rtems/@rtems-ver-major@/bin/rtems-syms |
---|
172 | Checking for program 'xz' : $BASE/anaconda3/bin/xz |
---|
173 | 'configure' finished successfully (0.414s) |
---|
174 | |
---|
175 | Building the BSP is the third step. |
---|
176 | |
---|
177 | .. code-block:: none |
---|
178 | |
---|
179 | cd $HOME/quick-start/src/rtems |
---|
180 | ./waf |
---|
181 | |
---|
182 | This command should output something like this (omitted lines are denoted by |
---|
183 | ...). |
---|
184 | |
---|
185 | .. code-block:: none |
---|
186 | |
---|
187 | Waf: Entering directory `$BASE/quick-start/src/rtems/build' |
---|
188 | Waf: Leaving directory `$BASE/quick-start/src/rtems/build' |
---|
189 | 'build' finished successfully (0.085s) |
---|
190 | Waf: Entering directory `$BASE/quick-start/src/rtems/build/sparc/erc32' |
---|
191 | [ 1/4093] Compiling bsps/shared/dev/serial/mc68681_reg2.c |
---|
192 | [ 2/4093] Compiling bsps/shared/dev/rtc/mc146818a_ioreg.c |
---|
193 | [ 3/4093] Compiling bsps/shared/dev/flash/am29lv160.c |
---|
194 | ... |
---|
195 | [4093/4093] Processing link: build/sparc/erc32/testsuites/libtests/dl01/dl01-tar.o build/sparc/erc32/testsuites/libtests/dl01/init.o build/sparc/erc32/testsuites/libtests/dl01/dl-load.o build/sparc/erc32/testsuites/libtests/dl01/dl01-sym.o -> build/sparc/erc32/testsuites/libtests/dl01.exe |
---|
196 | Waf: Leaving directory `$BASE/quick-start/src/rtems/build/sparc/erc32' |
---|
197 | 'build_sparc/erc32' finished successfully (2m14.111s) |
---|
198 | |
---|
199 | The last step is to install the BSP. |
---|
200 | |
---|
201 | .. code-block:: none |
---|
202 | |
---|
203 | cd $HOME/quick-start/src/rtems |
---|
204 | ./waf install |
---|
205 | |
---|
206 | This command should output something like this (omitted lines are denoted by |
---|
207 | ...). In this output the base directory :file:`$HOME/quick-start` was replaced |
---|
208 | by ``$BASE``. |
---|
209 | |
---|
210 | .. code-block:: none |
---|
211 | |
---|
212 | Waf: Entering directory `$BASE/quick-start/src/rtems/build' |
---|
213 | Waf: Leaving directory `$BASE/quick-start/src/rtems/build' |
---|
214 | 'install' finished successfully (0.081s) |
---|
215 | Waf: Entering directory `$BASE/quick-start/src/rtems/build/sparc/erc32' |
---|
216 | + install $BASE/quick-start/rtems/@rtems-ver-major@/sparc-rtems@rtems-ver-major@/erc32/lib/include/libchip/am29lv16.h (from bsps/include/libchip/am29lv1.h) |
---|
217 | + install $BASE/quick-start/rtems/@rtems-ver-major@/sparc-rtems@rtems-ver-major@/erc32/lib/include/libchip/mc146818a.h (from bsps/include/libchip/mc146818a.h) |
---|
218 | + install $BASE/quick-start/rtems/@rtems-ver-major@/sparc-rtems@rtems-ver-major@/erc32/lib/include/libchip/mc68681.h (from bsps/include/libchip/mc68681.h)) |
---|
219 | ... |
---|
220 | + install $BASE/quick-start/rtems/@rtems-ver-major@/sparc-rtems@rtems-ver-major@/erc32/lib/include/rtems/score/watchdogticks.h (from cpukit/include/rtems/score/watchdogticks.h) |
---|
221 | + install $BASE/quick-start/rtems/@rtems-ver-major@/sparc-rtems@rtems-ver-major@/erc32/lib/include/rtems/score/wkspace.h (from cpukit/include/rtems/score/wkspace.h) |
---|
222 | + install $BASE/quick-start/rtems/@rtems-ver-major@/sparc-rtems@rtems-ver-major@/erc32/lib/include/rtems/score/wkspacedata.h (from cpukit/include/rtems/score/wkspacedata.h) |
---|
223 | Waf: Leaving directory `$BASE/quick-start/src/rtems/build/sparc/erc32' |
---|
224 | 'install_sparc/erc32' finished successfully (1.834s)) |
---|