Quality RTOS & Embedded Software

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




Loading

Porting to freescale MAC7111

Posted by acehigh1971 on June 26, 2006
Following the discussion from another thread (was OT there).

I'm porting the freertos on a freescale MAC7111.
I started from the Philips LPC2106 GCC port and the main problem I encountered was the different interrupt controller. It's vectored but I have to read the source by software. I can't jump directly to the proper ISR, but to a single ISR in which i read a register in which there is the interrupt source (63 sources), and then jump to the corresponding function.
So, for example, the 2106 port handles differently the preemptivetick (savecontext/restorecontext naked function) and serialISR (savecontext/restore + switchingisr) functions. The microcontroller jumps directly to the correct ISR depending on the interrupt.

In my case i jump into a function (IRQ_ISR), in which I must save the context, and then jump to the proper ISR. This single ISR is defined naked and all the context is saved/restored. the jump is made as a normal function call (using the IRQ stack) and, if for example, I'm in the serialISR, I do a portENTER_SWITCHING_ISR() in which I don't save the context but only do the sub r11,#4 , as the savecontext was already done in the IRQ_ISR.

So, every IRQ that I raise in my application causes a save/restore context.
Is it right?
Can someone suggest a better approach?


RE: Porting to freescale MAC7111

Posted by Nobody/Anonymous on June 26, 2006
This is the approach taken in the ARM9 port (latest download). There is a single handler that saves the context (must be done before any registers change), then in this case reads the VIC, calls the interrupt function as a standard function call (no irq or naked modifier), then returns to restore the context.

In this case the start/end switching ISR are very different to the LPC demo. The start is not needed and the switch simply calls the context switch function in the task.c file. It does not need to do anything else.

The overhead is that each interrupt has to save the context even if it is not going to perform a switch, but the code I have seen as standard from people like atmel and st does this anyway. It is not a long operation. I think this approach is more user friendly.

The sub r11, #4 thing is very GCC specific. There was a thread a few hours ago on that. Only required because the function is declared naked.

RE: Porting to freescale MAC7111

Posted by acehigh1971 on June 27, 2006
You're telling me that, because the switching isr is no more naked, there is no need of that extra sub r11, lr, #4 ?
There is only the need of the exitswitchingISR macro?

I'm going to test it.

RE: Porting to freescale MAC7111

Posted by acehigh1971 on August 3, 2006
Tested for some time. It worked ok. I removed the sub r11,#4 instruction, but I had to introduce the -fomit-frame-pointer option to the compiler, so the calling preamble is always the same with any optimization level.

The isr is only one (two, one for FIQ and one for IRQ), and the specific ISR functions are simple ones, they are not declared naked and don't have the extra sub r11,#4.

There is only the portEXIT_SWITCHING_ISR if the specific function (ie. the serialISR function) has to do a context switch.


[ 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