PIC18F Heap and Context Fixes, Modular Interrupt handling

This port is based on the PIC18F port distributed with FreeRTOSV7.1.0. It fixes two long-standing issues and adds more flexible interrupt management.

Bugs fixed:

1. The port assumed that .tmpdata and MATH_DATA sections wouldn't change size, which they do both as a project evolves and between compiler versions.

2. In order to manage a large heap space, the linker script allowed sections containing C variables to cross bank boundaries.

More details on these two bugs, and on how to manage the associated configuration definitions, can be found in this write-up: http://malsyned.net/files/freertos-pic-port-notes-wrapped.txt

This port also adds the configuration definition configPORT_USER_ISR_VECTOR which can be set to the name of a void function that handles vectoring to non-OS interrupts. This function (interrupts.c:vUserInterruptVector in the Demo projects) is limited in what instructions it can execute, since it runs before context has been saved and therefore cannot alter the values of any registers. As long as the pattern established in the Demo interrupts.c is followed, this is an easy requirement to satisfy.

NOTE: In order to make sure the demos compile, I have changed the order of the include paths in their Project Build Options to prioritize Microchip's "timers.h" header above FreeRTOS's. This is sufficient to compile the demos, but in order to compile projects that use the FreeRTOS timers module a more complete solution will be needed.


1 comment

Please sign in to leave a comment.