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] [June 2013 Threads] PIC32 - Using a different TimerPosted by Marcel van Lieshout on June 16, 2013 Hello,
While working on (loosely) integrating Microchip's TCP/IP and USB stacks into my FreeRTOS application, I want FreeRTOS to use a different Timer (The default Timer1 is used by Microchip stacks).
The port.c conveniently has vApplicationSetupTickTimerInterrupt() declared as "weak", allowing me to define this function, setting up a different timer, elsewhere. There also is a configuration definition for the interrupt vector (configTICK_INTERRUPT_VECTOR). This is all quite nice :)
BUT: The last line in function vPortIncrementTick() in port.c, clears the interruptflag in the following way:
/* Clear timer 1 interrupt. */ IFS0CLR = _IFS0_T1IF_MASK; So, I still need to modify port.c to change timers. Not a big deal at first glance, but it means I am changing a core FreeRTOS file and that implicates there are license consequences.
What can I do?
RE: PIC32 - Using a different TimerPosted by Richard on June 16, 2013 Just changing the line that clears the interrupt flag is not a problem and so no licensing issue to worry about as far as I'm concerned because you are not modifying or enhancing the behaviour of the kernel. What is more of an issue is that the implementation was intended to be such that you would not need to do that. It looks like a bit of an omission from the port layers implementation, and maybe the line that clears the interrupt source also needs to be user definable. The other alternative would be to implement your own "increment tick" function the the application - basically just a copy of the one from the port layer. As you have your own handler you can have the handler call your own increment tick function too. Note that the next version of FreeRTOS will change the increment tick function somewhat as follows: void vPortIncrementTick( void ) { unsigned portBASE_TYPE uxSavedStatus;
uxSavedStatus = uxPortSetInterruptMaskFromISR(); { if( xTaskIncrementTick() != pdFALSE ) { /* Pend a context switch. */ _CP0_BIS_CAUSE( portCORE_SW_0 ); } } vPortClearInterruptMaskFromISR( uxSavedStatus );
/* Clear timer 1 interrupt. */ IFS0CLR = _IFS0_T1IF_MASK; }
Regards.
RE: PIC32 - Using a different TimerPosted by Marcel van Lieshout on June 17, 2013 Richard, thank you for your reply :)
Making the "clear interrupt flag" user definable appeals to me the most. It continues to build upon the already present definable timer parameters. And, even more important for me, updating the kernel to a newer release is not obscured by having to maintain an almost duplicate version of vPortIncrementTick().
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|