C_LangUserGuide.pdf

(158 KB) Pobierz
PSoC Designer: C Language Compiler User Guide
Draft Version
PSoC Designer
¥
:
C Language Compiler
User Guide
Revision 1.07
CMS10004A
Last Revised: January 30, 2001
Cypress MicroSystems, Inc.
PSoC Designer: C Language Compiler User Guide
Copyright Information
Copyright
2000-2001 Cypress MicroSystems, Inc. All rights reserved.
The information contained herein is subject to change without notice.
Acknowledgments
The front end of the compiler is lcc: "lcc source code (C) 1995, by David R.
Hanson and AT&T. Reproduced by permission." The assembler/linker is a distant
descendent of Alan Baldwin’s public domain assembler/linker package.
All code used with permission.
Code Compressor
Codewright or Multiedit editor
COFF
All Intel products referenced herein are either trademarks or registered
trademarks of Intel Corporation.
Copyright
1981-1998 Microsoft Corp. as related to Windows
Motorola S19
Page 1 of 47
PSoC Designer: C Language Compiler User Guide
Two Minute Overview
This two-minute overview of
PSoC Designer: C Language Compiler User Guide
was purposefully placed up front for you advanced engineers who are ready to…
(Now we only have a minute and-a-half left.)
Overview
35 seconds
You have the M8C, PSoC
Designer, and the C
compiler… This guide provides:
enabling and accessing procedures
instructions for using the C compiler within
PSoC Designer parameters
references for the internal workings of the
compiler (including the supported pre-
processor directives, “#directive”).
Basics
30 seconds
After generating your device configuration, click the
Application Editor icon in the toolbar to access the C
compiler and pre-configured source files.
The source tree of project files appears in the left
frame. The folders can be expanded to reveal the
files. Double-click individual files to open and edit
them in the main window.
Quick
15 seconds
Reference
Click a hyperlink to reference key material:
Notation Standards
Accessing/Enabling the Compiler
Compiler Files
Basics
Functions
Processing Directives (#’s)
Librarian
Status Window Messages
Bottom
Line
10 seconds
The PSoC
Designer C Compiler is an “extra” tool
you can use to customize the functionality you desire
into the M8C microprocessor.
Time’s up… Now get to work.
Page 1 of 47
PSoC Designer: C Language Compiler User Guide
Documentation Conventions
Following, are easily identifiable conventions used throughout the PSoC
Designer suite of product documentation.
Usage
Times New Roman Size 10-12
Displays an input command:
iasm8c -g
Courier New Size 10
Convention
Displays output:
//
//
//
//
//
--- 000AREA
0000
0002
0004
0006
8033
8031
801F
801E
Created by PSoC Designer
from template BOOT.ASM
Boot Code, from Reset
Change this file at your own risk!
TOP(ABS)
org
jmp
jmp
jmp
jmp
0
__start
__start
Interrupt0
Interrupt1
Displays data types:
Courier Size 12
Italics
[Ctrl] [C]
File >> Open
Displays file locations:
c:\Program Files\Cypress
MicroSystems\PSoc Designer\tools
Displays file names:
projectname.rom
Displays keyboard commands:
[Enter]
Displays menu paths:
Edit >> Cut
Page 2 of 47
PSoC Designer: C Language Compiler User Guide
Notation Standards
Following, are notation standards used throughout the PSoC Designer suite of
product documentation.
Internal Registers:
Notation
A
CF
expr
F
I
K
PC
SP
X
ZF
Description
Primary Accumulator
Carry Flag
Expression
Flags (ZF, CF, and Others)
Operand 1 Value
Operand 2 Value
{PCH,PCL}
Stack Pointer
X Register
Zero Flag
Virtual Registers:
Virtual registers _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7, _r8, _r9,
_r10, _r11, _rX, _rY occupy 14 bytes of RAM. These locations are used for
temporary data when using the C language compiler. Currently, these virtual
memory register locations are allocated even if the source for the M8C in PSoC
Designer is written only in assembly language.
Underscore _ Call:
Standard to PSoC Designer C Compiler and Assembler, an
underscore is implicitly added to ’C’ functions and variables. This should be
applied when declaring and referencing functions and variables between ’C’ and
assembly source. For example, take a ’C’ function defined with a prototype like
"void foo();". You would use "call _foo" in M8C assembly to call the ’C’ function.
Page 3 of 47
Zgłoś jeśli naruszono regulamin