TR0130 Nios II Embedded Tools Reference
Total Page:16
File Type:pdf, Size:1020Kb
Nios II Embedded Tools Reference TR0130 Dec 01, 2009 Software, hardware, documentation and related materials: Copyright E 2008 Altium Limited. All Rights Reserved. The material provided with this notice is subject to various forms of national and international intellectual property protection, including but not limited to copyright protection. You have been granted a non-exclusive license to use such material for the purposes stated in the end-user license agreement governing its use. In no event shall you reverse engineer, decompile, duplicate, distribute, create derivative works from or in any way exploit the material licensed to you except as expressly permitted by the governing agreement. Failure to abide by such restrictions may result in severe civil and criminal penalties, including but not limited to fines and imprisonment. Provided, however, that you are permitted to make one archival copy of said materials for back up purposes only, which archival copy may be accessed and used only in the event that the original copy of the materials is inoperable. Altium, Altium Designer, Board Insight, DXP, Innovation Station, LiveDesign, NanoBoard, NanoTalk, OpenBus, P-CAD, SimCode, Situs, TASKING, and Topological Autorouting and their respective logos are trademarks or registered trademarks of Altium Limited or its subsidiaries. All other registered or unregistered trademarks referenced herein are the property of their respective owners and no trademark rights to the same are claimed. v8.0 31/3/08 Table of Contents Table of Contents C Language 1-1 1.1 Introduction . .. .. .. .. .. .. 1-1 1.2 Data Types . .. .. .. .. .. .. 1-2 1.2.1 Changing the Alignment: __unaligned, __packed__ and __align(). 1-2 1.3 Memory Qualifiers . 1-3. 1.3.1 Placing an Object at an Absolute Address: __at(). .1-4 1.4 Using Assembly in the C Source: __asm(). 1-4. 1.5 Pragmas to Control the Compiler. 1-7 . 1.6 Predefined Preprocessor Macros. 1-11 . 1.7 Functions . .. .. .. .. .. .. 1-12 1.7.1 Parameter Passing . 1-12. 1.7.2 Function Return Types. 1-12 . 1.7.3 Inlining Functions: inline / __noinline. .1-13 . 1.7.4 Intrinsic Functions . 1-14. 1.7.5 Interrupt Functions . 1-15. 1.7.5.1 Defining an Interrupt Service Routine: __interrupt keyword. 1-15 1.8 Libraries . .. .. .. .. .. .. 1-15 1.8.1 Printf and Scanf Routines. 1-15. C++ Language 2-1 2.1 Introduction . .. .. .. .. .. .. 2-1 2.2 C++ Language Extension Keywords. 2-1 . 2.3 C++ Dialect Accepted . .2-1 . 2.3.1 Standard Language Features Accepted. 2-1. 2.3.2 C++0x Language Features Accepted. .2-3 . 2.3.3 Anachronisms Accepted. .2-4 . 2.3.4 Extensions Accepted in Normal C++ Mode. 2-4. 2.4 GNU Extensions . .. .. 2-5. 2.5 Namespace Support . .2-13 . 2.6 Template Instantiation . .2-14 . 2.6.1 Automatic Instantiation. 2-14 . 2.6.2 Instantiation Modes . 2-15. 2.6.3 Instantiation #pragma Directives. 2-16. 2.6.4 Implicit Inclusion . .. .. 2-17. 2.6.5 Exported Templates . 2-18. 2.6.5.1 Finding the Exported Template Definition. 2-18. 2.6.5.2 Secondary Translation Units. 2-19. 2.6.5.3 Libraries with Exported Templates. 2-19 . 2.7 Inlining Functions . .. 2-20. 2.8 Extern Inline Functions. 2-20 . 2.9 Pragmas to Control the C++ Compiler. 2-21. 2.10 Predefined Macros . 2-22. 2.11 Precompiled Headers . .2-24 . 2.11.1 Automatic Precompiled Header Processing. 2-24. 2.11.2 Manual Precompiled Header Processing. 2-26. 2.11.3 Other Ways to Control Precompiled Headers. 2-26. 2.11.4 Performance Issues . 2-26. iii Nios II Embedded Tools Reference Libraries 3-1 3.1 Introduction . .. .. .. .. .. .. 3-1 3.2 Library Functions . .. 3-3. 3.2.1 assert.h . .. .. .. .. .. .. 3-3 3.2.2 complex.h . .. .. .. .. .. .. 3-3 3.2.3 ctype.h and wctype.h . .3-3 . 3.2.4 errno.h . .. .. .. .. .. .. 3-4 3.2.5 fcntl.h . .. .. .. .. .. .. 3-4 3.2.6 fenv.h . .. .. .. .. .. .. 3-5 3.2.7 float.h . .. .. .. .. .. .. 3-5 3.2.8 fss.h . .. .. .. .. .. .. 3-5 3.2.9 inttypes.h and stdint.h . .3-6 . ..