SW500008 Microchip Technology, SW500008 Datasheet - Page 53

PICC-18 STD

SW500008

Manufacturer Part Number
SW500008
Description
PICC-18 STD
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC18r
Datasheets

Specifications of SW500008

Supported Families
PIC18
Core Architecture
PIC
Software Edition
Standard
Kit Contents
Software And Docs
Mcu Supported Families
PIC18
Tool Function
Compiler
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
PIC18 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
015
778-1001
778-1001
C Language Features
3.3.5.1 Initialization of Data psects
One job of the runtime startup code is ensure that any initialized variables contain their initial value
before the program begins execution. Initialized variables are those which are not auto objects and
which are assigned an initial value in their definition, such as input in the following example.
Such initialized objects have two components and are placed within the data psects.
variables will reside, and be accessed, at runtime. Space is reserved for the runtime location of
initialized variables in a psect called rdata. This psect does not contribute to the output file.
so that the RAM variables will contain their initial values before main() is executed. Each location
in the idata psect is copied to appropriate place in the rdata psect.
For example:
With this part of the runtime startup code absent, the contents of initialized variables will be unpre-
dictable when the program begins execution. Code relying on variables containing their initial value
will fail.
see Section 3.4.10.1. Such variables are linked at a different area of memory and are not altered by
the runtime startup code in any way.
3.3.5.2 Clearing the Bss Psects
The ANSI standard dictates that those non-auto objects which are not initialized must be cleared
before execution of the program begins. The compiler does this by grouping all such uninitialized
objects into a bss psect. This psect is then cleared as a block by the runtime startup code.
The actual initial values are placed in a psect called idata. The other component is where the
The runtime startup code performs a block copy of the values from the idata to the rdata psect
The block copy of the data psects may be omitted by disabling the init suboption of --RUNTIME.
Variables whose contents should be preserved over a reset, should be qualified with persistent,
int input = 88;
void main(void) { ...
Since auto objects are dynamically created, they require code to be positioned in the
function in which they are defined to perform their initialization. It is also possible that
their initial value changes on each instance of the function. As a result, initialized auto
objects do not use the data psects.
--RUNTIME=default,-init
Files
39

Related parts for SW500008