MTK compilation process

Source: Internet
Author: User

MTK compilation process

Comp. Mak completes module compilation connection and generates Bin

Editor of gsm2.mak to complete clean, remake, new, etc.

Xxx_upls.mak is a private configuration of the customer. Different configuration files are set based on the customer's different requirements.

Option. basic configuration and macro definition file in the Mak Project

Verno_xxx.bld File

Custom. BLD should ensure that the same configuration should be written here in the customer version, and some files in this should not be changed.

 

Step 1:

1. the make. Bat command first calls chgfilemode. bat, modifies the read-only attribute of the files needed during compilation to read/write, and then calls make2.pl.

2. The main task of make2.pl is to match the parameters of gsm2.mak, and then use the command

System ("$ {makecmd}-F $ {makefolder }$ {mymf}-r customer = $ custom project = $ project $ action"); To call gsm2.mak.

The specific resolution is

Make-F make/gsm2.mak-r customer = project name project = GPRS new | update | remake

Step 2: Entire Process

Gsm2.mak

Option. Mak

Xxx_upls.mak

Rel_cr_mmi_upls.mak

User_specific.mak

 

1. The option. Mak file is called at the beginning of the gsm2.mak file.

2. option. make/$ (Strip $ (customer) _ $ (Strip $ (Project )). the Mak file is included. The matching result is: Project name _ GPRS under the make directory. mak, such as k500gsd_upls.mak.

3. in $ (Strip $ (customer) _ $ (Strip $ (Project )). the Mak file calls rel_cr_mmi _ $ (Strip $ (Project )). mak file, which is parsed as the rel_cr_mmi_upls.mak file in the make directory.

The file rel_cr_mmi_upls.mak defines which files need to be added to the compilation directory.

The compilation directory of MMI is defined as mmidir = plutommi.

The resource compilation directory is defined in the variable cus_rel_base_comp:

Cus_rel_base_comp + = $ (Strip $ (mmidir)/MMI $ (Strip $ (mmidir)/mtkapp $ (Strip $ (mmidir)/tool $ (mmidir)/win32fs

Cus_rel_base_comp + = $ (Strip $ (mmidir)/customer/customerinc/

$ (Strip $ (mmidir)/customer/customize/

$ (Strip $ (mmidir)/customer/custresource/$ (Strip $ (mmi_version ))/

$ (Strip $ (mmidir)/customer/debug/

$ (Strip $ (mmidir)/customer/images/gameimages/

$ (Strip $ (mmidir)/customer/images/Decoder/

$ (Strip $ (mmidir)/customer/res_mmi/

$ (Strip $ (mmidir)/customer/resgenerator/

$ (Strip $ (mmidir)/customer/resourcedll/

$ (Strip $ (mmidir)/customer/resources/

$ (Strip $ (mmidir)/customer/Audio

The customer's resources need to compile the following file: cus_rel_src_comp + = mmiresource mtkapp gdi_arm plutommi vendorapp

Image name: cus_rel_base_comp + = $ (Strip $ (mmidir)/customer/images/$ (Strip $ (mmi_proj) $ (Strip $ (main_ LCD _size )), it can be parsed as follows:

Plutommi/customer/images/k500gsd176x220

 

Rel_cr_mmi _ $ (Strip $ (Project). Mak

The cus_rel_obj_list variable stores the name of the file required during the connection.

 

4. Make/$ (Strip $ (customer) _ $ (Strip $ (Project). Mak file function.

Custom_option defines the macros of all functional modules to be compiled.

Functions of the complist variable:

Ifeq ($ (Strip $ (RTOs), nucleus)

Complist = maid

Endif

If the operating system is nucleus, complist is the subsequent value, and complist is the list of files to be compiled, which stores a lot of *. inc files.

Config/include

Stacklib/include

Adaptation/include

Kal/include and so on

 

5. Make/user_specific.mak is called later in the option. Mak file.

If the CPU is arm, the compilation tool directory is defined as follows:

Ifeq ($ (Strip $ (compiler), ADS)

Dir_arm = C:/progra ~ 1/ARM/adsv1_2

Dir_arm: = $ (Strip $ (dir_arm ))

Dir_tool = $ (dir_arm)/bin

Dir_armlib = $ (dir_arm)/lib

Dir_arminc = $ (dir_arm)/include

Endif

The following are the connection packaging tools:

Dir_tool: = $ (Strip $ (dir_tool ))

Link = $ (dir_tool)/armlink.exe # linker

ASM = $ (dir_tool)/armasm.exe # arm Explorer

Lib = $ (dir_tool)/armar.exe # library tool

Bin_create = $ (dir_tool)/fromelf.exe # binary Tool

The following code tells us what compilation tool is needed for compilation.

Ifeq ($ (Strip $ (compiler), ADS)

Ifeq ($ (Strip $ (compile_mode), inst16)

Cc = $ (dir_tool)/tcc.exe # thumb mode (16 bits), use TCC

Cc32 = $ (dir_tool)/armcc.exe # arm mode (32 bits), use ARMCC

Cppc = $ (dir_tool)/tcpp.exe # thumb mode (16 bits), use TCC

Cppc32 = $ (dir_tool)/armcpp.exe # arm mode (32 bits), use ARMCC

Else

Ifeq ($ (Strip $ (compile_mode), inst32)

Cc = $ (dir_tool)/armcc.exe # arm mode (32 bits), use ARMCC

Cppc = $ (dir_tool)/armcpp.exe # arm mode (32 bits), use ARMCC

Else

Cc = $ (dir_tool)/tcc.exe # default TCC

Cc32 = $ (dir_tool)/armcc.exe # arm mode (32 bits), use ARMCC

Cppc = $ (dir_tool)/tcpp.exe # thumb mode (16 bits), use TCC

Cppc32 = $ (dir_tool)/armcpp.exe # arm mode (32 bits), use ARMCC

Endif

Endif

Endif

 

Ifeq ($ (Strip $ (Platform), mt6223p)

Aflags: =-g-littleend-CPU ARM7EJ-S

Endif

 

The commincdirs variable first contains the INC directory of the basic function module and then contains the following files:

Commincdirs + = $ (dir_arminc) $ (custom_comminc ),

 

6. option. mak defines the compilation modes of some additional functional modules (whether to compile and what results are compiled into), such as Bluetooth, uart3, WiFi, USB, WAP, etc, there are also some compiler settings.

Our version number and scat file are defined in this variable: 5056l

Scatterfile = custom/system/$ (Strip $ (board_ver)/scat $ (strip distribution (platform1_.txt

Vernofile = make/Verno _ $ (customer). BLD

. Binfile name is set in this variable targname =$ (customer) _ $ (Strip $ (sub_board_ver) _ $ (Project) _ $ (Strip $ (Platform )) _ $ (Strip $ (chip_ver ))

Tst_db: = $ (Strip $ (tstdir)/database_classb

Include $ (Strip $ (vernofile )).

 

7. commands executed by new in the gsm2.mak File

New: cleanall cmgen mmi_feature_check asngen codegen asnregen operator_check_lite update

 

Update command

Update: cleanlog cleanbin mcddll_update codegen resgen cksysdrv remake

 

Commands executed by remake

Remake: mcp_check cleanlog cleanbin genverno libs $ (bin_file) done

 

Resgen is used to compile the resource file: res_xxx.c

 

(Echo custom_option = $ (foreach def, $ (board_ver) $ (Platform) $ (LCD _module) $ (ext_cam_module) $ (cmos_sensor),-d "$ (DEF )") /> $ (mmidir)/customer/resgenerator/custom_option.txt)

First, redirect custom_optionto custom_option.txt.

 

(Type make /~ Cus_opt.tmp >>$ (mmidir)/customer/resgenerator/custom_option.txt)

Use tools/strcmpex.exe to generate ~ Cus_opt.tmp ,~ Tgt_opt.tmp ,~ Inc. tmp files

Change ~ Cus_opt.tmp to custom_option.txt

 

(@ Del $ (mmidir)/MMI/targetoption.txt )&/

(Copy/y make /~ Tgt_opt.tmp $ (mmidir)/MMI/targetoption.txt)

Update targetoption.txt and replace ~ Tgt_opt.tmpto targetoption.txt

 

(Type make /~ Inc. tmp> $ (mmidir)/customer/resgenerator/custom_include.tmp)

Then change ~ Inc. tmp is redirected to custom_include.tmp,

 

Execute the replace_project_name.pl file and compile res_xxx.c.

Then execute resgenerator_h1_bat to compile the resource file.

 

8. The remake compilation process is completed in libs.

Target dependency: libs: cleanlib startbuildlibs $ (compliblist)

Cleanlib clears the last generated. Bin,. Elf,. Lis and other files in this dependency, and then clears the. Lib file that needs to be generated again. $ (Compliblist) is the. Lib file that needs to be regenerated.

. Lib file dependency: %. Lib:

The action in this dependency is to set the compiler, linker, parameters of the process, and other information, and then output the information :~ Compbld. tmp temporary file.

 

(Tools/make.exe-fmake/comp. mak-K-r $ (Strip $ (cmd_argu) component =ent * >$ (Strip $ (complogdir)/$ *. log )/

Call the make command to execute the comp. Mak file, and you can see >$ (Strip $ (complogdir)/$ *. Log

This statement stores the information generated when executing the comp. Mak file in the. log file of the current Compilation part. Usually, the compilation information such as custom. log is the file of this type.

 

Dependency: update_lib: $ (targlib)

$ (Targlib): $ (cobjs) $ (cppobjs) $ (aobjs) $ (armobjs)

$ (Targlib) depends on many. C and. OBJ

. C. OBJ:

@ Echo compiling $ <...

@ Tools/strcmpex.exe $ (Action) remake e $ (* F ). via $ (cintwork)-C $ (cflags) $ (cdefs) $ (cincdirs)-o $ (compobjs_dir)/$ @ $ <

@ Tools/strcmpex.exe $ (Action) remake N $ (* F ). via $ (cintwork)-C $ (cflags) $ (cdefs) $ (cincdirs) $ (MD)-o $ (compobjs_dir)/$ @ $ <

@ If exist $ (* f). Via tools/warp.exe $ (* f).

@ If exist $ (* f). Via $ (cmplr) $ (VIA) $ (* f).

@ If not $ (Action) = remake if exist $ (fixpath)/$ (* F ). d Perl. /tools/pack_dep.pl $ (fixpath)/$ (* F ). d> $ (rulesdir)/$ (Component) _ DEP/$ (* F ). det

@ If not $ (Action) = remake if exist $ (fixpath)/$ (* F ). d del/f/Q $ (fixpath)/$ (* F ). d> NUL

@ If exist $ (* f). Via del/f/Q $ (* f).

To generate a. o dependent on the. c file, if my. c file is updated, the. o file needs to be re-generated and the. c file needs to be re-compiled.

@ Tools/strcmpex.exe $ (Action) remake e $ (* F ). via $ (cintwork)-C $ (cflags) $ (cdefs) $ (cincdirs)-o $ (compobjs_dir)/$ @ $ <

@ Tools/strcmpex.exe $ (Action) remake N $ (* F ). via $ (cintwork)-C $ (cflags) $ (cdefs) $ (cincdirs) $ (MD)-o $ (compobjs_dir)/$ @ $ <

There are two compilation steps for different compilation actions. The difference between the two is that there is a $ (MD) Compilation option in the middle, and dependency files will be generated when the option is compiled at the time. d.

@ If not $ (Action) = remake if exist $ (fixpath)/$ (* F ). d Perl. /tools/pack_dep.pl $ (fixpath)/$ (* F ). d> $ (rulesdir)/$ (Component) _ DEP/$ (* F ). det

In this statement, $ (fixpath)/$ (* F ). d> $ (rulesdir)/$ (Component) _ DEP/$ (* F ). det this action again. d file. pl File parameters, run the perl file, and put the result output in. det file.

@ If not $ (Action) = remake if exist $ (fixpath)/$ (* F ). d del/f/Q $ (fixpath)/$ (* F ). d> NUL

Then execute this statement to delete the. d file.

In the make file, you can see-include $ (rulesdir)/$ (Component). Dep

Check the. Dep file when you view the dependencies of various. O files to determine whether to re-compile and generate the. o file.

If a new. h file is added and the. Dep file is not updated, the. h file may not be dependent on the. o file. Do not update this. O.

@ If exist $ (fixpath)/$ (cus_mtk_lib)/$ (Component). lib/

(Copy/Z $ (fixpath)/$ (cus_mtk_lib)/$ (Component). Lib $ (SUBST/,/, $ (targlib )))&/

($ (LIB)-r $ (targlib) $ (compobjs_dir)/*. OBJ )/

Else/

($ (LIB)-create $ (targlib) $ (compobjs_dir)/*. OBJ)

After the. o file is generated, You can see ($ (LIB)-r $ (targlib) $ (compobjs_dir)/*. OBJ) in the. Lib dependency)

This statement packs the generated. o file into a. Lib library file.

 

Connection process: $ (bin_file ):

Final Compilation: done:

#-----------------------------

# Clean temporary files in make directory

#-----------------------------

@ Echo cleaning make /~ *. Tmp files...

@ If exist make /~ *. Tmp/

Del make /~ *. Tmp

@ Echo done.

@ Perl tools/time. pl-n

Clear the temporary file, press the done information, and finally press the time tag.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.