mikroC PRO for AVR Specifics
The following topics cover the specifics of mikroC PRO for AVR compiler:
- ANSI Standard Issues
- Predefined Globals and Constants
- Accessing Individual Bits
- Interrupts
- Linker Directives
- Built-in Routines
- Code Optimization
- Single Static Assignment (SSA) Optimization
- Dynamic Link For String Literals
- Common Object File Format (COFF)
GOTO Table
If a certain routine is allocated on the address higher than 64kB and can not be accessed directly, a GOTO table is created just after the Interrupt Vector Table to enable this routine call.
GOTO table comprises of addresses of those routines that are allocated on the addresses higher than 64kB.
So, whenever a call is made to a routine which is not directly accessible, it jumps to an assigned GOTO table block
which contains address of a desired routine. From there, a GOTO call is generated to that address, and the routine is executed.
Dynamic Link For String Literals
When Dynamic Link For String Literals is OFF, literal strings are linked as global, they are not shared between routines and consume more RAM.
When Dynamic Link For String Literals is ON, then literal strings are linked as local variables and are shared between routines, therefore consume less RAM.
Notes :
- Directive
absolute
in Rx memory space guarantees only that defined variable will be overlapped with the given memory address. - Addresses of all registers are RAM Space addresses. RAM Space is continuous region of RAM memory including all AVR RAM memory spaces (RAM space = Rx Space + IO Space + SRAM Space).
When using instructions dedicated to IO Space in asm blocks, IO registers should be accessed by their RAM Space addresses. Refer to AVR memory organization for details on RAM Space addresses. - Rx space not used by the compiler may be used for user variables. So, the size of the available Rx space is not fixed, because it depends on the memory consumtion of the project itself. Compiler uses not less than 7 Rx registers.
- Literal strings are stored according to the destination (Flash or RAM). If stored in RAM, they are linked as a global and always exist by default. There is an option for storing literal string on the function frame.
- Available RAM memory is divided on static and dynamic link. Static link grows upwards (from lower to higher addresses). Dynamic link grows downwards (from higher to lower addresses).
- In case of intensive cross-callings, recursions, etc. it is not guaranteed that the dynamic link will be enough for the program execution. If this happens, dynamic link can get out of its boundaries and overwrite static link.
New :
- Boot Loader section of the Flash memory is supported by the compiler.
- Constants may be stored throughout the whole Flash memory.
What do you think about this topic ? Send us feedback!