1*4882a593Smuzhiyun.. SPDX-License-Identifier: CC-BY-SA-2.0-UK 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun******************************** 4*4882a593SmuzhiyunUsing the SDK Toolchain Directly 5*4882a593Smuzhiyun******************************** 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunYou can use the SDK toolchain directly with Makefile and Autotools-based 8*4882a593Smuzhiyunprojects. 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunAutotools-Based Projects 11*4882a593Smuzhiyun======================== 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunOnce you have a suitable :ref:`sdk-manual/intro:the cross-development toolchain` 14*4882a593Smuzhiyuninstalled, it is very easy to develop a project using the `GNU 15*4882a593SmuzhiyunAutotools-based <https://en.wikipedia.org/wiki/GNU_Build_System>`__ 16*4882a593Smuzhiyunworkflow, which is outside of the :term:`OpenEmbedded Build System`. 17*4882a593Smuzhiyun 18*4882a593SmuzhiyunThe following figure presents a simple Autotools workflow. 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun.. image:: figures/sdk-autotools-flow.png 21*4882a593Smuzhiyun :align: center 22*4882a593Smuzhiyun 23*4882a593SmuzhiyunFollow these steps to create a simple Autotools-based "Hello World" 24*4882a593Smuzhiyunproject: 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun.. note:: 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun For more information on the GNU Autotools workflow, see the same 29*4882a593Smuzhiyun example on the 30*4882a593Smuzhiyun GNOME Developer 31*4882a593Smuzhiyun site. 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun1. *Create a Working Directory and Populate It:* Create a clean 34*4882a593Smuzhiyun directory for your project and then make that directory your working 35*4882a593Smuzhiyun location. 36*4882a593Smuzhiyun :: 37*4882a593Smuzhiyun 38*4882a593Smuzhiyun $ mkdir $HOME/helloworld 39*4882a593Smuzhiyun $ cd $HOME/helloworld 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun After setting up the directory, populate it with files needed for the flow. 42*4882a593Smuzhiyun You need a project source file, a file to help with configuration, 43*4882a593Smuzhiyun and a file to help create the Makefile, and a README file: 44*4882a593Smuzhiyun ``hello.c``, ``configure.ac``, ``Makefile.am``, and ``README``, 45*4882a593Smuzhiyun respectively. 46*4882a593Smuzhiyun 47*4882a593Smuzhiyun Use the following command to create an empty README file, which is 48*4882a593Smuzhiyun required by GNU Coding Standards:: 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun $ touch README 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun Create the remaining 53*4882a593Smuzhiyun three files as follows: 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun - ``hello.c``:: 56*4882a593Smuzhiyun 57*4882a593Smuzhiyun #include <stdio.h> 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun main() 60*4882a593Smuzhiyun { 61*4882a593Smuzhiyun printf("Hello World!\n"); 62*4882a593Smuzhiyun } 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun - ``configure.ac``:: 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun AC_INIT(hello,0.1) 67*4882a593Smuzhiyun AM_INIT_AUTOMAKE([foreign]) 68*4882a593Smuzhiyun AC_PROG_CC 69*4882a593Smuzhiyun AC_CONFIG_FILES(Makefile) 70*4882a593Smuzhiyun AC_OUTPUT 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun - ``Makefile.am``:: 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun bin_PROGRAMS = hello 75*4882a593Smuzhiyun hello_SOURCES = hello.c 76*4882a593Smuzhiyun 77*4882a593Smuzhiyun2. *Source the Cross-Toolchain Environment Setup File:* As described 78*4882a593Smuzhiyun earlier in the manual, installing the cross-toolchain creates a 79*4882a593Smuzhiyun cross-toolchain environment setup script in the directory that the 80*4882a593Smuzhiyun SDK was installed. Before you can use the tools to develop your 81*4882a593Smuzhiyun project, you must source this setup script. The script begins with 82*4882a593Smuzhiyun the string "environment-setup" and contains the machine architecture, 83*4882a593Smuzhiyun which is followed by the string "poky-linux". For this example, the 84*4882a593Smuzhiyun command sources a script from the default SDK installation directory 85*4882a593Smuzhiyun that uses the 32-bit Intel x86 Architecture and the &DISTRO; Yocto 86*4882a593Smuzhiyun Project release:: 87*4882a593Smuzhiyun 88*4882a593Smuzhiyun $ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux 89*4882a593Smuzhiyun 90*4882a593Smuzhiyun3. *Create the configure Script:* Use the ``autoreconf`` command to 91*4882a593Smuzhiyun generate the ``configure`` script. 92*4882a593Smuzhiyun :: 93*4882a593Smuzhiyun 94*4882a593Smuzhiyun $ autoreconf 95*4882a593Smuzhiyun 96*4882a593Smuzhiyun The ``autoreconf`` 97*4882a593Smuzhiyun tool takes care of running the other Autotools such as ``aclocal``, 98*4882a593Smuzhiyun ``autoconf``, and ``automake``. 99*4882a593Smuzhiyun 100*4882a593Smuzhiyun .. note:: 101*4882a593Smuzhiyun 102*4882a593Smuzhiyun If you get errors from ``configure.ac``, which ``autoreconf`` 103*4882a593Smuzhiyun runs, that indicate missing files, you can use the "-i" option, 104*4882a593Smuzhiyun which ensures missing auxiliary files are copied to the build 105*4882a593Smuzhiyun host. 106*4882a593Smuzhiyun 107*4882a593Smuzhiyun4. *Cross-Compile the Project:* This command compiles the project using 108*4882a593Smuzhiyun the cross-compiler. The 109*4882a593Smuzhiyun :term:`CONFIGURE_FLAGS` 110*4882a593Smuzhiyun environment variable provides the minimal arguments for GNU 111*4882a593Smuzhiyun configure:: 112*4882a593Smuzhiyun 113*4882a593Smuzhiyun $ ./configure ${CONFIGURE_FLAGS} 114*4882a593Smuzhiyun 115*4882a593Smuzhiyun For an Autotools-based 116*4882a593Smuzhiyun project, you can use the cross-toolchain by just passing the 117*4882a593Smuzhiyun appropriate host option to ``configure.sh``. The host option you use 118*4882a593Smuzhiyun is derived from the name of the environment setup script found in the 119*4882a593Smuzhiyun directory in which you installed the cross-toolchain. For example, 120*4882a593Smuzhiyun the host option for an ARM-based target that uses the GNU EABI is 121*4882a593Smuzhiyun ``armv5te-poky-linux-gnueabi``. You will notice that the name of the 122*4882a593Smuzhiyun script is ``environment-setup-armv5te-poky-linux-gnueabi``. Thus, the 123*4882a593Smuzhiyun following command works to update your project and rebuild it using 124*4882a593Smuzhiyun the appropriate cross-toolchain tools:: 125*4882a593Smuzhiyun 126*4882a593Smuzhiyun $ ./configure --host=armv5te-poky-linux-gnueabi --with-libtool-sysroot=sysroot_dir 127*4882a593Smuzhiyun 128*4882a593Smuzhiyun5. *Make and Install the Project:* These two commands generate and 129*4882a593Smuzhiyun install the project into the destination directory:: 130*4882a593Smuzhiyun 131*4882a593Smuzhiyun $ make 132*4882a593Smuzhiyun $ make install DESTDIR=./tmp 133*4882a593Smuzhiyun 134*4882a593Smuzhiyun .. note:: 135*4882a593Smuzhiyun 136*4882a593Smuzhiyun To learn about environment variables established when you run the 137*4882a593Smuzhiyun cross-toolchain environment setup script and how they are used or 138*4882a593Smuzhiyun overridden by the Makefile, see the 139*4882a593Smuzhiyun :ref:`sdk-manual/working-projects:makefile-based projects` section. 140*4882a593Smuzhiyun 141*4882a593Smuzhiyun This next command is a simple way to verify the installation of your 142*4882a593Smuzhiyun project. Running the command prints the architecture on which the 143*4882a593Smuzhiyun binary file can run. This architecture should be the same 144*4882a593Smuzhiyun architecture that the installed cross-toolchain supports. 145*4882a593Smuzhiyun :: 146*4882a593Smuzhiyun 147*4882a593Smuzhiyun $ file ./tmp/usr/local/bin/hello 148*4882a593Smuzhiyun 149*4882a593Smuzhiyun6. *Execute Your Project:* To execute the project, you would need to run 150*4882a593Smuzhiyun it on your target hardware. If your target hardware happens to be 151*4882a593Smuzhiyun your build host, you could run the project as follows:: 152*4882a593Smuzhiyun 153*4882a593Smuzhiyun $ ./tmp/usr/local/bin/hello 154*4882a593Smuzhiyun 155*4882a593Smuzhiyun As expected, the project displays the "Hello World!" message. 156*4882a593Smuzhiyun 157*4882a593SmuzhiyunMakefile-Based Projects 158*4882a593Smuzhiyun======================= 159*4882a593Smuzhiyun 160*4882a593SmuzhiyunSimple Makefile-based projects use and interact with the cross-toolchain 161*4882a593Smuzhiyunenvironment variables established when you run the cross-toolchain 162*4882a593Smuzhiyunenvironment setup script. The environment variables are subject to 163*4882a593Smuzhiyungeneral ``make`` rules. 164*4882a593Smuzhiyun 165*4882a593SmuzhiyunThis section presents a simple Makefile development flow and provides an 166*4882a593Smuzhiyunexample that lets you see how you can use cross-toolchain environment 167*4882a593Smuzhiyunvariables and Makefile variables during development. 168*4882a593Smuzhiyun 169*4882a593Smuzhiyun.. image:: figures/sdk-makefile-flow.png 170*4882a593Smuzhiyun :align: center 171*4882a593Smuzhiyun 172*4882a593SmuzhiyunThe main point of this section is to explain the following three cases 173*4882a593Smuzhiyunregarding variable behavior: 174*4882a593Smuzhiyun 175*4882a593Smuzhiyun- *Case 1 - No Variables Set in the Makefile Map to Equivalent 176*4882a593Smuzhiyun Environment Variables Set in the SDK Setup Script:* Because matching 177*4882a593Smuzhiyun variables are not specifically set in the ``Makefile``, the variables 178*4882a593Smuzhiyun retain their values based on the environment setup script. 179*4882a593Smuzhiyun 180*4882a593Smuzhiyun- *Case 2 - Variables Are Set in the Makefile that Map to Equivalent 181*4882a593Smuzhiyun Environment Variables from the SDK Setup Script:* Specifically 182*4882a593Smuzhiyun setting matching variables in the ``Makefile`` during the build 183*4882a593Smuzhiyun results in the environment settings of the variables being 184*4882a593Smuzhiyun overwritten. In this case, the variables you set in the ``Makefile`` 185*4882a593Smuzhiyun are used. 186*4882a593Smuzhiyun 187*4882a593Smuzhiyun- *Case 3 - Variables Are Set Using the Command Line that Map to 188*4882a593Smuzhiyun Equivalent Environment Variables from the SDK Setup Script:* 189*4882a593Smuzhiyun Executing the ``Makefile`` from the command line results in the 190*4882a593Smuzhiyun environment variables being overwritten. In this case, the 191*4882a593Smuzhiyun command-line content is used. 192*4882a593Smuzhiyun 193*4882a593Smuzhiyun.. note:: 194*4882a593Smuzhiyun 195*4882a593Smuzhiyun Regardless of how you set your variables, if you use the "-e" option 196*4882a593Smuzhiyun with ``make``, the variables from the SDK setup script take precedence:: 197*4882a593Smuzhiyun 198*4882a593Smuzhiyun $ make -e target 199*4882a593Smuzhiyun 200*4882a593Smuzhiyun 201*4882a593SmuzhiyunThe remainder of this section presents a simple Makefile example that 202*4882a593Smuzhiyundemonstrates these variable behaviors. 203*4882a593Smuzhiyun 204*4882a593SmuzhiyunIn a new shell environment variables are not established for the SDK 205*4882a593Smuzhiyununtil you run the setup script. For example, the following commands show 206*4882a593Smuzhiyuna null value for the compiler variable (i.e. 207*4882a593Smuzhiyun:term:`CC`). 208*4882a593Smuzhiyun:: 209*4882a593Smuzhiyun 210*4882a593Smuzhiyun $ echo ${CC} 211*4882a593Smuzhiyun 212*4882a593Smuzhiyun $ 213*4882a593Smuzhiyun 214*4882a593SmuzhiyunRunning the 215*4882a593SmuzhiyunSDK setup script for a 64-bit build host and an i586-tuned target 216*4882a593Smuzhiyunarchitecture for a ``core-image-sato`` image using the current &DISTRO; 217*4882a593SmuzhiyunYocto Project release and then echoing that variable shows the value 218*4882a593Smuzhiyunestablished through the script:: 219*4882a593Smuzhiyun 220*4882a593Smuzhiyun $ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux 221*4882a593Smuzhiyun $ echo ${CC} 222*4882a593Smuzhiyun i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/&DISTRO;/sysroots/i586-poky-linux 223*4882a593Smuzhiyun 224*4882a593SmuzhiyunTo illustrate variable use, work through this simple "Hello World!" 225*4882a593Smuzhiyunexample: 226*4882a593Smuzhiyun 227*4882a593Smuzhiyun1. *Create a Working Directory and Populate It:* Create a clean 228*4882a593Smuzhiyun directory for your project and then make that directory your working 229*4882a593Smuzhiyun location. 230*4882a593Smuzhiyun :: 231*4882a593Smuzhiyun 232*4882a593Smuzhiyun $ mkdir $HOME/helloworld 233*4882a593Smuzhiyun $ cd $HOME/helloworld 234*4882a593Smuzhiyun 235*4882a593Smuzhiyun After 236*4882a593Smuzhiyun setting up the directory, populate it with files needed for the flow. 237*4882a593Smuzhiyun You need a ``main.c`` file from which you call your function, a 238*4882a593Smuzhiyun ``module.h`` file to contain headers, and a ``module.c`` that defines 239*4882a593Smuzhiyun your function. 240*4882a593Smuzhiyun 241*4882a593Smuzhiyun Create the three files as follows: 242*4882a593Smuzhiyun 243*4882a593Smuzhiyun - ``main.c``:: 244*4882a593Smuzhiyun 245*4882a593Smuzhiyun #include "module.h" 246*4882a593Smuzhiyun void sample_func(); 247*4882a593Smuzhiyun int main() 248*4882a593Smuzhiyun { 249*4882a593Smuzhiyun sample_func(); 250*4882a593Smuzhiyun return 0; 251*4882a593Smuzhiyun } 252*4882a593Smuzhiyun 253*4882a593Smuzhiyun - ``module.h``:: 254*4882a593Smuzhiyun 255*4882a593Smuzhiyun #include <stdio.h> 256*4882a593Smuzhiyun void sample_func(); 257*4882a593Smuzhiyun 258*4882a593Smuzhiyun - ``module.c``:: 259*4882a593Smuzhiyun 260*4882a593Smuzhiyun #include "module.h" 261*4882a593Smuzhiyun void sample_func() 262*4882a593Smuzhiyun { 263*4882a593Smuzhiyun printf("Hello World!"); 264*4882a593Smuzhiyun printf("\n"); 265*4882a593Smuzhiyun } 266*4882a593Smuzhiyun 267*4882a593Smuzhiyun2. *Source the Cross-Toolchain Environment Setup File:* As described 268*4882a593Smuzhiyun earlier in the manual, installing the cross-toolchain creates a 269*4882a593Smuzhiyun cross-toolchain environment setup script in the directory that the 270*4882a593Smuzhiyun SDK was installed. Before you can use the tools to develop your 271*4882a593Smuzhiyun project, you must source this setup script. The script begins with 272*4882a593Smuzhiyun the string "environment-setup" and contains the machine architecture, 273*4882a593Smuzhiyun which is followed by the string "poky-linux". For this example, the 274*4882a593Smuzhiyun command sources a script from the default SDK installation directory 275*4882a593Smuzhiyun that uses the 32-bit Intel x86 Architecture and the &DISTRO_NAME; Yocto 276*4882a593Smuzhiyun Project release:: 277*4882a593Smuzhiyun 278*4882a593Smuzhiyun $ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux 279*4882a593Smuzhiyun 280*4882a593Smuzhiyun3. *Create the Makefile:* For this example, the Makefile contains 281*4882a593Smuzhiyun two lines that can be used to set the :term:`CC` variable. One line is 282*4882a593Smuzhiyun identical to the value that is set when you run the SDK environment 283*4882a593Smuzhiyun setup script, and the other line sets :term:`CC` to "gcc", the default 284*4882a593Smuzhiyun GNU compiler on the build host:: 285*4882a593Smuzhiyun 286*4882a593Smuzhiyun # CC=i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux 287*4882a593Smuzhiyun # CC="gcc" 288*4882a593Smuzhiyun all: main.o module.o 289*4882a593Smuzhiyun ${CC} main.o module.o -o target_bin 290*4882a593Smuzhiyun main.o: main.c module.h 291*4882a593Smuzhiyun ${CC} -I . -c main.c 292*4882a593Smuzhiyun module.o: module.c 293*4882a593Smuzhiyun module.h ${CC} -I . -c module.c 294*4882a593Smuzhiyun clean: 295*4882a593Smuzhiyun rm -rf *.o 296*4882a593Smuzhiyun rm target_bin 297*4882a593Smuzhiyun 298*4882a593Smuzhiyun4. *Make the Project:* Use the ``make`` command to create the binary 299*4882a593Smuzhiyun output file. Because variables are commented out in the Makefile, the 300*4882a593Smuzhiyun value used for :term:`CC` is the value set when the SDK environment setup 301*4882a593Smuzhiyun file was run:: 302*4882a593Smuzhiyun 303*4882a593Smuzhiyun $ make 304*4882a593Smuzhiyun i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux -I . -c main.c 305*4882a593Smuzhiyun i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux -I . -c module.c 306*4882a593Smuzhiyun i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux main.o module.o -o target_bin 307*4882a593Smuzhiyun 308*4882a593Smuzhiyun From the results of the previous command, you can see that 309*4882a593Smuzhiyun the compiler used was the compiler established through the :term:`CC` 310*4882a593Smuzhiyun variable defined in the setup script. 311*4882a593Smuzhiyun 312*4882a593Smuzhiyun You can override the :term:`CC` environment variable with the same 313*4882a593Smuzhiyun variable as set from the Makefile by uncommenting the line in the 314*4882a593Smuzhiyun Makefile and running ``make`` again. 315*4882a593Smuzhiyun :: 316*4882a593Smuzhiyun 317*4882a593Smuzhiyun $ make clean 318*4882a593Smuzhiyun rm -rf *.o 319*4882a593Smuzhiyun rm target_bin 320*4882a593Smuzhiyun # 321*4882a593Smuzhiyun # Edit the Makefile by uncommenting the line that sets CC to "gcc" 322*4882a593Smuzhiyun # 323*4882a593Smuzhiyun $ make 324*4882a593Smuzhiyun gcc -I . -c main.c 325*4882a593Smuzhiyun gcc -I . -c module.c 326*4882a593Smuzhiyun gcc main.o module.o -o target_bin 327*4882a593Smuzhiyun 328*4882a593Smuzhiyun As shown in the previous example, the 329*4882a593Smuzhiyun cross-toolchain compiler is not used. Rather, the default compiler is 330*4882a593Smuzhiyun used. 331*4882a593Smuzhiyun 332*4882a593Smuzhiyun This next case shows how to override a variable by providing the 333*4882a593Smuzhiyun variable as part of the command line. Go into the Makefile and 334*4882a593Smuzhiyun re-insert the comment character so that running ``make`` uses the 335*4882a593Smuzhiyun established SDK compiler. However, when you run ``make``, use a 336*4882a593Smuzhiyun command-line argument to set :term:`CC` to "gcc":: 337*4882a593Smuzhiyun 338*4882a593Smuzhiyun $ make clean 339*4882a593Smuzhiyun rm -rf *.o 340*4882a593Smuzhiyun rm target_bin 341*4882a593Smuzhiyun # 342*4882a593Smuzhiyun # Edit the Makefile to comment out the line setting CC to "gcc" 343*4882a593Smuzhiyun # 344*4882a593Smuzhiyun $ make 345*4882a593Smuzhiyun i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux -I . -c main.c 346*4882a593Smuzhiyun i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux -I . -c module.c 347*4882a593Smuzhiyun i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux main.o module.o -o target_bin 348*4882a593Smuzhiyun $ make clean 349*4882a593Smuzhiyun rm -rf *.o 350*4882a593Smuzhiyun rm target_bin 351*4882a593Smuzhiyun $ make CC="gcc" 352*4882a593Smuzhiyun gcc -I . -c main.c 353*4882a593Smuzhiyun gcc -I . -c module.c 354*4882a593Smuzhiyun gcc main.o module.o -o target_bin 355*4882a593Smuzhiyun 356*4882a593Smuzhiyun In the previous case, the command-line argument overrides the SDK 357*4882a593Smuzhiyun environment variable. 358*4882a593Smuzhiyun 359*4882a593Smuzhiyun In this last case, edit Makefile again to use the "gcc" compiler but 360*4882a593Smuzhiyun then use the "-e" option on the ``make`` command line:: 361*4882a593Smuzhiyun 362*4882a593Smuzhiyun $ make clean 363*4882a593Smuzhiyun rm -rf *.o 364*4882a593Smuzhiyun rm target_bin 365*4882a593Smuzhiyun # 366*4882a593Smuzhiyun # Edit the Makefile to use "gcc" 367*4882a593Smuzhiyun # 368*4882a593Smuzhiyun $ make 369*4882a593Smuzhiyun gcc -I . -c main.c 370*4882a593Smuzhiyun gcc -I . -c module.c 371*4882a593Smuzhiyun gcc main.o module.o -o target_bin 372*4882a593Smuzhiyun $ make clean 373*4882a593Smuzhiyun rm -rf *.o 374*4882a593Smuzhiyun rm target_bin 375*4882a593Smuzhiyun $ make -e 376*4882a593Smuzhiyun i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux -I . -c main.c 377*4882a593Smuzhiyun i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux -I . -c module.c 378*4882a593Smuzhiyun i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux main.o module.o -o target_bin 379*4882a593Smuzhiyun 380*4882a593Smuzhiyun In the previous case, the "-e" option forces ``make`` to 381*4882a593Smuzhiyun use the SDK environment variables regardless of the values in the 382*4882a593Smuzhiyun Makefile. 383*4882a593Smuzhiyun 384*4882a593Smuzhiyun5. *Execute Your Project:* To execute the project (i.e. ``target_bin``), 385*4882a593Smuzhiyun use the following command:: 386*4882a593Smuzhiyun 387*4882a593Smuzhiyun $ ./target_bin 388*4882a593Smuzhiyun Hello World! 389*4882a593Smuzhiyun 390*4882a593Smuzhiyun .. note:: 391*4882a593Smuzhiyun 392*4882a593Smuzhiyun If you used the cross-toolchain compiler to build 393*4882a593Smuzhiyun target_bin 394*4882a593Smuzhiyun and your build host differs in architecture from that of the 395*4882a593Smuzhiyun target machine, you need to run your project on the target device. 396*4882a593Smuzhiyun 397*4882a593Smuzhiyun As expected, the project displays the "Hello World!" message. 398