Transferred from: The seven mainstream compilers of ARM (armcc, iar, gcc for arm, LLVM(clang)) are introduced in detail_ Itexp CSDN blog_ armcc
necessary
before explaining the compilers, you must first understand the following files. These files are often found in the compiler directory or when compiling the executable program of the target platform. In addition, you should also pay attention to distinguishing files on Windows platform and Linux platform.
- . O file: refers to the object file, commonly known as the target file. Under Linux, the extension is abbreviated to o. Usually under windows obj file.
- . A file: refers to archive file, commonly known as static library file. Under Linux, the extension is abbreviated to a. Usually under windows lib file.
- . so file: refers to the shared object file, which is used for dynamic connection. Under Linux, the extension is abbreviated to so, usually under windows dll file.
. o file is a linked file A is a static library file and needs to be o file generation, as a library, provides function interfaces for external programs. You can see the blog in detail Detailed explanation of one of the ARM Image files / executable files / ELF files / object files.
there are a large number of tools in the cross compilation tool chain directory o and A documents. These files will be used when we compile the target platform! Why are there so many in the compilation tool chain under Windows o and A what about the file? This is because the compilation tool chain is compiled and generated in Linux system! . See the figure below:
If you have compiled the cross compilation tool chain yourself, you will see the build, host and target parameters:
- – build = the platform used to compile the software (i.e. the cross compilation tool chain itself)
- – host = the platform on which the software (i.e. the cross compilation tool chain itself) will run
- – target = the target platform to be processed by the software (i.e. the cross compilation tool chain itself). That is, the platform on which the program compiled by the cross compilation tool chain runs
compare
At present, the mainstream compilers for ARM platform mainly include the following three:
compare | ARMCC | IAR | GCC for ARM | LLVM(clang) |
---|---|---|---|---|
Command line tools | It is released with IDE and also provided independently | It is only released with its IDE and not provided independently | Independent provision | Command line tools only |
Developers | ARM | IAR | ARM,Linaro,Mentor | LLVM |
Supported platforms | Windows,Linux | Windows | Windows, Linux, Mac (partial) | Windows,Linux,Mac |
Supporting IDE | Keil MDK,ARM Development Studio 5,ADS | IAR EMBEDDED WORKBENCH FOR ARM | In addition to the above two, other ides supporting ARM, such as eclipse and Visual Studio | In addition to the above two, other ides supporting ARM, such as eclipse and Visual Studio |
Official website | https://developer.arm.com/tools-and-software/embedded/arm-compiler/downloads | https://www.iar.com/iar-embedded-workbench/ | 1. https://launchpad.net/gcc-arm-embedded 2. https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads | https://llvm.org/ |
ARM
in addition to the supporting IDE provided on the ARM official website( Refer to the blog post description of each integrated development environment (IDE) of ARM (Keil, RVDS, ADS, DS-5, MDK) )In addition, a separate download of the compiler is provided every time. You can install the compiler separately, and the compiler is used in the form of command line.
in other words, the IDE and compiler of ARM are independent of each other. Users can configure different versions of compilers for the same ide! At present, ARM officially provides two versions of compilers, as shown in the figure below:
among them, Arm Compiler 6 is called the replacement of Arm Compiler 5 by arm! Compared to the use of Arm Compiler 5 Edison Design Group For the compiler front end, Arm Compiler 6 replaces the compiler front end with an LLVM based Clang!
In the introduction of ARM's official website, there is the following paragraph
General update releases on the last branch, version 5.06, ended in H2 2017 with 5.06u6. After this, further support and maintenance will be available through Arm Compiler Long Term Maintenance releases with maintenance continuing until at least summer 2020. Arm Compiler 5.06 for Certification and Arm Compiler 5.06 Long Term Maintenance releases will each be supported by an Arm Compiler Qualification Kit.
The main idea is that ARM compiler will quit the stage after 5! Arm Compiler 6 is also much more perfect than Arm Compiler 5 in terms of ARM kernel support!
At present, the official IDE of arm will include these two versions of compilers. For example, under the installation directory of Keil MDK, there will be the following two directories, corresponding to Arm Compiler 5 and Arm Compiler 6 respectively
As mentioned above, the above compiler arm also provides independent download and installation. See the official website address above for details! I have installed several versions of ARM compiler, as follows:
- Edison Design Group Is a company that lives by selling products to companies selling compilers. It sells front-end, including C + +, Java and Fortran front-end. Almost all commercial compilers in the world will use this company's front-end. Most importantly, there are only five people in this company.
The five people are: Mike Miller, Daveed vandevorde, Steve Adamczyk, John Spicer and Mike herricl. Daveed vandevorde has written two books, C++ Templates and C++ Solutions. Mike Miller is a C + + expert who realizes some C + + functions. Mike Herrick spent 19 years at Bell Labs. Steve Adamczyk and John Spicer are the founders of EDG. - In the earliest days, the compiler of ARM was also released with IDE, such as ADS era!
armcc.exe
ARM instruction and Thumb ® Instruction compiler. Used to compile C and C + + code. It supports inline and embedded assemblers and includes an advanced SIMD vectorization compiler.
the compiler supports compiling C and C + + source code meeting the following standards into ARM and Thumb ® code:
- ISO Standard C:1990 source.
- ISO Standard C:1999 source.
- ISO Standard C++:2003 source.
- ISO Standard C++:2011 source.
armcc# complies with the base standard application binary interface for the ARM architecture (BSABI):
- Generate an ELF format object file. Reference blog Detailed explanation of ARM Image file / executable file / ELF file / object file.
- Generate debugging information based on Debug With Arbitrary Record Format Debugging Standard Version 3 (DWARF 3), and include support for DWARF 2 debug tables.
- Use the Edison Design Group (EDG) compiler front end!
D:\ARM\ARM_Compiler_5.06u4>armcc Product: ARM Compiler 5.06 Component: ARM Compiler 5.06 update 4 (build 422) Tool: armcc [4d3604] Usage: armcc [options] file1 file2 ... filen Main options: --arm Generate ARM code establish ARM code --thumb Generate Thumb code establish Thumb code --c90 Switch to C mode (default for .c files) Switch to C pattern (The default is .c file) --cpp Switch to C++ mode (default for .cpp files) Switch to C++pattern (default .cpp file) -O0 Minimum optimization Minimum optimization level -O1 Restricted optimization for debugging Limited debug level optimization -O2 High optimization High optimization -O3 Maximum optimization Maximum optimization -Ospace Optimize for codesize Optimize code size -Otime Optimize for maximum performance Optimize the run time of the maximum optimization level --cpu <cpu> Select CPU to generate code for choice CPU --cpu list Output a list of all the selectable CPUs Output all selected CPU list -o <file> Name the final output file of the compilation The name of the final output file -c Compile only, do not link Compile only, no links --asm Output assembly code as well as object code Output assembly and obj file -S Output assembly code instead of object code Output only assembly files --interleave Interleave source with disassembly (use with --asm or -S) Cross disassembly (use with --asm or -S) -E Preprocess the C source code only Pretreatment only C code -D<symbol> Define <symbol> on entry to the compiler definition <symbol> The symbol is passed into the compilation process -g Generate tables for high-level debugging Create tables for high-level debugging -I<directory> Include <directory> on the #include search path contains < Directory > as the header file search directory when compiling
The default header file search path is shown in the following figure:
armasm.exe
ARM and Thumb assembler. Used to assemble ARM and Thumb assembly language source files.
D:\ARM\ARM_Compiler_5.06u4>armasm Product: ARM Compiler 5.06 Component: ARM Compiler 5.06 update 4 (build 422) Tool: armasm [4d35cf] For Educational purposes only Software supplied by: ARM Limited Usage: armasm [options] sourcefile Options: --list listingfile Write a listing file (see manual for options) Generate list file -o outputfile Name the final output file Name the final output file name --depend dependfile Save 'make' source file dependencies retain 'make' Source file dependency --errors errorsfile Put stderr diagnostics to errorsfile Put standard error judgment into errorsfile -I dir[,dir] Add dirs to source file search path Add search directory for source files --pd --predefine directive Pre-execute a SET{L,A,S} directive Pre execution SET{L,A,S} instructions --maxcache <n> Maximum cache size (default 8MB) Maximum flash memory space (default 8MB) --no_esc Ignore C-style (\c) escape sequences ignore C Style(\ c)Escape sequence --no_warn Turn off Warning messages Turn off warning messages -g Output debugging tables Output debugging table --apcs /<quals> Make pre-definitions to match the chosen procedure-call standard Predefined to match selected program call criteria --checkreglist Warn about out of order LDM/STM register lists warning LDM/STM Register list failure --help Print this information print the help information --li Little-endian ARM Small end mode ARM --bi Big-endian ARM Big end mode ARM -M Write source file dependency lists to stdout Write source file dependency list to stdout --MD Write source file dependency lists to inputfile.d Write source file dependency list to inputfile.d --keep Keep local labels in symbol table of object file Save the local label in the symbol table of the target file --regnames none Do not predefine register names Register names are not predefined --split_ldm Fault long LDM/STM --unsafe Downgrade certain errors to warnings Demote some errors to warnings --via <file> Read further arguments from <file> from<file>Read more parameters in --cpu <target-cpu> Set the target ARM core type Set goals ARM Core type --cpu list Output a list of all the selectable CPUs Output all optional CPU List of --fpu <target-arch> Set target FP architecture version Set goals FP Schema version --fpu list Output a list of all selectable FP architectures Output all optional FP List of schemas --thumb Assemble Thumb instructions assembly Thumb instructions --arm Assemble ARM instructions assembly ARM instructions
armlink.exe
The linker. This combines the contents of one or more object files with selected parts of one ormore object libraries to produce an executable program.A 64-bit version of armlink is also provided that can access the greater amount of memoryavailable on 64-bit machines. It supports all the features that are supported by the 32-bit versionof armlink in this release. Connector. Used to combine the contents of one or more object files with selected parts of one or more object libraries to generate executable programs. A 64 bit version of armlink is also available to access the larger amount of memory available on 64 bit computers. It supports all the features supported by the 32-bit version of armlink in this version.
If you are using ARM Compiler as a standalone product, then the 32-bit version is used bydefault. If you use the ARM compiler as a stand-alone product, the 32-bit version is used by default.
For ARM Compiler in DS-5, the linker version depends on the host platform. 32-bit tools havethe 32-bit linker and 64-bit tools have the 64-bit linker. You do not get both versions.For the Microcontroller Developer Kit (MDK), only the 32-bit linker is provided. For the ARM compiler in ds-5, the linker version depends on the host platform. The 32-bit tool has a 32-bit linker and the 64 bit tool has a 64 bit linker. You did not get both versions. For the microcontroller development kit (MDK), only 32-bit linkers are available.
D:\ARM\ARM_Compiler_5.06u4>armlink Product: ARM Compiler 5.06 Component: ARM Compiler 5.06 update 4 (build 422) Tool: armlink [4d35d2] For Educational purposes only Software supplied by: ARM Limited Usage: armlink option-list input-file-list where option-list is a list of case-insensitive options. A list of options that are not case sensitive. input-file-list is a list of input object and library files. Enter a list of objects or library files. General options (abbreviations shown capitalised): --help Print this summary. Displays help information. --output file Specify the name of the output file. Specify the output file name. --via file Read further arguments from file. Options for specifying memory map information: --partial Generate a partially linked object. Create a decentralized linked object file. --scatter file Create the memory map as described in file. Create a memory map as described in file (distributed load file). --ro-base n Set exec addr of region containing RO sections. Set the execution address space field, including RO paragraph(Read only data segment). --rw-base n Set exec addr of region containing RW/ZI sections. Set the execution address space field, including RW/ZI Paragraph. Options for controlling image contents: --bestdebug Add debug information giving best debug view to image. Add debugging information to provide the best debugging view for the image. --datacompressor off Do not compress RW data sections. Do not compress RW Data segment. --no_debug Do not add debug information to image. Do not add debug information. --entry Specify entry sections and entry point. Specify the input segment and input point. --libpath Specify path to find system libraries from. Specify the path to the system library file. --userlibpath Specify path to find user libraries from. Specify the user library file path. --no_locals Do not add local symbols to image symbol table. Do not add local labels to image List of labels. --no_remove Do not remove unused sections from image. Do not remove image Unused segment of. Options for controlling image related information: --callgraph Create a static callgraph of functions. Create a function static call graph. --feedback file Generate feedback that can be used by the compiler in file. --info topic List misc. information about image. Available topics: (separate multiple topics with comma) common List common sections eliminated from the image. debug List eliminated input debug sections. sizes List code and data sizes for objects in image. totals List total sizes of all objects in image. veneers List veneers that have been generated. unused List sections eliminated from the image. --map Display memory map of image. display image Memory mapping. --symbols List symbols in image. list image Symbol. --xref List all cross-references between input sections. Lists all cross references between the entered segments.The final output will be placed in.map In the file.
armar.exe
The librarian. This enables sets of ELF object files to be collected together and maintained inarchives or libraries. You can pass such a library or archive to the linker in place of several ELFfiles. You can also use the archive for distribution to a third party for further applicationdevelopment. Library file management tool. This allows elf object filesets to be collected together and maintained in the original file or library. You can pass such a library or archive to the linker in place of multiple elf files. You can also use the archive for distribution to third parties for further application development.
D:\ARM\ARM_Compiler_5.06u4>armar Product: ARM Compiler 5.06 Component: ARM Compiler 5.06 update 4 (build 422) Tool: armar [4d35c8] Archive creation and maintenance tool Command format: armar options archive [ file_list ] Wildcards '?' and '*' may be used in file_list Options:- -r Insert files in <file_list>, replace existing members of the same name. stay <file_list> Insert file in, Replace an existing member with the same name. -d Delete the members in <file_list>. from <file_list> Delete members from. -x Extract members in <file_list> placing in files of the same name. from <file_list> Extract a member with the same name from. -m Move files in <file_list>. stay <file_list> Move files in. -p Print files to stdout. Print files to standard output devices. -a pos Insert/move files after file named <pos>. insert/delete <pos> The following file. -b pos Insert/move files before file named <pos>. insert/delete <pos> Previous file. -u Update older files only, used with -r. Update only old files, And -r Use together. -n Do not add a symbol table to an object archive. Not to object Add a symbol table to the file. -s Force regeneration of archive symbol table. Force document symbol table regeneration. -t Print table of contents of archive. Print the content table of the document. --zs Show the symbol table. Displays the symbol table. --zt Summarize the archive contents (sizes + entries). Summarize document content (Size and input). -c Suppress warning when a new archive is created. No warning is displayed when a new document is created. -C Do not overwrite existing files when extracting. Do not overwrite an existing file when extracting. -T Truncate file names to system maximum length. Intercept the maximum length file name of the system. -v Give verbose output. Provide detailed output. --create Force creation of a new archive. Force the creation of a new document. --via file Take additional arguments from via file. from via Get additional parameters from the file. --sizes List the size of each member and the library total. Lists all member sizes and the total size of the library. --entries List sections containing ENTRY points. List the sections that include entry points. --vsn Print the current Armar Version. Print the latest armar edition. --help Print this message. Print help information. Examples:- armar -r mylib.a obj1 obj2 obj3... armar -x mylib.a ?sort* armar -d mylib.a hash.o armar -tv ansilib.a
fromelf.exe
The image conversion utility. This can also generate textual information about the input image,such as its disassembly and its code and data size. Mirror conversion utility. This can also generate text information about the input image, such as its disassembly and its code and data size.
D:\ARM\ARM_Compiler_5.06u4>fromelf Product: ARM Compiler 5.06 Component: ARM Compiler 5.06 update 4 (build 422) Tool: fromelf [4d35cb] ARM image conversion utility. ARM Mirror conversion tool fromelf [options] input_file Options: --help display this help screen display help information --vsn display version information display version information --output file the output file. (defaults to stdout for -text format) Output file name. (Default output -text format) --nodebug do not put debug areas in the output image Do not output debug information to the image file --nolinkview do not put sections in the output image Do not output segment information to the image file Binary Output Formats: --bin Plain Binary Ordinary binary --m32 Motorola 32 bit Hex Motorola 32-bit Hex code --i32 Intel 32 bit Hex Intel 32-bit Hex code --vhx Byte Oriented Hex format Directional byte Hex format --base addr Optionally set base address for m32,i32 by m32,i32 Set base address (optional) Output Formats Requiring Debug Information Debug information required by output format --fieldoffsets Assembly Language Description of Structures/Classes. Structures/Classes Assembly description of --expandarrays Arrays inside and outside structures are expanded. Expand arrays of internal and external structures Other Output Formats: --elf ELF ELF format --text Text Information Text information Flags for Text Information Flag of text message -v verbose detailed information -a print data addresses (For images built with debug) Print address information of data (Get.axf Image file) -c disassemble code Sink code -d print contents of data section Print segment content of data -e print exception tables Print exception table -g print debug tables Print debugging table -r print relocation information Print relocation information -s print symbol table Print symbol table -t print string table Print character table -y print dynamic segment contents Print dynamic segment content -z print code and data size information Print code and data size information
IAR
compared with ARM's flexible installation of compiler, IAR's compiler is only released with its IDE, and the compiler is not provided independently. After IAR is installed, the directory will look like this:
Here, we focus on the relevant contents in the arm directory. There are many contents. Here we mainly introduce those related to the compiler. First, look at the following figure
we can manually extract its compiler for use as a command-line tool. However, this is not recommended for IAR. Personally, I don't think IAR has considered allowing users to use the command line mode to independently use the compilation suite, because its compilation suite and many other things are placed in a directory, unlike ARM, which stores the compilation suite independently. However, The compiler, assembler, and linker can also be run from a command line environment,if you want to use them as external tools in an already established project environment The official introduction document is IAR C/C++ Development Guide Compiling and Linking.
- IAR I use less, and the main content comes from official documents. The management documents are more detailed. If you have any questions, just go to the official documents directly! The official document directory is IAR installation directory \ arm\doc. The details are as follows:
- IAR C/C++ Development Guide Compiling and Linking, the document name is EWARM_DevelopmentGuide.ENU.pdf
- IAR Assembler Reference Guide, document name EWARM_AssemblerReference.ENU.pdf
- <C-STAT ® Static Analysis Guide, document name EW_MisraC1998Reference.ENU.pdf
- You can also directly enter from the menu of IAR IDE: menu - > help
iasmarm.exe
this is the IAR assembly language compiler. The IAR Assembler for Arm is a powerful relocating macro assembler with a versatile set of directives and expression operators The assembler features a built-in C language preprocessor and supports conditional assembly. IAR Assembler for Arm is a powerful relocation macro assembler with a variety of instructions and expression operators. The assembler has a built-in C language preprocessor and supports conditional assembly. The official document of the tool is IAR Assembler Reference Guide, which contains detailed instructions for the use of the tool.
E:\Program Files (x86)\IAR Systems\Embedded Workbench 8.2\arm\bin>iasmarm IAR Assembler V8.32.3.193/W32 for ARM Copyright 1999-2019 IAR Systems AB. Usage: iasmarm {<options>} <sourcefile> {<options>} Sourcefile: source file with default extension: .msa, , .asm, or .s Environment: IASMARM Options (specified order is of no importance): -B Print debug info for assembler macros -c{DEAOM} Listing options D: Disable listing, E: Disable macro expansion A: List only assembled part O: List several lines of code M: List Macro definition -DSYMB Equivalent to: #define SYMB 1 -DSYMB=xx Equivalent to: #define SYMB xx -e Use big-endian byte order -Enumber Allow <number> errors -f file Extend command line with <file> <.xcl> -g No system include -G Open standard input as source -i List #included files -Ipath Add #include search path -j Enable alternative register names, operators and mnemonics -l file Generate a list on: <file> <.lst> -Lpath Generate a list on: <path> \ <source> <.lst> -Mab Change asm.macro argument quote chars, where a is start-of-quote and b is end-of-quote char. default is a == < and b == >. -N No header in listing -o file Put object on: <file> <.o> -Opath Put object on: <path> \ <source> <.o> -pnn Page listing with 'nn' lines/page (10-150) -r Enable debugger output in object -S Silent operation of assembler -s{+|-} Set case sensitivity for user symbols -s and -s+ enables sensitivity, -s- disables it. -tn Set tab spacing between 2 and 9 (default 8) -USYMB Equivalent to: #undef SYMB -ws To make warnings generate exit code 1 -wstring Disable warnings string: <+|-,><+|-range><,+|-range>... range: low_warning_nr<-high_warning_nr> example: -w turns all warnings off -w-,+10-12,+20 turns all but 10,11,12 and 20 off -x{DI2} Generate cross-reference list D: Show all #defines, I: Show Internal table 2: Dual line space listing --aarch64 Generate code for AArch64, same as --cpu_mode A64 --abi {lp64|ilp32} Specify ABI for AArch64: ilp32 or lp64. --arm Generate code in arm mode, same as --cpu_mode arm --cmse Target secure mode in CMSE (ARMv8-M security extensions) --cpu core Specify target core Valid options are core names such as Cortex-M3 and architecture names such as 7M Default is Cortex-M3 --cpu_mode {arm|a|thumb|t} Select default mode for CODE directive, ARM is default --endian {little|l|big|b} Specify target byte order --fpu {VFPv1|VFPv2|VFPv3{_D16}{_FP16}|VFP9-S|none} Specify target FPU coprocessor support Default is none, which selects the software floating-point library. --legacy {legacyOption} Generate object files compatible with older toolchains. Valid options are: RVCT3.0 --no_dwarf3_cfi Suppress Dwarf 3 Call Frame Information instructions --no_it_verification Do not verify that the instructions following an IT instruction has the correct condition set --no_literal_pool Use MOV32 for LDR Rd,=expr (requires ARMv7-M) --no_path_in_file_macros Strip path from __FILE__ macros --source_encoding {locale|utf8} Encoding to use for source files with no BOM --suppress_vfe_header Do not generate VFE header info --system_include_directory <path> Set system header directory --thumb Generate code in thumb mode, same as --cpu_mode thumb --version Output version info and exit
iccarm.exe
this is IAR's C/C + + compiler. The IAR C/C + + compiler for Arm is a state of the art compiler that offers the standard features of the C and C + + languages, plus extensions designed to take advantage of the Arm specific facilities IAR C/C + + compiler for Arm is a state-of-the-art compiler that provides standard functions of C and C + + languages and extensions designed to take advantage of Arm specific functions.
header file directory used by default \arm\inc\<vendor>
E:\Program Files (x86)\IAR Systems\Embedded Workbench 8.2\arm\bin>iccarm IAR ANSI C/C++ Compiler V8.32.3.193/W32 for ARM Copyright 1999-2019 IAR Systems AB. PC-locked license - IAR Embedded Workbench for ARM Available command line options: --aapcs {std|vfp} Specify calling convention. --aeabi Generate aeabi compliant code --align_sp_on_irq Generate code to align SP on entry to __irq functions --arm Generate code in arm mode, same as --cpu_mode arm --c++ C++ --c89 Use C89 standard --char_is_signed 'Plain' char is treated as signed char --char_is_unsigned 'plain' char is treated as unsigned char --cmse Enable CMSE secure object generation --cpu core Specify target core Valid options are core names such as Cortex-M3 and architecture names such as 7M Cortex-M3 is default --cpu_mode {arm|a|thumb|t} Select default mode for functions, arm is default -D symbol[=value] Define macro (same as #define symbol [value]) --debug -r Insert debug info in object file --dependencies=[i|m|n][s][lw][b] file|directory|+ List file dependencies i Include filename only (default) m Makefile style (multiple rules) n Makefile style (one rule) s Don't include system file dependencies l Use locale encoding instead of UTF-8 w Use little endian UTF-16 instead of UTF-8 b Use a Byte Order Mark in UTF-8 output (+: output same as -o, only with .d extension) --deprecated_feature_warnings [+|-]feature,[+|-]feature,... Enable (+) or disable (-) warnings about deprecated features: attribute_syntax Warn about attribute syntax that will change preprocessor_extensions Warn about use of migration preprocessor extensions segment_pragmas Warn about use of #pragma constseg/ dataseg/memory --diagnostics_tables file|directory Dump diagnostic message tables to file --diag_error tag,tag,... Treat the list of tags as error diagnostics --diag_remark tag,tag,... Treat the list of tags as remark diagnostics --diag_suppress tag,tag,... Suppress the list of tags as diagnostics --diag_warning tag,tag,... Treat the list of tags as warning diagnostics --discard_unused_publics Discard unused public functions and variables --dlib_config name|path Specify DLib library configuration --do_explicit_zero_opt_in_named_sections Allow zero init optimization for variables in named sections/segments -e Enable IAR C/C++ language extensions --enable_hardware_workaround waid[,waid[...]] Generate hardware workaround for specified problem --enable_restrict Enable the restrict keyword --endian {little|l|big|b} Select byte order, little-endian is default --enum_is_int Force the size of all enumeration types to be at least 4 bytes --error_limit limit Stop after this many errors (0 = no limit) -f file Read command line options from file --f file Read command line options from file and report dependency --fpu {VFPv2|VFPv3{_D16}{_FP16}|VFPv4{_sp}|VFP9-S|none} Specify target FPU coprocessor support Default is none, which selects the software floating-point library. --generate_entries_without_bounds Generate functions for use from non-instrumented code --guard_calls Use a guard call for a function static initialization --header_context Adds include file context to diagnostics -I directory Add #include search directory --ignore_uninstrumented_pointers Disable checking of accesses via pointers from uninstrumented functions -l[c|C|D|E|a|A|b|B][N][H] file|directory Output list file c C source listing C with assembly code D with pure assembly code E with non-sequential assembly code a Assembler file A with C source b Basic assembler file B with C source N Do not include diagnostics H Include header file source lines --lock_regs registers Prevent compiler from using specified registers (R4-R11). --macro_positions_in_diagnostics Use positions inside macros in diagnostics --make_all_definitions_weak Make all variable and function definitions weak --max_cost_constexpr_call limit Maximum cost (number of calls/number of loop iterations) when evaluating a top-level constexpr call --max_depth_constexpr_call limit Maximum depth of recursion when evaluating a top-level constexpr call --mfc Enable multiple file compilation --misrac1998[=arg,arg,...] Enable MISRA-C 1998 diagnostics all Enable all rules required Enable all required rules i Enable rule i i-j Enable rule i through j ~i Disable rule i ~i-j Disable rule i through j --misrac2004[=arg,arg,...] Enable MISRA-C 2004 diagnostics all Enable all rules required Enable all required rules X Enable rule or chapter X-Y Enable range ~X Disable rule or chapter ~X-Y Disable range where X and Y is one of: i All rules in chapter i i.j Rule i.j --misrac_verbose Enable verbose MISRA C messages --nonportable_path_warnings Enable warning for non-matching case in paths --no_alignment_reduction Disable alignment reduction of simple thumb functions --no_bom Don't use a Byte Order Mark in Unicode output --no_call_frame_info Suppress output of call frame information --no_clustering Disable static clustering for static and global variables --no_code_motion Disable code motion --no_const_align Turn off the alignment optimization for constants --no_cse Disable common sub-expression elimination --no_exceptions Disable C++ exception support --no_fragments Do not generate section fragments --no_inline Disable function inlining --no_literal_pool Generate code that does not issue read request to .text --no_loop_align Disable alignment of labels in loops (Thumb2) --no_mem_idioms Disable idiom recognition for memcpy/memset/memclr --no_path_in_file_macros Strip path from __FILE__ and __BASE_FILE__ macros --no_rtti Disable C++ runtime type information support --no_rw_dynamic_init Don't allow C-object to be initialized at runtime --no_scheduling Disable instruction scheduling --no_size_constraints Remove limits for code expansion --no_static_destruction Do not emit code to destroy C++ static variables --no_system_include Do not search in the default system header directory --no_tbaa Disable type based alias analysis --no_typedefs_in_diagnostics Do not use typedefs when printing types --no_unaligned_access Don't generate unaligned accesses --no_uniform_attribute_syntax Use old meaning for IAR type attributes before initial type --no_unroll Disable loop unrolling --no_var_align Turn off the alignment optimization for variables --no_warnings Disable generation of warnings --no_wrap_diagnostics Don't wrap long lines in diagnostic messages -O[n|l|m|h|hs|hz] Select level of optimization: n No optimizations l Low optimizations (default) m Medium optimizations h High optimizations hz High optimizations, tuned for small code size hs High optimizations, tuned for high speed (-O without argument) The same setting as -Oh --only_stdout Use stdout only (no console output on stderr) --output file|path -o file|path Specify object file --pending_instantiations limit Maximum number of instantiations of a given template in progress at a time (0 -> no limit) --predef_macros file|directory Output predefined macros --preinclude filename Include file before normal source --preprocess=[c][n][s] file|directory Preprocessor output c Include comments n Preprocess only s Suppress #line directives --public_equ symbol[=value] Define public assembler symbol (EQU) --relaxed_fp Enable floating point optimizations that may affect the result --remarks Enable generation of remarks --require_prototypes Require prototypes for all called or public functions --ropi Generate read-only position independent code --runtime_checking check,check,... Instrument code to do runtime checks for the selected problems: bounds Check pointer bounds bounds_no_checks Track pointer bounds, but emit no checks div_by_zero Check division by zero implicit_integer_conversion Check only implicit integer conversion integer_conversion Check any integer conversion signed_overflow Check for signed integer overflow signed_shift Check for overflow in signed shift switch Check for unhandled cases in switch statements unsigned_overflow Check for unsigned integer overflow unsigned_shift Check for overflow in unsigned shift --rwpi Generate read-write position independent code --rwpi_near Generate read-write position independent code --section section-name=new section-name Rename section --silent Silent operation --source_encoding {locale|utf8} Encoding to use for source files with no BOM --stack_protection Insert stack smash protection --strict Strict C/C++ standard language rules --system_include_dir directory Set system header directory --text_out encoding Encoding to use for text output files utf8 UTF-8 utf16le Little-endian UTF-16 utf16be Big-endian UTF-16 locale Locale specific encoding --thumb Generate code in thumb mode, same as --cpu_mode thumb --uniform_attribute_syntax Same syntax for IAR type attributes as for const/volatile --use_c++_inline Use C++ inline semantics in C mode --use_paths_as_written Use paths as written in debug information (normally absolute paths are used) --use_unix_directory_separators Use forward slashes in paths in debug information --utf8_text_in Non-source text input files with no BOM use UTF-8 encoding --vectorize Perform autovectorization --version Output version information and exit --vla Allow variable length arrays --warnings_affect_exit_code Warnings affect exit code --warnings_are_errors All warnings are errors --warn_about_c_style_casts Warn about uses of C-style casts in EC++/C++
There are two tools in the IDE that can convert application source files to intermediate files and target files. IAR C / C + + compiler and IAR assembler. Both produce relocatable target files in the industry standard format ELF, including the format of DWARF debugging information. The following figure shows the compilation process:
ilinkarm.exe
this is the connector of IAR. The IAR ILINK Linker for Arm is a powerful, flexible software tool for use in the development of embedded controller applications It is equally well suited for linking small, single-file, absolute assembler programs as it is for linking large, relocatable input, multi-module, C/C++, or mixed C/C++ and assembler programs. IAR ILINK Linker for Arm is a powerful and flexible software tool, which can be used for the development of embedded controller applications. It is also suitable for linking small, single file, absolute assemblers because it is used to link large relocatable inputs, multi modules, C/ C + + or mixed C/ C + + and assemblers.
ilinkarm uses and generates industry standard ELF and DWARF as object format files. Yes \The arm\config directory contains the configuration files used by the connectors for each platform.
E:\Program Files (x86)\IAR Systems\Embedded Workbench 8.2\arm\bin>ilinkarm IAR ELF Linker V8.32.3.193/W32 for ARM Copyright 2007-2019 IAR Systems AB. Available command line options: --advanced_heap Use an advanced heap manager. --basic_heap Use a basic heap manager --BE32 Use old type big-endian mode. --BE8 Use byte invariant mode. --bounds_table_size number_of_records[:number_of_buckets]|(number_of_bytes) Specify size of bounds checking tables --call_graph file|directory Produce an XML call graph file --config file Read linker configuration from file --config_def symbol=value Define a config symbol --config_search directory Look for config files in directory --cpp_init_routine symbol Specify C++ dynamic init routine name --cpu core Specify target core Valid options are core names such as Cortex-M3 and architecture names such as 7M default is extracted from objects --debug_heap Use heap with runtime checks --default_to_complex_ranges Make "complex ranges" the default in initialize directives --define_symbol symbol=value Define absolute symbol --dependencies=[i|m|n][s][lw][b] file|directory|+ List file dependencies i Include filename only (default) m Makefile style (multiple rules) n Makefile style (one rule) s Don't include system file dependencies l Use locale encoding instead of UTF-8 w Use little endian UTF-16 instead of UTF-8 b Use a Byte Order Mark in UTF-8 output (+: output same as -o, only with .d extension) --diagnostics_tables file|directory Dump diagnostic message tables to file --diag_error tag,tag,... Treat the list of tags as error diagnostics --diag_remark tag,tag,... Treat the list of tags as remark diagnostics --diag_suppress tag,tag,... Suppress the list of tags as diagnostics --diag_warning tag,tag,... Treat the list of tags as warning diagnostics --do_segment_pad Pad segments to 4 byte alignment --enable_hardware_workaround waid[,waid[...]] Generate hardware workaround for specified problem --enable_stack_usage Enable stack usage analysis --entry symbol Set program entry point --error_limit limit Stop after this many errors (0 = no limit) --exception_tables action Generate exception tables for modules lacking them nocreate Do not generate entries (default) unwind Generate unwind entries cantunwind Generate nounwind entries --export_builtin_config file|directory Export the builtin configuration --extra_init routine Call extra init routine if defined -f file Read command line options from file --f file Read command line options from file and report dependency --force_exceptions Always include exception code --force_output Produce an output file in spite of errors --fpu {VFPv1|VFPv2|VFPv3{_D16}{_FP16}|VFP9-S|none} Specify target FPU coprocessor support Default is extracted from objects. --ignore_uninstrumented_pointers Disable checking of accesses via pointers in memory with no bounds --image_input file[,symbol[,section[,alignment]]] Put image file in section --import_cmse_lib_in file Read previous version of import library for building non-secure image --import_cmse_lib_out file|directory Produce import library for building non-secure image --inline Try to inline small functions. --keep symbol Require global symbol --log topic,topic,... Do log output for the selected topics call_graph Call graph with stack usage crt_routine_selection CRT routine implementation selection demangle Demangle symbols in log output fragment_info Supplementary info for --log sections initialization Initialization decisions inlining Small function inlining libraries Automatic library selection merging Results of --merge_duplicate_sections modules Module selection redirects Redirected symbols sections Section fragment selection unused_fragments Unused section fragments veneers Veneer statistics --log_file file Specify file for log output --mangled_names_in_messages Include mangled symbol names in diagnostics --manual_dynamic_initialization Don't perform dynamic initialization during startup --map file|directory Produce a linker list file --merge_duplicate_sections Merge equivalent read-only sections --misrac1998[=arg,arg,...] Enable MISRA-C 1998 diagnostics all Enable all rules required Enable all required rules i Enable rule i i-j Enable rule i through j ~i Disable rule i ~i-j Disable rule i through j --misrac2004[=arg,arg,...] Enable MISRA-C 2004 diagnostics all Enable all rules required Enable all required rules X Enable rule or chapter X-Y Enable range ~X Disable rule or chapter ~X-Y Disable range where X and Y is one of: i All rules in chapter i i.j Rule i.j --misrac_verbose Enable verbose MISRA C messages --no_bom Don't use a Byte Order Mark in Unicode output --no_dynamic_rtti_elimination Disable dynamic rtti elimination --no_entry This program has no entry point --no_exceptions Signal an error if exceptions are used --no_fragments Always link entire sections --no_free_heap Use a heap manager with no 'free' --no_inline func,func,... Do not inline any of the specified functions --no_library_search Disable automatic runtime library search --no_literal_pool Don't generate literal pool in code memory --no_locals Do not include local symbols in output symbol table --no_range_reservations Do not reserve address ranges for absolute symbols --no_remove Do not remove unused sections --no_vfe Disable Virtual Fuction Elimination --no_warnings Disable generation of warnings --no_wrap_diagnostics Don't wrap long lines in diagnostic messages --only_stdout Use stdout only (no console output on stderr) --output file -o file Specify output file --pi_veneers Generate position independent veneers. --place_holder symbol[,size[,section[,alignment]]] Reserve a place in ROM for later use --preconfig file Read before normal linker configuration file --printf_multibytes Enable multibyte support in printf & friends --redirect orig=replacement Redirect symbol refs to replacement symbol --remarks Enable generation of remarks --scanf_multibytes Enable multibyte support in scanf & friends --search directory -L directory Look for object and library files in directory --semihosting[=iar_breakpoint] Link with debug interface. Specify interface to override default. --silent Silent operation --stack_usage_control file Read stack usage control file --strip Do not include debug information --text_out encoding Encoding to use for text output files utf8 UTF-8 utf16le Little-endian UTF-16 utf16be Big-endian UTF-16 locale Locale specific encoding --threaded_lib Configure runtime library for use with threads --timezone_lib Enable timezone and daylight savings support --treat_rvct_modules_as_softfp link softfp versions of math function for modules compiled with RVCT even though they are built with vfp calling-convention --use_full_std_template_names Don't use short names for standard C++ templates --use_optimized_variants no|auto|small|fast Use optimized variants of DLIB library functions no Do not use redirects to use optimized variants auto Use redirects based on attributes in object files (default) small Always use a small variant if available fast Always use a fast variant if available --utf8_text_in Non-source text input files with no BOM use UTF-8 encoding --version Output version information and exit --vfe=[forced] Perform Virtual Function Elimination forced Force the use of VFE for all modules with VFE information. --warnings_affect_exit_code Warnings affect exit code --warnings_are_errors All warnings are errors --whole_archive archive Link all modules in archive
The IAR ILINK linker (ilinkarm.exe) is used to build the final application. Typically, the linker requires the following information as input:
- Several target files, and possibly some libraries
- Program start label (default)
- Linker configuration file, which describes the placement of code and data in the memory of the target system
The following figure shows the linking process:
The IAR ILINK linker generates an absolute target file in ELF format that contains an executable image. After linking, you can use the generated absolute executable image
- Load into the IAR C-SPY debugger or any other compatible external debugger to read ELF and DWARF.
- Use flash / PROM programmer to program flash / PROM. Before that, you may have to use ielftool to convert the actual bytes in the image to the standard Motorola 32-bit S-record format or Intel Hex-32 format.
iarchive.exe
file management tool, similar to ar of ARM and ar of GCC. A library (archive) used to create and manipulate several ELF object files. The library file contains multiple relocatable ELF object modules, each of which can be used independently by the linker. Compared with the object modules directly assigned to the linker, each module in the library is included only when needed.
E:\Program Files (x86)\IAR Systems\Embedded Workbench 8.2\arm\bin>iarchive IAR Archive Tool V10.4.14.1149 Copyright 2008-2019 IAR Systems AB. Usage: iarchive [command] archive obj1 ... objN iarchive [command] obj1 ... objN -o archive iarchive [command] archive Available command line options: --create Create new archive --delete -d Delete module(s) from archive --extract -x Extract module(s) from archive -f file Read command line options from file --f file Read command line options from file and report dependency --no_bom Don't use a Byte Order Mark in Unicode output --output archive -o archive Name of archive file --replace -r Replace or add module(s) to archive --symbols List symbol table of archive --text_out encoding Encoding to use for text output files utf8 UTF-8 utf16le Little-endian UTF-16 utf16be Big-endian UTF-16 locale Locale specific encoding --toc -t List archive table of content --utf8_text_in Non-source text input files with no BOM use UTF-8 encoding --verbose -V verbose operation --version Output version information and exit --vtoc List archive table of content (verbose)
Use example:
- Use the source object file module1 o,module.2.o and module3 O# created a file named MyLibrary A's library file: iarchive MyLibrary a module1.o module2. o module3.o
- List MyLibrary Contents in a: iarchive -- TOC MyLibrary a
- This example replaces module3.o in the library with the content in the module3.o file and appends module4.o to mylibrary.a:iarchive --replace mylibrary.a module3.o module4.o
ielftool.exe
ARM ELF file tool, similar to ARM's from and GCC's elfedit. Perform various transformations (e.g., padding, checksum, format conversion, etc.) on ELF executable images. The ielftool source code (Microsoft Visual Studio Project) is available in the installation directory. \ ARM \ SRC \ elf utils. If you have specific requirements on how to generate checksum or format conversion, you can modify the source code accordingly.
E:\Program Files (x86)\IAR Systems\Embedded Workbench 8.2\arm\bin>iarchive IAR Archive Tool V10.4.14.1149 Copyright 2008-2019 IAR Systems AB. Usage: iarchive [command] archive obj1 ... objN iarchive [command] obj1 ... objN -o archive iarchive [command] archive Available command line options: --create Create new archive --delete -d Delete module(s) from archive --extract -x Extract module(s) from archive -f file Read command line options from file --f file Read command line options from file and report dependency --no_bom Don't use a Byte Order Mark in Unicode output --output archive -o archive Name of archive file --replace -r Replace or add module(s) to archive --symbols List symbol table of archive --text_out encoding Encoding to use for text output files utf8 UTF-8 utf16le Little-endian UTF-16 utf16be Big-endian UTF-16 locale Locale specific encoding --toc -t List archive table of content --utf8_text_in Non-source text input files with no BOM use UTF-8 encoding --verbose -V verbose operation --version Output version information and exit --vtoc List archive table of content (verbose) E:\Program Files (x86)\IAR Systems\Embedded Workbench 8.2\arm\bin>ielftool IAR ELF Tool V10.4.14.1149 [BUILT at IAR] Copyright 2007-2019 IAR Systems AB. Usage: ielftool input_file output_file Available command line options: --bin Save as raw binary --checksum sym:size,algo[:[1|2][a|m|z][r][R][o][x][i|p][W|L]][,start] ;range[;range...] Generate checksum sym Checksum symbol size Length of the symbol in bytes algo Algorithm: sum, sum8wide, sum32, crc16, crc32 crc64iso, crc64ecma or crc=poly 1|2 Complement: 1 or 2 a|m|z Reverse the bit order for: input bytes only: a input bytes and final checksum: m final checksum only: z o Output the Rocksoft model specification r Reverse the byte order within each word R Traverse the range(s) in reverse order x Toggle the endianess of the checksum i|p Use initial value normally: i Prefix input data with the start value: p W|L Use a checksum unit length of 2 bytes: W Use a checksum unit length of 4 bytes: L start Initial checksum value (defaults to 0) range Do checksum of bytes in range --fill [v;]pattern;range[;range...] Specify fill v Virtual fill, do not generate actual filler bytes. This can be used for checksums and parities. pattern Sequence of filler bytes range Fill range --front_headers Move program and section headers to the front of the ELF file. --ihex Save as 32-bit linear Intel Extended hex --offset [-]offset Add (subtract if - is used) offset to all address records. This only works for the output formats: Motorola S-records, Intel Hex, Simple-Code and TI-TXT --parity sym:size,algo:flashbase[:[r][[B|W|L]];range[;range...] Generate parity bits sym Parity symbol size Length of the symbol in bytes algo Parity algorithm: odd, even flashbase Ignore bytes before this address r Traverse the range(s) in reverse order B Use a parity unit length of 1 byte W Use a parity unit length of 2 bytes L Use a parity unit length of 4 bytes range Perform parity on bytes in this range --self_reloc relocator[,jtc] Create self-relocating image with relocator jtc Number of jump table entries --silent Silent operation --simple Save as Simple-code --simple-ne Save as Simple-code without entry record --srec Save as Motorola S-records --srec-len length Restrict the length of S-records --srec-s3only Restrict the type of S-records to S3 (and S7) --strip Remove all section headers and non-program sections --titxt Save as Texas Instruments TI-TXT --verbose Print all performed operations --version Output tool version
Use example:
- This example fills a memory range with 0xFF and then calculates a checksum on the same range:ielftool my_input.out my_output.out --fill 0xFF;0–0xFF --checksum __checksum:4,crc32;0–0xFF
ielfdumparm.exe
Dumper tool for files in ARM ELF format. objdump, similar to GCC, is used to create a text representation of ELF relocatable or executable image content. It is mainly used in the following three aspects:
- To produce a listing of the general properties of the input file and the ELF segments and ELF sections it contains. This is the default behavior when no command line options are used. Generates a list of general attributes of the input file and the elf segments and ELF sections it contains. This is the default behavior when command line options are not used.
- To also include a textual representation of the contents of each ELF section in the input file. To specify this behavior, use the command line option --all . It also includes a text representation of the contents of each elf section in the input file. To specify this behavior, use the command line option – all.
- To produce a textual representation of selected ELF sections from the input file. To specify this behavior, use the command line option --section to generate a text representation of the selected elf section from the input file. To specify this behavior, use the command line option – section
E:\Program Files (x86)\IAR Systems\Embedded Workbench 8.2\arm\bin>ielfdumparm IAR ELF Dumper V8.32.3.193 for ARM Copyright 2007-2019 IAR Systems AB. Usage: IElfDump input_file [output_file] Available command line options: -a All sections, except strtab sections --aarch64 Disassemble in Aarch64 mode if mode cannot be deduced by the image. --all Dump all sections --arm Disassemble in Arm mode if mode cannot be deduced by the image. --code Dump only code sections --disasm_data Use disassembly format for data sections -f file Read command line options from file --f file Read command line options from file and report dependency --no_bom Don't use a Byte Order Mark in Unicode output --no_header Do not produce a list header --no_rel_sections Do not output associated .rel sections --no_strtab Do not include strtab sections --no_utf8_in Non-IAR input files are by default assumed to use UTF-8 encoding unless this option is used. --output file -o file Name of text file to create --range A-B Disassemble only addresses in the specified range (from A to B). --raw Use raw text format --section #|name[,...] -s #|name[,...] Dump only section(s) with given numbers/names --source Include source in disassembled code in executables --text_out encoding Encoding to use for text output files utf8 UTF-8 utf16le Little-endian UTF-16 utf16be Big-endian UTF-16 locale Locale specific encoding --thumb Disassemble in thumb mode if mode cannot be deduced by the image. --use_full_std_template_names Don't use short names for standard C++ templates --utf8_text_in Non-source text input files with no BOM use UTF-8 encoding --version Output version information and exit
iobjmanip.exe
An operation tool for Object files in ARM ELF format. Used to perform low-level operations on ELF target files.
E:\Program Files (x86)\IAR Systems\Embedded Workbench 8.2\arm\bin>iobjmanip IAR Object File Manipulator V10.4.14.1149 Copyright 2009-2019 IAR Systems AB. Usage: iobjmanip <op1>[,...<opN>] <src> <dest> Available command line options: -f file Read command line options from file --f file Read command line options from file and report dependency --no_bom Don't use a Byte Order Mark in Unicode output --remove_file_path remove path information from file symbol --remove_section #|name remove matching section(s) --rename_section (#|name)=name rename matching section(s) --rename_symbol name=name rename matching symbol --strip strip debug information --text_out encoding Encoding to use for text output files utf8 UTF-8 utf16le Little-endian UTF-16 utf16be Big-endian UTF-16 locale Locale specific encoding --utf8_text_in Non-source text input files with no BOM use UTF-8 encoding --version Output version information and exit
Use example:
- This example renames the section .example in input.o to .example2 and stores the result in output.o:iobjmanip --rename_section .example=.example2 input.o output.o
isymexport.exe
Absolute symbol exporter. Export absolute symbols from ROM image files to use when linking additional applications.
E:\Program Files (x86)\IAR Systems\Embedded Workbench 8.2\arm\bin>isymexport IAR Absolute Symbol Exporter V10.4.14.1149 Copyright 2008-2019 IAR Systems AB. Usage: ISymExport input_file output_file Available command line options: --edit steering_file Show/hide/rename symbols --export_locals[=symbol_prefix] Export local variable and function symbols -f file Read command line options from file --f file Read command line options from file and report dependency --generate_vfe_header Generate vfe header section --no_bom Don't use a Byte Order Mark in Unicode output --ram_reserve_ranges[=symbol_prefix] Generate symbols to reserve all occupied RAM ranges --reserve_ranges[=symbol_prefix] Generate symbols to reserve all occupied ranges --show_entry_as[=name] Export the entry point of the program as name --text_out encoding Encoding to use for text output files utf8 UTF-8 utf16le Little-endian UTF-16 utf16be Big-endian UTF-16 locale Locale specific encoding --utf8_text_in Non-source text input files with no BOM use UTF-8 encoding --version Output version information and exit
iexe2obj.exe
IAR ELF relocates the object creator. Create a relocatable ELF target file from an executable ELF target file.
E:\Program Files (x86)\IAR Systems\Embedded Workbench 8.2\arm\bin>iexe2obj IAR ELF Exe to Object Tool V10.4.14.1149 Copyright 2008-2019 IAR Systems AB. Usage: IExe2Obj input_file output_file Available command line options: -f file Read command line options from file --f file Read command line options from file and report dependency --hide_symbols Hide all symbols in the image --keep_mode_symbols Keep mode symbols in the image --no_bom Don't use a Byte Order Mark in Unicode output --prefix prefix Set section/symbol name prefix --text_out encoding Encoding to use for text output files utf8 UTF-8 utf16le Little-endian UTF-16 utf16be Big-endian UTF-16 locale Locale specific encoding --utf8_text_in Non-source text input files with no BOM use UTF-8 encoding --version Output version information and exit --wrap function Create wrapper for function
GCC for ARM
the full name of GCC is GNU Compiler Collection. GCC is an integrated distribution of compilers for several major programming languages. These languages currently include C, C + +, Objective-C, Objective-C + +, Fortran, Ada, Go, and bright (HSAIL).
gcc was originally called GNU C Compiler because it could only process C language. gcc quickly expanded to handle C + +. Later, it expanded to support more programming languages, such as Fortran, Pascal, Objective-C, Java, Ada, Go and assembly languages on various processor architectures, so it was renamed GNU compiler suite (GNU Compiler Collection). After renaming, the original compiler for C language is also called gcc, and the compiler for C + + is called g + +.
GCC for arm is a compilation suite developed based on GCC and used to compile and generate ARM kernel executable files, commonly known as arm cross compilation suite. Compared with the above two expensive compilers, GCC for arm is free because it is based on open source GCC. At present, it is mainly provided by three mainstream tool providers, the first is arm, the second is Codesourcery, and the third is Linora. At present, we use the integrated development environment (IDE) for ARM chip. In addition to IAR and arm's own Keil and DS, most of them use GCC for ARM compiler!
First, let's take a look at the naming rules of the ARM cross compilation tool chain: arch [-vendor] [-os] [-(gnu)eabi] [-gcc]
- arch: architecture, such as ARM, MIPS
- Vendor: tool chain provider. If there is no vendor, use none instead;
- os: the target operating system. If there is no os support, use none instead
- eabi: Embedded Application Binary Interface
If there is no vendor and os support at the same time, use only one none instead. For example, none in arm none EABI means neither vendor nor os support. As mentioned earlier, GCC for ARM is developed based on GCC. Therefore, like GCC, it is a set of command-line tools. In theory, it can be integrated into any other integrated development environment without using the command line directly. The command line tools in GCC for ARM correspond to the command line tools in GCC. The functions are basically the same, but the name has changed!
Codesourcery Toolchain
codesourcery launched a product called Sourcery G++ Lite Edition, in which the command line based compiler is free and can be downloaded on the official website, and the IDE and debug tools contained therein are charged. Codesourcery (currently acquired by Mentor) is an arm cross compiling tool based on GCC, which can be used to cross compile ARM MCU chips, such as ARM7, ARM9 and Cortex-M/R chip programs.
at present, CodeSourcery has been acquired by Mentor graphics, so the original website style has been changed to Mentor style. After the goods are received, I don't know how to download its compilation tool chain...
- ARM none Linux gnueabi GCC: used to cross compile the codes of all links in the ARM (32-bit) system, including bare metal programs, u-boot, Linux kernel, filesystem and App applications.
- Arm none elf GCC: used to cross compile ARM MCU (32-bit) chips, such as ARM7, ARM9 and Cortex-M/R chip programs.
Linaro Toolchain
Linaro It is a non-profit Linux infrastructure software R & D business announced by six major manufacturers, such as ARM, Freescale, Samsung, St Ericsson, Texas Instruments (TI) and IBM, during the 2010 Taipei International Computer Exhibition. The ARM cross compilation tool based on GCC is shown in the figure below:
The download address is: https://www.linaro.org/downloads/ . It is not difficult to see from the above figure that the cross compilation environment provided by Linaro is only for the Cortex-A kernel, and other ARM kernels need to be downloaded from the ARM official website!
- Aarch64 Linux GNU: for the target platform is Linux system, it is used to cross compile bare metal programs, u-boot, Linux kernel, filesystem and App applications in ARMv8 64 bit target.
- ARM linux gnueabihf: for the target platform is the Linux system, it is used to cross compile the codes of all links in the ARM (32-bit) system, including bare metal programs, u-boot, Linux kernel, filesystem and App applications.
- ARM EABI GCC: bare metal system used to compile ARM architecture, including boot and kernel of ARM Linux. It is not suitable for compiling Linux Application
- Aarch64 ELF: bare metal system for compiling ARM v8 64 bit architecture, including boot and kernel of ARM Linux. It is not suitable for compiling Linux Application
as explained on the official website, the compiled binary executable compiler file officially released has only been tested on Linux system (Ubuntu LTS). At present, the official does not provide executable programs on other platforms!
ARM Toolchain
in addition to its own special compiler, ARM also maintains a set of GCC based cross compilation tool chain. It is estimated that it is to occupy the market more effectively! Most third-party ides use this cross compilation tool chain.
arm-none-eabi
bare metal systems used to compile ARM architecture (including boot and kernel of ARM Linux, which are not suitable for compiling Linux Application), so they do not support functions closely related to the operating system, such as fork. It uses newlib, a C library dedicated to embedded systems.
as part of its ongoing commitment to maintain and enhance gcc compiler support for ARM architecture, arm is maintaining a GNU tool chain. Its GCC source branch is for embedded ARM processors, namely, Cortex-R/Cortex-M processor series, covering Cortex-M0, Cortex-M3, Cortex-M4, Cortex-M0 +, Cortex-M7, Armv8-M baseline and mainline, Cortex-R4, Cortex-R5, Cortex-R7 and Cortex-R8.
as part of this, arm regularly releases pre built and test binaries from the ARM embedded branch. These improvements can be integrated into the third-party tool chain for free or downloaded directly by end users. The complete tool chain consists of the following components:
- gcc : gcc-8-branch revision 267074
svn://gcc.gnu.org/svn/gcc/branches/gcc-8-branch - binutils : 2.31 with mainline backports
git://sourceware.org/git/binutils-gdb.git commit fe554d200d1befdc3bddc9e14f8593ea3446c351 - newlib and newlib-nano :
git://sourceware.org/git/newlib-cygwin.git commit df6915f029ac9acd2b479ea898388cbd7dda4974 - gdb : 8.2 without target sim support
git://sourceware.org/git/binutils-gdb.git commit fe554d200d1befdc3bddc9e14f8593ea3446c351
at present, it is maintained and developed by ARM. Use launchpad to maintain the source code of the project. However, As previously announced all new binary and source packages will not be released on Launchpad henceforth, they can be found on:
https://developer.arm.com/open-source/gnu-toolchain/gnu-rm. ”), only from the ARM official website: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads Download. Here is, Release timeline:
This is the most commonly used cross compiling tool chain when we write ARM bare metal programs! After installation / decompression, the directory is shown in the following figure:
The tools in the compiler tool are not much different from the standard GCC, mainly because the platform has changed. The functions of each tool are the same! For example: arm none EABI GCC Exe is a C language compiler, arm-none-eabi-g + + Exe is a C + + compiler, arm-none-eabi-ld Exe is a connector, arm-none-eabi-gdb Exe} is a debugger and so on.
Cortex-A special
the above cross compilation tool chain only supports ARM Cortex-M/R series cores. The ARM official website also provides a cross compilation tool chain for ARM Cortex-A series cores, which can be downloaded from the following address
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads . The details are as follows:
It should be noted that the full name in the red box in the above figure is the name of the compilation tool chain. Take gcc-arm-8.3-2019.03-i686-mingw32-arm-eabi as an example. After decompression, it is shown in the following figure:
Command line tools are no different from standard GCC!
another thing to note is that the i686 mingw32 host in the above figure specifies that the running platform is Windows 7 32/64 bits or later; x86_64 host specifies that the running platform is Ubuntu 14.04 LTS x86_64 or later or RHEL 6 x86_64. In other words, only windows and Linux platforms are supported! The kit consists of the following components:
Another thing to note is the target platform of the compiler.
- Aarch32 bare metal target: 32-bit bare metal platform
- Aarch64 elf bare metal target: 64 bit bare metal platform
- Aarch64 elf bare metal, big endian target: 64 bit bare metal platform (big end mode)
- AArch64 GNU/Linux target: 64 bit Linux platform
- Aarch64 GNU / Linux big endian target: 64 bit Linux platform (big end mode)
- AArch32 target with soft float: 32-bit floating-point operation with software mode
- AArch32 target with hard float: 32-bit floating-point operation with hardware mode
reference resources
- https://www.veryarm.com/