SW500011 Microchip Technology, SW500011 Datasheet - Page 93

HI-TECH X PRO FOR PIC32

SW500011

Manufacturer Part Number
SW500011
Description
HI-TECH X PRO FOR PIC32
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC32r
Datasheet

Specifications of SW500011

No. Of User Licenses
1
Supported Families
PIC32
Core Architecture
PIC
Supported Hosts
Windows XP, Vista, Linux, Mac OS X
Software Edition
Professional
Kit Contents
Software And Docs
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC32 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
032
778-1007
778-1007
C Language Features
constructs such as if, while, do etc. then you should use only the asm("") form, which is a C
statement and will correctly interact with all C flow-of-control structures.
3.10.3 Accessing C objects from within Assembly Code
Global C objects may be directly accessed from within assembly code using their name prepended
with an underscore character. For example, the object foo defined globally in a C module:
may be access from assembler as follows.
If the assembler is contained in a different module, then the GLOBAL assembler directive should be
used in the assembly code to make the symbol name available, as above. If the object is being
accessed from in-line assembly in another module, then an extern declaration for the object can be
made in the C code, for example:
This declaration will only take effect in the module if the object is also accessed from within C code.
If this is not the case then, an in-line GLOBAL assembler directive should be used. Care should be
taken if the object is defined in a bank other than 0. The address of a C object includes the bank
information which must be stripped before the address can be used in most PIC32 instructions. The
exceptions are the movff and lsfr instructions. Failure to do this may result in fixup errors issued
by the linker. If in doubt as to writing assembler which access C objects, write code in C which
performs a similar task to what you intend to do and study the assembler listing file produced by the
compiler.
int foo;
GLOBAL _foo
sw
extern int foo;
C identifiers are assigned different symbols in the output assembly code so that an as-
sembly identifier cannot conflict with an identifier defined in C code. If assembly pro-
grammers choose identifier names that do not begin with an underscore, these identifiers
will never conflict with C identifiers. Importantly, this implies that the assembly identi-
fier, i, and the C identifier i relate to different objects at different memory locations.
a3, _foo-__gptr(gp)
Mixing C and Assembly Code
93

Related parts for SW500011