This release provides the following new features:
-
New part support -- this toolchain now supports additional PIC32 devices
-
SFR Access Efficiency improvements at -O2, -O3, -Os -- This feature adds the address attribute to Peripheral SFRs defined in the processor header file. With this added information, a new compiler optimization reduces the number of registers required to access multiple SFRs within a single function. This also allows the compiler to remove redundant load instructions. Enabled by default at optimization levels -O2, -Os, & -O3. NOTE: If you are building a static library that accesses an SFR and you want that same prebuilt library to work across devices that may have the SFRs located at a different address (e.g. TMR1 is at different addresses on device A and device B), compile your library with the -mno-hi-addr-opt option. This will result in larger code, but the SFR address will be determined at link time.
-
Cache-line alignment for 'coherent' attribute -- The linker now groups all coherent attributed variables together and aligns them on a cache-line boundary.
-
IPLnSAVEALL interrupt priority specifier -- This release adds a new IPLnSAVEALL specifier for use with the interrupt attribute. Use this new specifier in place of IPLnSOFT to force software context saving of all software-saved general registers even if they are not used within the Interrupt Service Routine (ISR). This attribute can be useful for some RTOS implementations.
-
keep_interrupt_masked function attribute -- The attribute keep_interrupts_masked can be combined with the interrupt attribute. This attribute causes the Interrupt Service Routine (ISR) prologue code to not re-enable interrupts. Application code may then choose whether and when to re-enable interrupts in the ISR.
-
Function Replacement Prologue support -- This feature allows the application to redirect one function to another implementation at runtime without replacing the existing function. This is achieved by changing the method of invoking functions through a function replacement table instead of from a linker-resolved address. Initially the function address in the table points to the location of the entry point of the original function's prologue. The application can then replace the table entry with the new function address. Now, during the program execution, the control will pass to the new function address and returns to the caller function. This feature adds a new function_replacement_prologue function attribute. To redirect the function, modify the corresponding Function Replacement Table entry at runtime.
Example C code:
int a, b, c, d;
int __attribute__((function_replacement_prologue)) foo (void)
{
a = b + c;
return (a);
}
int main()
{
d = foo();
return 0;
}
Example generated assembly code:
# Function Replacement Table entries, located in data memory
.section .fixtable, data
fixtable.foo:
.word cont.foo # By default, populate the table with the address
# of the original implementation. Redirect to
# another implementation by overwriting this
# location with the address of the new implementation.
.section .text, code
.globl foo
.ent foo
.type foo, @function
foo:
# Begin Function Replacement Table Prologue
lui $25,%hi(fixtable.foo) # Load address from .fixtable above
lw $25,%lo(fixtable.foo)($25)
j $25 # Jump to address loaded from table
nop
cont.foo:
# End Function Replacement Table Prologue
addiu $sp,$sp,-8
sw $fp,4($sp)
move $fp,$sp
lw $3,%gp_rel(b)($28)
...........
j $31
nop