Mikroelektronika MIKROE-738 Datenbogen

Seite von 682
146
mikoC PRO for PIC32
MikroElektronika
Directive orgall
If the user wants to place his routines, constants, etc, above a specified address in ROM,
 #pragma orgall
 directive 
should be used:
#pragma orgall 0xBD000000<
Indirect Function Calls
If the linker encounters an indirect function call (by a pointer to function), it assumes that any of the functions addresses 
of which were taken anywhere in the program, can be called at that point. Use the 
#pragma  funcall
 directive to 
instruct the linker which functions can be called indirectly from the current function:
#pragma funcall <func_name> <called_func>[, <called_func>,...]
A corresponding pragma must be placed in the source module where the function 
func_name
 is implemented. This 
module must also include declarations of all functions listed in the 
called_func
 list.
These functions will be linked if the function 
func_name
 is called in the code no matter whether any of them was called 
or not.
Directive org
Directive 
org
 specifies a starting address of a routine in ROM. Directive 
org
 is appended to the function definition. Directives 
applied to non-defining declarations will be ignored, with an appropriate warning issued by the linker.
Here is a simple example:
void func(int par) org 0xBD000000 {
// Function will start at address 0xBD000000
  asm nop;
}
It is possible to use org directive with functions that are defined externally (such as library functions). Simply add org directive 
to function declaration:
void UART1_Write(char data) org 0xBD000000;
Directive funcorg
You can use the
 #pragma funcorg
 directive to specify the starting address of a routine in ROM using routine name 
only:
#pragma funcorg <func_name>  <starting_address>
Related topics: Indirect Function Calls