SW006012 Microchip Technology, SW006012 Datasheet - Page 86

C COMPILER FOR DSPIC30F FAMILY

SW006012

Manufacturer Part Number
SW006012
Description
C COMPILER FOR DSPIC30F FAMILY
Manufacturer
Microchip Technology
Type
MPLAB® C30 Compilerr
Series
PIC24 & DsPICr
Datasheets

Specifications of SW006012

Supported Families
PIC24, DsPIC30F And DsPIC33F
Core Architecture
PIC, DsPIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC24 MCUs And DsPIC DSCs
Tool Type
Compiler
Processor Series
PIC24, dsPIC
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
dsPIC30F
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
MPLAB
DS51284F-page 80
®
C30 User’s Guide
Here allocation of the string literal depends on the surrounding code. If the statement
appears in a boot or secure function, the literal will be allocated in a corresponding PSV
constant section. Otherwise it will be placed in general (non-secure) memory,
according to the constants memory model.
Recall that data stored in a secure segment can not be read by any other segment. For
example, it is not possible to call the standard C library function puts() with a string
that has been allocated in a secure segment. Therefore literals which appear as func-
tion arguments can only be passed to functions in the same security segment. This is
also true for objects referenced by pointers and arrays. Simple scalar types such as
char, int, and float, which are passed by value, may be passed to functions in
different segments.
4.15.3
const-qualified variables with initializers can be supported in secure Flash segments
using PSV constant sections managed by the compiler. For example:
const int __attribute__((boot)) time_delay = 55;
If the const qualifier was omitted from the definition of time_delay, this statement
would be rejected with an error message. (Initialized variables in secure RAM are not
supported).
Since the const qualifier has been specified, variable time_delay can be allocated
in a PSV constant section that is owned by the boot segment. It is also possible to spec-
ify the PSV constant section explicitly with the space(auto_psv) attribute:
int __attribute__((boot,space(auto_psv))) bebop = 20;
Pointer variables initialized with string literals require special processing. For example:
char * const foo __attribute__((boot)) = "eek";
The compiler will recognize that string literal "eek" must be allocated in the same PSV
constant section as pointer variable foo. The logic for making that association is
already supported in the compiler for named PSV sections.
4.15.4
Since functions in secure segments set PSVPAG to their respective psv constant sec-
tions, a convention must be established for managing multiple values of the PSVPAG
register. In previous versions of C30, a single value of PSVPAG was set during program
startup if the default constants-in-code memory model was selected. The com-
piler relied upon that preset value for accessing const variables and string literals, as
well as any variables specifically nominated with space(auto_psv).
C30 v3.0 will provide automatic support for multiple values of PSVPAG. Variables
declared with space(auto_psv) may be combined with secure segment constant
variables and/or managed psv pointer variables in the same source file. Precompiled
objects that assume a single, pre-set value of PSVPAG will be link-compatible with
objects that define secure segment psv constants or managed psv variables.
Even though PSVPAG is now considered to be a compiler-managed resource, there is
no change to the function calling conventions. Objects and libraries created with earlier
versions are compatible with 3.0 objects, with the exception of some Interrupt Service
Routines as noted in Section 7.10 “PSV Usage with Interrupt Service Routines”.
Const-qualified Variables in Secure Flash
Object Compatibility Model
© 2007 Microchip Technology Inc.

Related parts for SW006012