Adding chain process to Readme

master^2
parent 77ab0e7c2a
commit c0aae5e382

@ -22,3 +22,93 @@ Now it is possible to execute your new code by using:
```bash
$ ./<output-name>
$ Hello World from BeagleBoard!!
```
## The Chain process
In some cases you will need to get access to the intermediate files that are produced by your code during the compilation process. Thus, following the next steps you can obtain the processed, assambled and output files.
```bash
➜ l4-CAndCpp git:(master) ls -l
total 32
-rw-r--r-- 1 debian debian 231 Apr 24 13:28 Readme.md
-rwxr-xr-x 1 debian debian 8144 Apr 24 13:33 hello-c
-rw-r--r-- 1 debian debian 137 Apr 24 13:33 hello-world.c
-rw-r--r-- 1 debian debian 183 Apr 24 13:49 hello-world.cpp
-rwxr-xr-x 1 debian debian 8944 Apr 24 13:58 hellocpp
➜ l4-CAndCpp git:(master) g++ -E hello-world.cpp > processed.cpp
➜ l4-CAndCpp git:(master) ✗ ls -l
total 688
-rw-r--r-- 1 debian debian 231 Apr 24 13:28 Readme.md
-rwxr-xr-x 1 debian debian 8144 Apr 24 13:33 hello-c
-rw-r--r-- 1 debian debian 137 Apr 24 13:33 hello-world.c
-rw-r--r-- 1 debian debian 183 Apr 24 13:49 hello-world.cpp
-rwxr-xr-x 1 debian debian 8944 Apr 24 13:58 hellocpp
-rw-r--r-- 1 debian debian 668283 Apr 24 15:42 processed.cpp
```
then, by using the `less` command you visualize the file's content
```bash
# 1 "hello-world.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "hello-world.cpp"
# 1 "/usr/include/c++/8/iostream" 1 3
# 36 "/usr/include/c++/8/iostream" 3
```
by pressing the `SPC` key you will continue to the next lines, and by pressing the `q` key you will quit and close the file exploration through `less` command.
The same can be done for the assambled file:
```bash
➜ l4-CAndCpp git:(master) ✗ g++ -S processed.cpp -o helloworld.s
➜ l4-CAndCpp git:(master) ✗ ls -l
total 692
-rw-r--r-- 1 debian debian 231 Apr 24 13:28 Readme.md
-rwxr-xr-x 1 debian debian 8144 Apr 24 13:33 hello-c
-rw-r--r-- 1 debian debian 137 Apr 24 13:33 hello-world.c
-rw-r--r-- 1 debian debian 183 Apr 24 13:49 hello-world.cpp
-rwxr-xr-x 1 debian debian 8944 Apr 24 13:58 hellocpp
-rw-r--r-- 1 debian debian 3191 Apr 24 16:19 helloworld.s
-rw-r--r-- 1 debian debian 668283 Apr 24 15:42 processed.cpp
```
and for the output file:
```bash
➜ l4-CAndCpp git:(master) ✗ g++ -c helloworld.s
➜ l4-CAndCpp git:(master) ✗ ls -l
total 696
-rw-r--r-- 1 debian debian 231 Apr 24 13:28 Readme.md
-rwxr-xr-x 1 debian debian 8144 Apr 24 13:33 hello-c
-rw-r--r-- 1 debian debian 137 Apr 24 13:33 hello-world.c
-rw-r--r-- 1 debian debian 183 Apr 24 13:49 hello-world.cpp
-rwxr-xr-x 1 debian debian 8944 Apr 24 13:58 hellocpp
-rw-r--r-- 1 debian debian 2356 Apr 24 16:20 helloworld.o
-rw-r--r-- 1 debian debian 3191 Apr 24 16:19 helloworld.s
-rw-r--r-- 1 debian debian 668283 Apr 24 15:42 processed.cpp
```
and finally obtain the executable file by:
```bash
➜ l4-CAndCpp git:(master) ✗ g++ helloworld.o -o hello-out
➜ l4-CAndCpp git:(master) ✗ ls -l
total 708
-rw-r--r-- 1 debian debian 231 Apr 24 13:28 Readme.md
-rwxr-xr-x 1 debian debian 8144 Apr 24 13:33 hello-c
-rwxr-xr-x 1 debian debian 8944 Apr 24 16:22 hello-out
-rw-r--r-- 1 debian debian 137 Apr 24 13:33 hello-world.c
-rw-r--r-- 1 debian debian 183 Apr 24 13:49 hello-world.cpp
-rwxr-xr-x 1 debian debian 8944 Apr 24 13:58 hellocpp
-rw-r--r-- 1 debian debian 2356 Apr 24 16:20 helloworld.o
-rw-r--r-- 1 debian debian 3191 Apr 24 16:19 helloworld.s
-rw-r--r-- 1 debian debian 668283 Apr 24 15:42 processed.cpp
```
Now you can execute it:
```bash
➜ l4-CAndCpp git:(master) ✗ ./hello-out
Hello world from beagleboard on c++!!
```

Loading…
Cancel
Save