70 lines
2.7 KiB
Plaintext
70 lines
2.7 KiB
Plaintext
---------------------
|
|
- build quick guide
|
|
The build process is using a scalable Makefile system, the current build steps is:
|
|
1. Cd the Mainline folder that you checked out from svn server, this is called the TOPDIR;
|
|
2. Cd build
|
|
3. ./build_fw.sh
|
|
Then the FW would be compiled and the output elf file would be under TOPDIR/.output/lib, the filename is ht.out, the map file is ht.map
|
|
|
|
---------------------
|
|
- the makefile system
|
|
|
|
The structure is very simple, there's 3 kind of Makefiles in the build system.
|
|
1. Makefile.cfg under TOPDIR/build folder, this is the main dependence and build logic function defined, at most of the time we only need to modify the build function there;
|
|
2. Makefile in the TOPDIR, it's the entry of the make process, and it then follow the sub folders and build, and finally got the object files, and link them into an elf output, which would be transformed to be an axf image file to flash into the board;
|
|
3. Makefile in the sub folders, the build process is using a recursion method. It would build the deepest tree node first, and generate the .a - archieve file and back to the makefile of upper node. In this way, until the root node - that in the TOPDIR, and generate the finally output.
|
|
|
|
Makefile samples, at most of the time, :
|
|
In the TOPDIR:
|
|
1
|
|
2 # OUTPUT type
|
|
3 # 1 - .out
|
|
4 # 2 - .a
|
|
5 # 3 - .so
|
|
6 OUTPUT_TYPE = 1 // for the TOPTDIR, should = 1 to output the final image
|
|
7 OUTPUT_NAME = ht // the image name
|
|
8
|
|
9 SUB_DIRS = os // the sub module to build, currently only os module
|
|
10
|
|
11 # .h files dir
|
|
12 ADD_INCLUDE = ./inc // the include folder
|
|
13
|
|
14 # predefined macro
|
|
15 PRE_MARCO = // the predefined macro which would be used as -Dxxx when compiling
|
|
16
|
|
17 # lib dir
|
|
18 ADD_LIBDIR = os // the sub module need to be built into the .out file, the makefile would find the .a file automatically under the sub module's folder
|
|
19
|
|
20 # lib need to ld together
|
|
21 ADD_LIB =
|
|
...
|
|
|
|
In the sub folders:
|
|
1 # OUTPUT type
|
|
2 # 1 - .out
|
|
3 # 2 - .a
|
|
4 # 3 - .so
|
|
5 OUTPUT_TYPE = 2 // build as a archive
|
|
6 OUTPUT_NAME = ARMCM4 // module name
|
|
7
|
|
8 SUB_DIRS = src src/GCC // how to build this module, if there's Makefile placed under the sub dirs, it would make recursive, if not, the make would try to build all the .c .cpp or .S files under the sub folders and into an archive
|
|
9
|
|
10 # .h files dir
|
|
11 ADD_INCLUDE = ./inc ./inc/cmsis
|
|
12
|
|
13 # predefined macro
|
|
14 PRE_MARCO = ARMCM4_FP
|
|
15
|
|
16 # lib dir
|
|
17 ADD_LIBDIR =
|
|
18
|
|
19 # lib need to ld together
|
|
20 ADD_LIB =
|
|
...
|
|
|
|
----------------------
|
|
- The env.sh config
|
|
|
|
the config of the build, the pre defined macro would be added to the makefile system directly
|
|
|