PIC32 Specifics

In order to get the most from the mikroC PRO for PIC32 compiler, the user should be familiar with certain aspects of PIC32 MCU. This knowledge is not essential, but it can provide a better understanding of the PIC32's capabilities and limitations, and their impact on the code writing as well.

Types Efficiency

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 floating 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 efficient. 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 is 2 bytes are set to alignemnt 2, those whose size is 4 bytes and larger are set to alignment 4. Variables of other size are set to alignment 1.
Routines are always set to alignment 4. Only aligned memory access is supported.

Boot Start-up Initialization

Upon reset, MCU positions at the address 0xBFC00000 on which the BootStartUp function is located.

BootStartUp function configures :

By default the MCU is configured as follows :

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.

Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code