# embedded C newbie - Start n Try it
We used arm-linux-gnueabi-gcc to compile C, it will output the binary code that you can run at any ARM platform.
If you used gcc on the linux to compile the same C file, that you can get executable on x86.
Different of GCC and ARM-GCC

為了後續說明,先給出一個實際案例,
實際案例如下:
#### *main.c*

#### *sub.h*

#### *sub.c*

#### *編譯結果*

## Pre Treatment
為了追求方便,編譯器提供預處理命令供開發者使用,例如:
* Header 文件包含:#include
* 定義 Macro : #define
* 條件編譯:#if #else #endif
* 編譯控制:#pragma
例如上面的範例:
>
>利用預處理命令,在編譯過程中顯示訊息。
>
利用下面指令,讓main.c預處理成main.i
```
arm-linux-gnueabi-gcc -E main.c > main.i
```
簡而言之,為了方便開發,所以使用預處理命令來提升代碼可讀性,但在編譯時需要進行預處理,將含帶預處理命令的代碼還原成原汁原味的C語言。
------------------------------
## Link
### Symbol Resolution

## make the install package on linux
If we have a executable file, and we want to make it to be a installation package, run it use SHELL in any directory, we can:
*the target executable file ==helloworld==*

and build the diractory of the package
```mermaid
graph TB
A((helloworld))
B((DEBIAN))
C((control))
D((usr))
E((local))
F((bin))
G((helloworld))
A-->B;
B-->C;
A-->D;
D-->E;
E-->F;
F-->G;
```
the location of exectable file "helloworld" is helloworld/usr/local/bin/;and the detail of "control" file is:
```
package:helloworld
version:1.0
architecture:i386
maintainer:wit
description: deb package demo
```
and use dpkg command to package the file:
```
#dpkg -b helloworld/ <output_installation_file_name>
```
if all of step are correct, it will spwan the installation package(output_installation_file_name.deb) at the same diractory, try to use the installation package install the program:
```
#dpkg -i output_installation_file_name.deb
選取了原先未選的套件 helloworld:i386。
(讀取資料庫 ... 目前共安裝了 184942 個檔案和目錄。)
正在準備解包 helloworld_1.0_i386.deb……
解開 helloworld:i386 (1.0) 中...
設定 helloworld:i386 (1.0) ...
```
Now you can run "helloworld" at any diractory use #helloworld command:
```
~#helloworld
Hello,World!!!
```
```