1304 views|0 replies

6609

Posts

0

Resources
The OP
 

C6000 Learning Bits: C Code Optimization of C6000 Series (I) [Copy link]

I. Common options for c6x compilation (I) The c6x compiler is "cl6x.exe"
  • Cl6x [options] [filenames]
  • Cl6x: Compiler
  • Options: Compiler options
  • Filenames: C or assembly source file
[color=rgb(51, 102, 153) !important]Copy code
Note: The compile option is one or two letters, not case sensitive. The compile option needs to be preceded by a "-" symbol. One-letter options can be combined together. For example, "-sgq" is the same as "-s -g -q". Two-letter options can also be combined if the first letter is the same. For example, "-mgt" is the same as "-mg -mt". (II) Optimization options -mt: Indicates that alaising technology is not used in the program, which allows the compiler to optimize better. -o3: Perform the strongest optimization at the file level. Generally, this option should be used when compiling. However, in some cases, using this option to optimize the program may cause errors (-o2 has the same phenomenon, -o0 and -o1 will not cause errors). It may be that errors occur when optimizing loops and organizing pipelines. If this phenomenon occurs, you can use the -g option at the same time, and there will be no errors in program optimization, but the optimization effect will be reduced. In addition, you can adjust the expression of the program to avoid compiler errors. -pm: Optimize at the program level. You can combine all files for optimization, mainly removing uncalled functions, variables that are always constants, and unused function return values. It is recommended that programmers do this optimization work themselves. Using this option to compile under win98 may result in the compiler not being found. -ms0: Do not use redundant loops for optimization, reduce the size of the program. Generally, this option has little effect on program size optimization. -mh[n]: Remove the epilog of the pipeline, reduce the size of the program. This option is quite effective. However, there may be a problem of reading addresses outside the valid range, so you need to add some padding at the beginning and end of the data segment, or ensure that the addresses in the front and back of the array are valid when allocating memory. The optional parameter n gives the length of this padding in bytes. (III) Options for retaining compilation and optimization information -k: Retains the generated assembly language file after optimization. -s: Adds optimization information to the assembly language file. If not, adds the C language source program as a comment. -mw: Adds software pipeline information to the assembly language file. (IV) Options for debugging and profiling -g: Allows symbolic debugging, includes symbolic information and line number information in the "out" file, and can be debugged and profiled at the C language level. The combined use of -g, -mt and -o3 can ensure maximum optimization while being able to perform symbolic debugging. -mg: Allows profiling of optimized programs. Includes symbolic information and very little line number information in the "out" file. Allows profiling of C language function bases. If these two options are used together, the -g option may be ignored and the result is the same as using only -mg. (V) Other types -mln: Generate a program in large memory mode. -ml0: By default, set variables (arrays and structures) are treated as far types. -ml1: By default, all functions are treated as far type -ml2: Equal to -ml0 plus -ml1 -ml3: By default, all data and functions are treated as far type (VI) Recommended compilation methods Cl6x -gk -mt -o3 -mw -ss "filename" Method 1 is used for program debugging. This method has strong optimization capabilities and supports symbolic debugging. No errors will occur during the compilation process. Since the generated "out" file contains symbol information and line number information, it is relatively large. Cl6x -k -mgt -o3 -mw -ss "filename" Mode 2 is used for program profiling. This mode has the strongest optimization capability (same as mode 3 in most cases) and supports profiling of programs. The file only contains symbol information and very little line number information, so the "out" file is relatively small. Cl6x -k -mt -o3 -mw -ss "filename" Mode 3 is used for the final release version of the program. It can optimize the program the most and remove all symbol and line number information, so the "out" file is relatively small. Programs composed of multiple files should write makefiles, put the compilation parameters in the file, and indicate the version number of the compiler used. VII. Connection parameters -heap: specifies the size of the heap -stack: specifies the size of the stack All connection options should be put in the "cmd" file
This post is from Microcontroller MCU
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list