收藏 分享(赏)

汽车编程-TASKING VX-toolset for PCP User Guide.pdf

上传人:软件交流联系1171677800 文档编号:6256933 上传时间:2022-07-27 格式:PDF 页数:660 大小:4.14MB
下载 相关 举报
汽车编程-TASKING VX-toolset for PCP User Guide.pdf_第1页
第1页 / 共660页
汽车编程-TASKING VX-toolset for PCP User Guide.pdf_第2页
第2页 / 共660页
汽车编程-TASKING VX-toolset for PCP User Guide.pdf_第3页
第3页 / 共660页
汽车编程-TASKING VX-toolset for PCP User Guide.pdf_第4页
第4页 / 共660页
汽车编程-TASKING VX-toolset for PCP User Guide.pdf_第5页
第5页 / 共660页
亲,该文档总共660页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、TASKING VX-toolset for PCPUser GuideMA161-800 (v6.2r2) March 06, 2018Copyright 2018 TASKING BV.All rights reserved.You are permitted to print this document provided that (1) the use of such is for personal use onlyand will not be copied or posted on any network computer or broadcast in any media, an

2、d (2) no modifications of thedocument is made. Unauthorized duplication, in whole or part, of this document by any means, mechanical or electronic,including translation into another language, except for brief excerpts in published reviews, is prohibited without theexpress written permission of TASKI

3、NG BV. Unauthorized duplication of this work may also be prohibited by localstatute.Violators may be subject to both criminal and civil penalties, including fines and/or imprisonment. Altium,TASKING, and their respective logos are registered trademarks of Altium Limited or its subsidiaries. All othe

4、r registeredor unregistered trademarks referenced herein are the property of their respective owners and no trademark rights tothe same are claimed.Table of Contents1. C Language . 11.1. Data Types . 11.1.1. Changing the Alignment: _align() . 31.2. Accessing Memory . 31.2.1. Memory Type Qualifiers .

5、 31.2.2. Pointers . 41.2.3. Placing an Object at an Absolute Address: _at() . 51.2.4. Accessing Hardware from C . 61.3. Shift JIS Kanji Support . 71.4. Using Assembly in the C Source: _asm() . 81.5. Attributes . 141.6. Pragmas to Control the Compiler . 181.7. Predefined Preprocessor Macros . 221.8.

6、Switch Statement . 241.9. Functions . 251.9.1. Calling Convention . 251.9.2. Register Usage . 261.9.3. Inlining Functions: inline . 261.9.4. Interrupt Functions . 281.9.5. Intrinsic Functions . 301.10. PCP Code Generation . 371.10.1. Non-interruptible Code Generation . 381.10.2. Interruptible Code G

7、eneration . 381.11. Compiler Generated Sections . 411.11.1. Rename Sections . 422. Assembly Language . 452.1. Assembly Syntax . 452.2. Assembler Significant Characters . 462.3. Operands of an Assembly Instruction . 472.4. Symbol Names . 472.4.1. Predefined Preprocessor Symbols . 482.5. Registers . 4

8、82.5.1. Special Function Registers . 492.6. Assembly Expressions . 492.6.1. Numeric Constants . 502.6.2. Strings . 502.6.3. Expression Operators . 512.7.Working with Sections . 522.8. Built-in Assembly Functions . 532.9. Assembler Directives and Controls . 652.9.1. Assembler Directives . 662.9.2. As

9、sembler Controls . 1132.10. Macro Operations . 1252.10.1. Defining a Macro . 1252.10.2. Calling a Macro . 1252.10.3. Using Operators for Macro Arguments . 1262.11. Generic Instructions . 1303. Using the C Compiler . 133iii3.1. Compilation Process . 1333.2. Calling the C Compiler . 1343.3.The C Start

10、up Code . 1363.4. How the Compiler Searches Include Files . 1373.5. Compiling for Debugging . 1373.6. Compiler Optimizations . 1383.6.1. Generic Optimizations (frontend) . 1393.6.2. Core Specific Optimizations (backend) . 1423.6.3. Optimize for Code Size or Execution Speed . 1433.6.4. Static Stack A

11、lignment Optimizations . 1463.7. Static Code Analysis . 1473.7.1. C Code Checking: CERT C . 1483.7.2. C Code Checking: MISRA C . 1503.8. C Compiler Error Messages . 1514. Using the Assembler . 1534.1. Assembly Process . 1534.2. Calling the Assembler . 1544.3. How the Assembler Searches Include Files

12、 . 1554.4. Assembler Optimizations . 1564.5. Generating a List File . 1564.6. Assembler Error Messages . 1575. Using the Linker . 1595.1. Linking Process . 1595.1.1. Phase 1: Linking . 1615.1.2. Phase 2: Locating . 1625.2. Calling the Linker . 1635.3. Linking with Libraries . 1645.3.1. How the Linke

13、r Searches Libraries . 1665.3.2. How the Linker Extracts Objects from Libraries . 1675.4. Incremental Linking . 1675.5. Importing Binary Files . 1685.6. Linker Optimizations . 1695.7. Controlling the Linker with a Script . 1705.7.1. Purpose of the Linker Script Language . 1705.7.2. Eclipse and LSL .

14、 1715.7.3. Structure of a Linker Script File . 1735.7.4. The Architecture Definition . 1775.7.5. The Derivative Definition . 1795.7.6. The Processor Definition . 1825.7.7.The Memory Definition . 1825.7.8.The Section Layout Definition: Locating Sections . 1845.8. Linker Labels . 1855.9. Generating a

15、Map File . 1885.10. Linker Error Messages . 1896. Using the Utilities . 1916.1. Control Program . 1916.2. Make Utility amk . 1936.2.1. Makefile Rules . 1936.2.2. Makefile Directives . 1956.2.3. Macro Definitions . 195ivTASKING VX-toolset for PCP User Guide6.2.4. Makefile Functions . 1986.2.5. Condit

16、ional Processing . 1986.2.6. Makefile Parsing . 1996.2.7. Makefile Command Processing . 2006.2.8. Calling the amk Make Utility . 2016.3. Make Utility mkpcp . 2026.3.1. Calling the Make Utility . 2036.3.2. Writing a Makefile . 2046.4. Archiver . 2136.4.1. Calling the Archiver . 2136.4.2. Archiver Exa

17、mples . 2156.5. Expire Cache Utility . 2177. Using the Debugger . 2197.1. Reading the Eclipse Documentation . 2197.2. Debugging a PCP Project . 2197.3. Creating a Customized Debug Configuration . 2207.4. Troubleshooting . 2277.5.TASKING Debug Perspective . 2277.5.1. Debug View . 2287.5.2. Breakpoint

18、s View . 2307.5.3. File System Simulation (FSS) View . 2317.5.4. Disassembly View . 2327.5.5. Expressions View . 2327.5.6. Memory View . 2337.5.7. Compare Application View . 2347.5.8. Heap View . 2347.5.9. Logging View . 2357.5.10. RTOS View . 2357.5.11. Registers View . 2357.5.12.Trace View . 2367.

19、6. PCP Simulator Configuration . 2378. Tool Options . 2398.1. Configuring the Command Line Environment . 2438.2. C Compiler Options . 2458.3. Assembler Options . 3118.4. Linker Options . 3498.5. Control Program Options . 3938.6. Make Utility Options . 4438.7. Parallel Make Utility Options . 4718.8.

20、Archiver Options . 4858.9. Expire Cache Utility Options . 5009. Influencing the Build Time . 5119.1. SFR File . 5119.2. MIL Linking . 5119.3. Optimization Options . 5119.4. Automatic Inlining . 5129.5. Code Compaction . 5129.6. Compiler Cache . 5129.7. Header Files . 5139.8. Parallel Build . 513vTAS

21、KING VX-toolset for PCP User Guide10. Libraries . 51510.1. Library Functions . 51610.1.1. assert.h . 51610.1.2. complex.h . 51610.1.3. cstart.h . 51710.1.4. ctype.h and wctype.h . 51710.1.5. dbg.h . 51810.1.6. errno.h . 51910.1.7. except.h . 52010.1.8. fcntl.h . 52010.1.9. fenv.h . 52010.1.10. float

22、.h . 52110.1.11. inttypes.h and stdint.h . 52210.1.12. io.h . 52210.1.13. iso646.h . 52310.1.14. limits.h . 52310.1.15. locale.h . 52310.1.16. malloc.h . 52310.1.17. math.h and tgmath.h . 52410.1.18. setjmp.h . 52810.1.19. signal.h . 52810.1.20. stdarg.h . 52910.1.21. stdbool.h . 52910.1.22. stddef.

23、h . 52910.1.23. stdint.h . 53010.1.24. stdio.h and wchar.h . 53010.1.25. stdlib.h and wchar.h . 53810.1.26. string.h and wchar.h . 54110.1.27. time.h and wchar.h . 54310.1.28. unistd.h . 54510.1.29. wchar.h . 54610.1.30. wctype.h . 54710.2. C Library Reentrancy . 54811. List File Formats . 55911.1.

24、Assembler List File Format . 55911.2. Linker Map File Format . 56012. Linker Script Language (LSL) . 56512.1. Structure of a Linker Script File . 56512.2. Syntax of the Linker Script Language . 56712.2.1. Preprocessing . 56712.2.2. Lexical Syntax . 56812.2.3. Identifiers and Tags . 56912.2.4. Expres

25、sions . 56912.2.5. Built-in Functions . 57012.2.6. LSL Definitions in the Linker Script File . 57212.2.7. Memory and Bus Definitions . 57312.2.8. Architecture Definition . 57512.2.9. Derivative Definition . 57712.2.10. Processor Definition and Board Specification . 57812.2.11. Section Setup . 578viT

26、ASKING VX-toolset for PCP User Guide12.2.12. Section Layout Definition . 57912.3. Expression Evaluation . 58412.4. Semantics of the Architecture Definition . 58412.4.1. Defining an Architecture . 58512.4.2. Defining Internal Buses . 58612.4.3. Defining Address Spaces . 58612.4.4. Mappings . 58912.5.

27、 Semantics of the Derivative Definition . 59212.5.1. Defining a Derivative . 59312.5.2. Instantiating Core Architectures . 59312.5.3. Defining Internal Memory and Buses . 59412.6. Semantics of the Board Specification . 59612.6.1. Defining a Processor . 59612.6.2. Instantiating Derivatives . 59712.6.

28、3. Defining External Memory and Buses . 59712.7. Semantics of the Section Setup Definition . 59812.7.1. Setting up a Section . 59912.8. Semantics of the Section Layout Definition . 60012.8.1. Defining a Section Layout . 60112.8.2. Creating and Locating Groups of Sections . 60212.8.3. Creating or Mod

29、ifying Special Sections . 60812.8.4. Creating Symbols . 61212.8.5. Conditional Group Statements . 61213. Debug Target Configuration Files . 61513.1. Custom Board Support . 61513.2. Description of DTC Elements and Attributes . 61613.3. Special Resource Identifiers . 61913.4. Initialize Elements . 619

30、14. CPU Problem Bypasses and Checks . 62115. CERT C Secure Coding Standard . 62515.1. Preprocessor (PRE) . 62515.2. Declarations and Initialization (DCL) . 62615.3. Expressions (EXP) . 62715.4. Integers (INT) . 62815.5. Floating Point (FLP) . 62815.6. Arrays (ARR) . 62915.7. Characters and Strings (

31、STR) . 62915.8. Memory Management (MEM) . 62915.9. Environment (ENV) . 63015.10. Signals (SIG) . 63015.11. Miscellaneous (MSC) . 63116. MISRA C Rules . 63316.1. MISRA C:1998 . 63316.2. MISRA C:2004 . 63716.3. MISRA C:2012 . 645viiTASKING VX-toolset for PCP User GuideviiiTASKING VX-toolset for PCP Us

32、er Guide软件下载:https:/ 提取码:uo1z Chapter 1. C LanguageThis chapter describes the target specific features of the C language, including language extensions thatare not standard in ISO-C. For example, pragmas are a way to control the compiler from within the Csource.The TASKING C compiler(s) fully suppor

33、t the ISO-C standard and add extra possibilities to program thespecial functions of the target.In addition to the standard C language, the compiler supports the following: keywords to specify memory types for data and functions attribute to specify alignment and absolute addresses intrinsic (built-i

34、n) functions that result in target specific assembly instructions pragmas to control the compiler from within the C source predefined macros the possibility to use assembly instructions in the C source keywords for inlining functions and programming interrupt routines librariesAll non-standard keywo

35、rds have two leading underscores (_).In this chapter the target specific characteristics of the C language are described, including the abovementioned extensions.1.1. Data TypesThe C compiler supports the ISO C99 defined data types.The sizes of these types are shown in thefollowing table.LimitsAlign

36、SizeC Type0 or 13232_Bool-27, 27-1-231, 231-1832832_far _mau8 signed char *signed char0, 28-10, 232-1832832_far _mau8 unsigned char *unsigned char-215, 215-1-231, 231-116321632_far _mau8 short *short0, 216-10, 232-116321632_far _mau8 unsigned short *unsigned short1LimitsAlignSizeC Type-231, 231-1323

37、2int0, 232-13232unsigned int-231, 231-13232enum-231, 231-13232long0, 232-13232unsigned long-231, 231-13232long long0, 232-13232unsigned long long3.402E+38, 1.175E-38+1.175E-38, +3.402E+383232float (23-bit mantissa)3.402E+38, 1.175E-38+1.175E-38, +3.402E+383232doublelong double (23-bit mantissa)0, 21

38、4-10, 216-10, 232-13232pointer to data *pointer to function (code pointer) *_far pointer *You can use the type qualifier _mau8 only on objects that have the _far qualifier, becauseonly objects located in the FPI space can have byte access.* Pointers are calculated using 32-bit arithmetic and compare

39、d as 14-bit values (data pointers),16-bit values (code pointers) or 32-bit values (_far pointers).Aggregate and Union TypesAggregate types are aligned on 32 bits by default. All members of the aggregate types are aligned asrequired by their individual types as listed in the table above.The struct/un

40、ion data types may containbit-fields.The allowed bit-field fundamental data types are _Bool, (un)signed char and (un)signedint.The maximum bit-field size is equal to that of the types size. For the bit-field types the same rulesregarding to alignment and signed-ness apply as specified for the fundam

41、ental data types. In addition,the following rules apply: The first bit-field is stored at the least significant bits. Subsequent bit-fields fill the higher significant bits. A bit-field of a particular type cannot cross a boundary as is specified by its maximum width. For example,a bit-field of type

42、 int cannot cross a 32-bit boundary. Bit-fields share a storage unit with other bit-field members if and only if there is sufficient space in thestorage unit. An unnamed bit-field creates a gap that has the size of the specified width. As a special case, anunnamed bit-field having width 0 (zero) pre

43、vents any further bit-field from residing in the storage unitcorresponding to the type of the zero-width bit-field.2TASKING VX-toolset for PCP User Guide1.1.1. Changing the Alignment: _align()By default the PCP compiler aligns objects to the minimum alignment required by the architecture.Withthe att

44、ribute _align() you can change the object alignment that is located in the FPI space. Objectsqualified with _far are located in the FPI space.The alignment must be a power of two. _align()has no effect on object located in the PRAM space of the PCP.Example:int _align( 8 ) _far src4;The compiler gene

45、rates the following assembly:.sdecl .bss.linear, data, linear, clear.sect .bss.linear.global _PCP_src.align 8_PCP_src:.type object.size _PCP_src,16.space 16Instead of the attribute _align() you can also use #pragma align.1.2. Accessing MemoryYou can use static memory type qualifiers to allocate stat

46、ic objects in a particular part of the addressingspace of the processor.In addition, you can place variables at absolute addresses with the keyword _at().1.2.1. Memory Type QualifiersIn the C language you can specify that a variable must lie in a specific part of memory.You can do thiswith a memory

47、type qualifier. If you do not specify a memory type qualifier, data objects get a defaultmemory type.You can specify the following memory type qualifiers:SectiontypePointerarithmeticPointersizeMaximumobject sizeLocationDescriptionQualifierdata14-bit32-bit64 kBPRAM spaceData_nearlinear32-bit32-bit4 G

48、BFPI spaceFar data_far *linear32-bit32-bit8-bit or 16-bitFPI spaceAllow 8-bit or16-bit dataallocation_far_mau83C Language*If you do not specify _far, the compiler chooses where to place the declared object.Data objects are located by default in the PRAM space of the PCP (_near is the default).TheMem

49、ory Access Unit (MAU) of PRAM is 32-bit. All objects located in the PRAM always have asize of 32 bits.Data objects that are qualified _far are located in the FPI space.The FPI space is the TriCore linearaddress space.The Memory Access Unit (MAU) of the FPI is 8-bit. By default the object size of _fa

50、rqualified objects is 32-bit, because the default data type size is 32-bits on the PCP for PRAM and FPI._far data objects with type char or short can have type modifier _mau8 to allow 8-bit and 16-bitdata allocation on the FPI. FPI instructions are generated to access objects that are qualified _far

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 服装首饰

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:文库网官方知乎号:文库网

经营许可证编号: 粤ICP备2021046453号世界地图

文库网官网©版权所有2025营业执照举报