Quality RTOS & Embedded Software

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




Loading

PIC18 ISR Stack and HW stack

Posted by paul on July 27, 2012
The PIC18 does have a HW stack of 31 but can also be changed into a SW stack and this is what FreeRTOS is doing I can see from the code. But my question is what does FreeRTOS do if an interrupt happens does it save all variables of the interrupt on a special SW stack or simply on the interrupted task SW stack or maybe uses the HW stack ?.

Who knows ??..

paul.

RE: PIC18 ISR Stack and HW stack

Posted by Richard on July 27, 2012
There are several reasons why the PIC18 architecture, as per that used to generate the PIC18 port, is less than ideal to run a preemptive RTOS. The hardware stack is one, the banking another, and the compiler using RAM for temporaries yet another, still....

When an interrupt occurs the low interrupt runs, which calls a peripheral specific interrupt handler. So far, that is all done by the compiler generated code. If the peripheral interrupt then decides a context switch is required, the stacks are saved onto the task stack (including the memory area used by the compiler).

Regards.

RE: PIC18 ISR Stack and HW stack

Posted by paul on July 27, 2012
I know PIC18 is not ideal but the HW stack is not used but a SW stack is implemented by FreeRTOS solving this problem. My question was if the compiler memory area uded by the compiler is stored on a special stack like with PIC32 or on the task stack and why this is different !. It would be better to use the HW stack memory for this since its waisted now.

RE: PIC18 ISR Stack and HW stack

Posted by Richard on July 27, 2012
The PIC32 benefits greatly by implementing (in software) a separate system stack. This is for a few reasons: It has a lot of registers, the compilers ABI is very RAM hungry, and the PIC32 port has a full interrupt nesting model meaning the interrupt stack can get very deep. The PIC18 on the other hand is a massively more simple device, and does not support interrupt nesting - the stack never holds more than one interrupt stack frame and that is insignificant in size compared to the stack required to hold the context during a context switch.

Regards.


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




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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

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

OpenRTOS and SafeRTOS