|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
本帖最后由 uperrua 于 2020-9-2 15:46 编辑
6 D$ i' X; @! }4 \% R8 X! `2 m3 v" H6 f
IAR- {5 Z" I5 Y- V/ M' \+ `' ~
相比于 ARM 对于编译器的灵活安装,IAR 的编译器则只跟随其 IDE 发布,编译器不独立提供。IAR 安装后,目录就是下面这个样子了:
7 R. |9 R4 }& _- v3 s- c" F0 m
# z' f' D ~' p1 ?8 D6 K
0 w1 k1 l! S2 P: J" m% ^0 A
" j6 j" E* S9 F7 ~/ f3 d
这里我们重点关注一下arm目录下的相关内容。其中内容有很多,这里主要介绍一下编译器相关的那些,首先看下图' s1 ?: j- u2 u/ N! Q9 p3 A) G4 s
2 _) i2 G4 k& m5 q
( \( I2 v' U/ x3 `; p E
3 }( q* e, r+ l4 C3 ^6 |
我们可以手动提取其编译器,来作为命令行工具使用。但是对于 IAR 还是不建议这么用,个人感觉 IAR 在设计时,估计没考虑过让用户使用命令行模式来独立使用编译套件,因为其编译套件和其他好多东西都放在了一个目录中,不像ARM 将编译套件独立存放。但是,IAR 的编译套件是支持命令行使用的 ,在其介绍文档中有这么一句话: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. 官方的介绍文档主要就是《 IAR C/C++ Development Guide Compiling and Linking》。
2 ?( I. \/ c) i
& N! ?4 `$ _: z1. IAR 我用的比较少,主要内容来自于官方文档。管方文档更加详细,如有疑问直接去官方文档查看即可!官方文档目录为 IAR安装目录\arm\doc。具体如下:% @4 j4 y) d9 r3 ^0 F) [
- 《 IAR C/C++ Development Guide Compiling and Linking》,文档名为 EWARM_DevelopmentGuide.ENU.pdf
- 《IAR Assembler Reference Guide》,文档名为 EWARM_AssemblerReference.ENU.pdf
- 《C-STAT® Static Analysis Guide》,文档名为 EW_MisraC1998Reference.ENU.pdf
7 W0 v4 d, R6 g 2. 还可以直接从 IAR 的 IDE 的菜单进入:菜单 -> help0 ]" N3 R! v/ R9 n) e+ P
: ?7 t3 ?# _3 c5 f; L& S
' j/ s# k9 A y8 W+ u8 O4 N2 d
: v. t G3 h% J' r1 |1 \
/ @1 T9 e9 k( ~1 J5 r: Liasmarm.exe* y' d- d$ A Z6 |
这个是 IAR 的汇编语言的编译器。官方文档是这么介绍的: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是一个功能强大的重定位宏汇编程序,具有多种指令和表达式运算符。 汇编程序具有内置的C语言预处理程序,并支持条件汇编。该工具官方有个独立的说明文档《IAR Assembler Reference Guide》,里面有该工具的详细使用说明。4 R. b0 v$ s" ?9 E+ N( X6 u- x1 {
; X4 V, g `+ ]4 A# \
- 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 exit5 l: K1 d) @, H6 ^, ^8 o! E2 o$ ^
z+ |; F$ ^: C+ S% f& y$ `& A
% I% w2 S! }5 x0 Y, q
iccarm.exe
4 ^& f, W- v2 {4 i$ D 这个是 IAR 的 C/C++ 编译器。官方文档是这么介绍的: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是一个最先进的编译器,提供C和C ++语言的标准功能,以及旨在利用Arm特定功能的扩展。- O2 w: e4 o" g0 u3 t
默认使用的头文件目录.\arm\inc\<vendor>
! ^# j) W4 x9 U; n: `+ T
1 o! }% A* X; K1 @6 r- 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][lw] 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] 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++
; z+ k; P, Z& V+ M . `' r! |4 Y1 _3 U1 A4 F
7 H; J2 w4 @) l1 S* cIDE中有两个工具可将应用程序源文件转换为中间文件目标文件。 IAR C / C ++编译器和IAR汇编器。 两者都产生行业标准格式ELF中的可重定位目标文件,包括DWARF调试信息的格式。下图显示了编译过程:5 a# ^0 O1 \- v! ]( M4 T- l" a
- P* ^+ O' u. W% [5 ]
$ ]2 M# [- V7 z* ~4 G, N
0 u2 N4 D% t% D4 V9 |1 x/ v7 p/ n8 ^& @" e O k3 C( D
ilinkarm.exe
$ @& q: t2 w9 q 这个是 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是一款功能强大,灵活的软件工具,可用于嵌入式控制器应用程序的开发。 它同样适用于链接小型,单文件,绝对汇编程序,因为它用于链接大型可重定位输入,多模块,C / C ++或混合C / C ++和汇编程序。
2 J! k( N% Z2 R ilinkarm 使用并生成行业标准的ELF和DWARF作为对象格式文件。在.\arm\config目录下,包含了针对各平台的连接器使用的配置文件。
& x" G) \/ s1 B Q$ H1 W6 @, [4 s( i3 H- b0 g( W
- 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][lw] 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! |& @: D! q" X3 ^- }
$ c8 a* r6 B0 }7 w- F
# ?5 o& K' e+ K7 M W# S9 vIAR ILINK链接器(ilinkarm.exe)用于构建最终应用程序。通常,链接器需要以下信息作为输入:
! t5 S C* e: k' H6 W6 S3 z7 V: [0 A J+ G0 L m
- 几个目标文件,可能还有某些库
- 程序开始标签(默认设置)
- 链接器配置文件,用于描述目标系统内存中代码和数据的放置$ H, V6 d9 e8 d2 M2 b& I+ P' Z7 ?
' L x, H2 Q! ?4 ?! Q下图显示了链接过程:
$ f$ N) u) C$ M. Y \: u5 ]* T5 P+ T! Y* N6 O
" r4 M; r# j; h- `- ]
+ y, {6 A, z5 C' y( g' ZIAR ILINK链接器生成ELF格式的绝对目标文件,其中包含可执行镜像。 链接后,可以使用生成的绝对可执行映像
$ D k( A- T5 V1 H5 V% K
- c( l; n, ?% w/ F8 {- 加载到IAR C-SPY调试器或任何其他兼容的外部调试器读取ELF和DWARF。
- 使用flash / PROM编程器对flash / PROM进行编程。 在此之前可能必须使用ielftool将镜像中的实际字节转换为标准的Motorola 32-bit S-record 格式或Intel Hex-32格式。8 s1 B8 Z; p9 A- m
4 n3 p; |8 d$ E
; C8 Q0 y1 m2 V4 g( f3 C6 @% ?" Q
iarchive.exe% b. L5 U% y3 ?6 A! Z" Y
档案管理工具,类似于 ARM 的 armar 和 GCC 的 ar。用于创建和操作几个ELF目标文件的库(存档)。库文件包含多个可重定位的ELF对象模块,每个模块都可以由链接器独立使用。 与直接指定给链接器的对象模块相比,只有在需要时才包含库中的每个模块。
9 B( [& N5 a" o: T) p, ?# O. i$ s+ ^+ N) k
- 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)5 ^$ X: X6 n3 E/ t4 C: \7 U
|/ u2 D# u0 m/ |7 k( J
) Z- L& q: J$ r2 D1 D8 a7 m使用示例:
4 L9 V9 O8 L- n. i) `$ r# g& X3 J/ s/ [- m( h
- 使用源对象文件module1.o、module.2.o和module3.o 创建了一个名为mylibrary.a的库文件:iarchive mylibrary.a module1.o module2.o module3.o
- 列出 mylibrary.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( [$ D4 X+ H7 w+ i( H8 T, b1 z. A. F
3 R9 ]: A- B6 L! k" p* G9 N
4 ^5 J) |" q& U: j2 w, a" @0 Q
ielftool.exe
: ~% F/ r7 p- m0 P( e+ G. aARM ELF文件工具,类似于 ARM 的 fromelf 和 GCC 的 elfedit。对ELF可执行映像执行各种转换(例如,填充,校验和,格式转换等)。安装目录.\arm \ src\elfutils下提供了 ielftool 源代码(Microsoft VisualStudio项目)。 如果对如何生成校验和或格式转换要求有特定要求,则可以相应地修改源代码。- u6 U- C* Q( u6 J5 G$ r, B8 w. Z
* t; M/ f# q& {# @) v+ i1 |. i8 I
- 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
R# T! x1 f& q
1 H: a2 p* Z( T% C% D" a- H7 \3 u% s. V
8 |7 ~; s) k8 u/ S$ C: p7 T9 Q6 A0 R- |$ ^( ]
使用示例:
. m! Q. e( r6 l
3 d' v( _ K# c9 Q3 s a2 A. Q' t- 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–0xFF2 U* E& ]* w# n5 g
7 z- I! j& b7 A$ }. [
+ x8 n: i/ Q; o, I# m) p/ Mielfdumparm.exe4 Y6 \" B, h- E
针对 ARM ELF 格式的文件的 Dumper工具。类似于 GCC 的 objdump,用于创建ELF可重定位或可执行映像内容的文本表示。主要用于以下三个方面:
8 P: o& P4 k \( L
; [" N% o0 k* K# P% D1 a- 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.生成输入文件的常规属性列表以及它包含的ELF段和ELF节。 当没有使用命令行选项时,这是默认行为。
- 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 .还包括输入文件中每个ELF部分内容的文本表示。 要指定此行为,请使用命令行选项–all。
- To produce a textual representation of selected ELF sections from the input file. To specify this behavior, use the command line option --section 从输入文件生成所选ELF节的文本表示。 要指定此行为,请使用命令行选项–section9 u9 f: T; n1 q) q0 S
1 m4 Y9 }$ M; e% p2 A6 `7 }
% r/ z. t8 w& @! l! P o- 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 exit2 X6 U* ^9 z5 ^% R0 O
4 i/ N, L' H D* ]4 y6 n( \' w$ ^" \" @! j
iobjmanip.exe
C, K2 c6 n4 U: l- ~: y' U8 T针对 ARM ELF 格式的 Object 文件的操作工具。用于执行ELF目标文件的低级操作。" k8 _3 v" j2 e
, @- q# Z% @+ |9 i$ R J5 B
- 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/ f" v( m/ e6 H) a
5 v7 Q) x! E4 O0 G' O, X6 U. H( ?
; c7 w" d" I1 M5 |- }/ \$ h% V使用示例:
8 t H, I4 f, V; F7 i
$ L8 F- I! u& h. l- 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
, X7 _1 ]) k1 V6 c9 E' O# V ) Z: O+ z3 {4 i$ G( G
5 n- {$ b% n& T f+ o) ]isymexport.exe
! n: A6 l# k+ ]0 P绝对符号导出器。 从ROM映像文件中导出绝对符号,以便在链接附加应用程序时使用它们。
' r, @" [. u8 d$ L# L5 {# w2 i2 Y, x+ K# s* x+ ~* J$ Q
- 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# G. j0 D7 w# x3 ^/ v5 e
3 p5 F% d" r+ l( j/ {- _5 W
: j6 M2 U# f2 f% Biexe2obj.exe, w1 {3 b; J4 J4 g, Y
IAR ELF可重定位对象创建器。从可执行的ELF目标文件创建可重定位的ELF目标文件。) r, ^) T# ^2 }+ w/ N! c/ v
, R6 ~$ l7 F8 m& v5 f' I3 u/ y% |
- 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
: @0 p8 ~. X/ u# e0 |& r$ V
- v& w. G* q x
4 `+ O5 ?3 [- R# ]' K$ {
8 O0 P3 f- i+ F f8 I |' D |
|