SAM8 IAR C Compiler Reference Guide

SAM8 IAR C Compiler Reference Guide

SAM8 IAR C Compiler Reference Guide for Samsung’s SAM8 Microcontroller Family CSAM8-2 COPYRIGHT NOTICE © Copyright 1997–2003 IAR Systems. All rights reserved. No part of this document may be reproduced without the prior written consent of IAR Systems. The software described in this document is furnished under a license and may only be used or copied in accordance with the terms of such a license. DISCLAIMER The information in this document is subject to change without notice and does not represent a commitment on any part of IAR Systems. While the information contained herein is assumed to be accurate, IAR Systems assumes no responsibility for any errors or omissions. In no event shall IAR Systems, its employees, its contractors, or the authors of this document be liable for special, direct, indirect, or consequential damage, losses, costs, charges, claims, demands, claim for lost profits, fees, or expenses of any nature or kind. TRADEMARKS IAR, IAR Embedded Workbench, IAR XLINK Linker, IAR XAR Library Builder, IAR XLIB Librarian, IAR MakeApp, and IAR PreQual are trademarks owned by IAR Systems. C-SPY is a trademark registered in Sweden by IAR Systems. IAR visualSTATE is a registered trademark owned by IAR Systems. SAM8 and Samsung are registered trademarks of Samsung Electronics Co., Ltd. Microsoft and Windows are registered trademarks of Microsoft Corporation. All other product names are trademarks or registered trademarks of their respective owners. EDITION NOTICE Second edition: April 2003 Part number: CSAM8-2 CSAM8-2 Contents Tables ....................................................................................................................... xi Preface ................................................................................................................... xiii Who should read this guide ..............................................................xiii How to use this guide .........................................................................xiii What this guide contains ....................................................................xiv Other documentation ........................................................................... xv Further reading ................................................................................... xv Document conventions .......................................................................xvi Typographic conventions ..................................................................xvi Part 1. Using the compiler ......................................................... 1 Introduction .......................................................................................................... 3 Building applications ............................................................................... 3 Compiling ............................................................................................. 3 Linking ................................................................................................. 3 Data storage ............................................................................................... 4 Code models ............................................................................................... 4 Optimization techniques ....................................................................... 4 IAR language extension overview ..................................................... 5 Special function types .......................................................................... 5 Extended keywords .............................................................................. 5 #pragma directives ............................................................................... 5 Predefined symbols .............................................................................. 5 Intrinsic functions ................................................................................ 6 Inline assembler .................................................................................. 6 Runtime libraries ...................................................................................... 6 Customization ...................................................................................................... 7 Code model ................................................................................................. 7 Data model .................................................................................................. 7 iii CSAM8-2 Runtime library .......................................................................................... 8 Data storage ...................................................................................................... 11 Stack, static, and heap memory ....................................................... 11 The stack and auto variables .............................................................. 11 Static memory ................................................................................... 13 Dynamic memory on the heap .......................................................... 14 Memory access methods and memory types ............................ 14 Memory access methods ................................................................... 14 Memory types ................................................................................... 15 Structures and memory types ......................................................... 16 Non-initialized memory ....................................................................... 16 Located variables .................................................................................... 17 Absolute location placement .............................................................. 17 Segment placement ............................................................................ 17 Accessing special function registers .................................................. 18 Anonymous structs and unions ........................................................ 18 Functions ............................................................................................................. 21 Code models ............................................................................................21 Special function types .......................................................................... 21 Interrupt functions ............................................................................. 21 Fast functions .................................................................................... 22 Monitor functions ............................................................................... 22 Segment placement ............................................................................. 23 Assembler language interface ................................................................... 25 Introduction .............................................................................................. 25 Runtime model attributes ................................................................. 25 Specifying runtime attributes ............................................................. 26 Predefined runtime attributes ............................................................. 27 Calling convention .................................................................................. 27 Function declarations ........................................................................ 27 Function parameters .......................................................................... 28 Returning a value from a function ....................................................29 SAM8 IAR C Compiler iv Reference Guide CSAM8-2 Contents Permanent versus scratch registers ................................................... 29 Return location ................................................................................... 29 Examples ............................................................................................30 Calling assembler routines from C ................................................. 31 Creating skeleton code ....................................................................... 31 Call frame information ......................................................................... 33 Function directives .................................................................................35 Syntax ................................................................................................. 35 Parameters .......................................................................................... 35 Description ......................................................................................... 36 Segments and memory ................................................................................. 37 What is a segment? ................................................................................ 37 Linker segment type .......................................................................... 38 Placeholder segments ........................................................................ 38 Placing segments in memory ............................................................ 38 The contents of the linker configuration file ...................................... 39 Customizing a linker configuration file ............................................. 39 Data segments ......................................................................................... 40 Static memory segments ................................................................... 40 The stack ..........................................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    192 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us