User manual

Table Of Contents
mikroC PRO for PIC32
MikroElektronika
163
Types Efciency
First of all, the user should know that PIC32’s ALU, which performs arithmetic operations, is optimized for working with
32-bit types. Also, it performs hardware multiplication and division on the integer level,
so the oating multiplication and division is slower and consumes more memory comparing it to the integer.
The PIC32 supports 64-bit data types, but they are less efcient. They provide higher precision, but lack the code size
and the execution.
Nested Calls Limitations
There are no Nested Calls Limitations, except by RAM size. A Nested call represents a function call within the function
body, either to itself (recursive calls) or to another function.
Recursive calls, as a form of cross-calling, are supported by mikroC PRO for PIC32, but they should be used very
carefully. Also calling functions from interrupt is allowed.
Calling function from both interrupt and main thread is allowed. Be careful because this programming technique may
cause unpredictable results if common resources are used in both main and interrupt.
Variable, constant and routine alignment
Simple type variables whose size exceeds 2 byte (int, long, oat, double, long double) and those
exceeding 4 bytes are always set to alignment 4.
Routines are always set to aligment 4.
Boot Start-up Initialization
Upon reset, MCU positions at the address 0xBFC00000 on which the BootStartUp function is located.
BootStartUp function congures:
- CP0 (coprocessor registers),
- SFR registers associated with the interrupt,
- Stack pointer (R29) and global pointer (R1).
By default the MCU is congured as follows:
- Cache Enabled,
- Prefetch enabled (for executable code and constants),
- Flash waitstates set for specied oscillator frequency,
- Executable code allocated in the KSEG0,
- Data allocated in the KSEG1,
After this start-up function has been executed, MCU will jump into the main routine. Interupts will be set accordingly to
the settings in the Edit Project.