FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [January 2011 Threads] PIC32MX Port Interrupts questionPosted 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 questionPosted 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|