Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

PIC32MX Port Interrupts question

Posted by reSpawn on January 17, 2011
Hello,
I downloaded the FreeRTOS port and I made a simple interrupt driven UART. While looking through the example I noticed that the demo defines an InterruptHandler and an InterruptWrapper. The wrapper is declared as an interrupt like this void __attribute__( (interrupt(ipl2), vector(_UART1_VECTOR))) vU1InterruptWrapper( void ); and is defined in a .S file like this:

.set noreorder
.set noat
.ent vU1InterruptWrapper

vU1InterruptWrapper:

portSAVE_CONTEXT
jal vU1InterruptHandler
nop
portRESTORE_CONTEXT

.end vU1InterruptWrapper

The InterruptHandler is a regular function ( void vU1InterruptHandler(void) ). As far as I know, the compiler generates prologue and epilogue for functions with the interrupt attribute (there is an attribute which tells him not to) and I'm worried that what I'm actually getting here, is saving the context twice, and restoring it twice.
Any thoughts?

RE: PIC32MX Port Interrupts question

Posted by Richard on January 17, 2011
I'm not quite following your question here.

The wrapper is an assembly function, so not compiled at all and will therefore not have a compiler generated prologue or epilogue sequence. The FreeRTOS provided prologue/epilogue in the portSAVE_CONTEXT() and portRESTORE_CONTEXT() macros switches the stack to an interrupt stack to save RAM (each task does not need to have a stack large enough to handle all the nested interrupts).

The function vU1InterruptHandler is just a standard function. The prologue generated for that will be much smaller than that generated for an interrupt function written in C, and will use the interrupt stack, not the task stack.

Hopefully I will have answered your question but I'm not sure. In any case, if you want to know what is being saved and restored by the compiler just look at the code it generates.

Regards.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists