1 | .. SPDX-License-Identifier: CC-BY-SA-4.0 |
---|
2 | |
---|
3 | .. Copyright (C) 2019 embedded brains GmbH |
---|
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/5` 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-rtems5 --with-rtems-bsp=erc32 --with-rtems-tests=yes 5/rtems-kernel |
---|
49 | |
---|
50 | This command should output something like this: |
---|
51 | |
---|
52 | .. code-block:: none |
---|
53 | |
---|
54 | RTEMS Source Builder - Set Builder, 5.1.0 |
---|
55 | Build Set: 5/rtems-kernel |
---|
56 | config: tools/rtems-kernel-5.cfg |
---|
57 | package: sparc-rtems5-kernel-erc32-1 |
---|
58 | building: sparc-rtems5-kernel-erc32-1 |
---|
59 | sizes: sparc-rtems5-kernel-erc32-1: 2.279GB (installed: 44.612MB) |
---|
60 | cleaning: sparc-rtems5-kernel-erc32-1 |
---|
61 | reporting: tools/rtems-kernel-5.cfg -> sparc-rtems5-kernel-erc32-1.txt |
---|
62 | reporting: tools/rtems-kernel-5.cfg -> sparc-rtems5-kernel-erc32-1.xml |
---|
63 | installing: sparc-rtems5-kernel-erc32-1 -> $BASE/ |
---|
64 | cleaning: sparc-rtems5-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 create a build |
---|
103 | directory. It must be separate from the RTEMS source directory. We use |
---|
104 | :file:`$HOME/quick-start/build/b-erc32`. |
---|
105 | |
---|
106 | .. code-block:: none |
---|
107 | |
---|
108 | mkdir -p $HOME/quick-start/build/b-erc32 |
---|
109 | |
---|
110 | The second step is to set your path. Prepend the RTEMS tool suite binary |
---|
111 | directory to your ``$PATH`` throughout the remaining steps. Run the command: |
---|
112 | |
---|
113 | .. code-block:: none |
---|
114 | |
---|
115 | export PATH=$HOME/quick-start/rtems/5/bin:"$PATH" |
---|
116 | |
---|
117 | Check your installed tools can be found by running: |
---|
118 | |
---|
119 | .. code-block:: none |
---|
120 | |
---|
121 | command -v sparc-rtems5-gcc && echo "found" || echo "not found" |
---|
122 | |
---|
123 | The output should be: |
---|
124 | |
---|
125 | .. code-block:: none |
---|
126 | |
---|
127 | found |
---|
128 | |
---|
129 | If ``not found`` is printed the tools are not correctly installed or the path |
---|
130 | has not been correctly set. Check the contents of the path |
---|
131 | :file:`$HOME/quick-start/rtems/5/bin` manually and if :file:`sparc-rtems5-gcc` |
---|
132 | is present the path is wrong. If the file cannot be found return to |
---|
133 | :ref:`QuickStartTools` and install the tools again. |
---|
134 | |
---|
135 | The third step is to configure the BSP. There are various configuration |
---|
136 | options available. Some configuration options are BSP-specific. |
---|
137 | |
---|
138 | .. code-block:: none |
---|
139 | |
---|
140 | cd $HOME/quick-start/build/b-erc32 |
---|
141 | $HOME/quick-start/src/rtems/configure \ |
---|
142 | --prefix=$HOME/quick-start/rtems/5 \ |
---|
143 | --enable-maintainer-mode \ |
---|
144 | --target=sparc-rtems5 \ |
---|
145 | --enable-rtemsbsp=erc32 \ |
---|
146 | --enable-tests |
---|
147 | |
---|
148 | This command should output something like this (omitted lines are denoted by |
---|
149 | ``...``): |
---|
150 | |
---|
151 | .. code-block:: none |
---|
152 | |
---|
153 | checking for gmake... gmake |
---|
154 | checking for RTEMS Version... 5.0.0 |
---|
155 | checking build system type... x86_64-unknown-freebsd12.0 |
---|
156 | checking host system type... x86_64-unknown-freebsd12.0 |
---|
157 | checking target system type... sparc-unknown-rtems5 |
---|
158 | ... |
---|
159 | config.status: creating Makefile |
---|
160 | |
---|
161 | target architecture: sparc. |
---|
162 | available BSPs: erc32. |
---|
163 | 'gmake all' will build the following BSPs: erc32. |
---|
164 | other BSPs can be built with 'gmake RTEMS_BSP="bsp1 bsp2 ..."' |
---|
165 | |
---|
166 | config.status: creating Makefile |
---|
167 | |
---|
168 | Building the BSP is the forth step. |
---|
169 | |
---|
170 | .. code-block:: none |
---|
171 | |
---|
172 | cd $HOME/quick-start/build/b-erc32 |
---|
173 | make |
---|
174 | |
---|
175 | This command should output something like this (omitted lines are denoted by |
---|
176 | ...). |
---|
177 | |
---|
178 | .. code-block:: none |
---|
179 | |
---|
180 | Configuring RTEMS_BSP=erc32 |
---|
181 | checking for gmake... gmake |
---|
182 | checking build system type... x86_64-unknown-freebsd12.0 |
---|
183 | checking host system type... sparc-unknown-rtems5 |
---|
184 | checking rtems target cpu... sparc |
---|
185 | checking for a BSD-compatible install... /usr/bin/install -c |
---|
186 | checking whether build environment is sane... yes |
---|
187 | checking for sparc-rtems5-strip... sparc-rtems5-strip |
---|
188 | checking for a thread-safe mkdir -p... $BASE/src/rtems/c/src/../../install-sh -c -d |
---|
189 | checking for gawk... no |
---|
190 | checking for mawk... no |
---|
191 | checking for nawk... nawk |
---|
192 | checking whether gmake sets $(MAKE)... yes |
---|
193 | checking whether to enable maintainer-specific portions of Makefiles... yes |
---|
194 | checking for RTEMS_BSP... erc32 |
---|
195 | checking whether CPU supports libposix... yes |
---|
196 | configure: setting up make/custom |
---|
197 | configure: creating make/erc32.cache |
---|
198 | gmake[3]: Entering directory '$BASE/build/b-erc32/sparc-rtems5/c/erc32' |
---|
199 | ... |
---|
200 | sparc-rtems5-gcc -mcpu=cypress -O2 -g -ffunction-sections -fdata-sections -Wall -Wmissing-prototypes -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs -B./../../lib/libbsp/sparc/erc32 -B$BASE/src/rtems/bsps/sparc/erc32/start -specs bsp_specs -qrtems -L./../../cpukit -L$BASE/src/rtems/bsps/sparc/shared/start -Wl,--wrap=printf -Wl,--wrap=puts -Wl,--wrap=putchar -Wl,--gc-sections -o spwkspace.exe spwkspace/spwkspace-init.o ./../../lib/libbsp/sparc/erc32/librtemsbsp.a ./../../cpukit/librtemscpu.a |
---|
201 | gmake[5]: Leaving directory '$BASE/build/b-erc32/sparc-rtems5/c/erc32/testsuites/sptests' |
---|
202 | gmake[4]: Leaving directory '$BASE/build/b-erc32/sparc-rtems5/c/erc32/testsuites' |
---|
203 | gmake[3]: Leaving directory '$BASE/build/b-erc32/sparc-rtems5/c/erc32' |
---|
204 | gmake[2]: Leaving directory '$BASE/build/b-erc32/sparc-rtems5/c/erc32' |
---|
205 | gmake[1]: Leaving directory '$BASE/build/b-erc32/sparc-rtems5/c' |
---|
206 | gmake[1]: Entering directory '$BASE/build/b-erc32' |
---|
207 | gmake[1]: Nothing to be done for 'all-am'. |
---|
208 | gmake[1]: Leaving directory '$BASE/build/b-erc32' |
---|
209 | |
---|
210 | The last step is to install the BSP. |
---|
211 | |
---|
212 | .. code-block:: none |
---|
213 | |
---|
214 | cd $HOME/quick-start/build/b-erc32 |
---|
215 | make install |
---|
216 | |
---|
217 | This command should output something like this (omitted lines are denoted by |
---|
218 | ...). In this output the base directory :file:`$HOME/quick-start` was replaced |
---|
219 | by ``$BASE``. |
---|
220 | |
---|
221 | .. code-block:: none |
---|
222 | |
---|
223 | Making install in sparc-rtems5/c |
---|
224 | gmake[1]: Entering directory '$BASE/build/b-erc32/sparc-rtems5/c' |
---|
225 | Making install in . |
---|
226 | gmake[2]: Entering directory '$BASE/build/b-erc32/sparc-rtems5/c' |
---|
227 | gmake[3]: Entering directory '$BASE/build/b-erc32/sparc-rtems5/c' |
---|
228 | gmake[3]: Nothing to be done for 'install-exec-am'. |
---|
229 | gmake[3]: Nothing to be done for 'install-data-am'. |
---|
230 | gmake[3]: Leaving directory '$BASE/build/b-erc32/sparc-rtems5/c' |
---|
231 | gmake[2]: Leaving directory '$BASE/build/b-erc32/sparc-rtems5/c' |
---|
232 | Making install in erc32 |
---|
233 | gmake[2]: Entering directory '$BASE/build/b-erc32/sparc-rtems5/c/erc32' |
---|
234 | gmake[3]: Entering directory '$BASE/build/b-erc32/sparc-rtems5/c/erc32' |
---|
235 | Making install-am in . |
---|
236 | Making install-am in cpukit |
---|
237 | gmake[4]: Entering directory '$BASE/build/b-erc32/sparc-rtems5/c/erc32/cpukit' |
---|
238 | gmake[5]: Entering directory '$BASE/build/b-erc32/sparc-rtems5/c/erc32/cpukit' |
---|
239 | gmake[5]: Nothing to be done for 'install-exec-am'. |
---|
240 | $BASE/src/rtems/c/src/../../cpukit/../install-sh -c -d '$BASE/rtems/5/sparc-rtems5/erc32/lib/include' |
---|
241 | ... |
---|
242 | $BASE/src/rtems/make/Templates/Makefile.lib '$BASE/rtems/5/share/rtems5/make/Templates' |
---|
243 | $BASE/src/rtems/./install-sh -c -d '$BASE/rtems/5/make/custom' |
---|
244 | /usr/bin/install -c -m 644 $BASE/src/rtems/make/custom/default.cfg '$BASE/rtems/5/make/custom' |
---|
245 | gmake[2]: Leaving directory '$BASE/build/b-erc32' |
---|
246 | gmake[1]: Leaving directory '$BASE/build/b-erc32' |
---|