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

Handling interrupt

Posted by pebemspn on March 15, 2015

Dears,

I want to have ISR which is out of freeRTOS scope (not handled by rtos - interrupt whose priority level is greater than configMAXSYSCALLINTERRUPT_PRIORITY), I sync it with a task in rtos. Since I do computation (math/filtering) within this ISR on periodic base I need to keep ISR variables over time. My ISR is high frequency rate ISR.

My question is what/how variable should I use (local,static,global)? What is the limitation on variable use for this ISR which is out of rtos?

Under preemptive scheduling do I have either time different stack?

Thank you. peb


Handling interrupt

Posted by rtel on March 15, 2015

This is a C question, not a FreeRTOS question.

In C a variable declared as a local variable inside a function will be allocated to either the stack, or a register. In either case the value of the variable will not persist across calls to the function - no matter if that function is executed in an interrupt or not.

If the variable is declared inside the function as a static variable, then it will not be on the stack and its value will persist across calls to the function. Likewise if the variable is global it will always be accessible and its value will not change unless changed by your code.

Regards.


Handling interrupt

Posted by pebemspn on March 17, 2015

Thank you for your answer, what you wrote is quite understandable. I am starting to use rtos so questions are quite entry level.

My ISR is out of freeRTOS, I use local variables there and if there is a preemptive scheduler which switch stacks per task, does it affect my local ISR variables? The ISR local variables is allocated on stack, so which particular one if each task his its own stack?

Thank you.


Handling interrupt

Posted by rtel on March 17, 2015

Tasks are software controlled and interrupts are a feature of the hardware - a task can never preempt an interrupt, but an interrupt can preempt a task - so you do not need to worry about a task switch interfering with the stack of an interrupt.

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