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

Custom IRQ handler not working with FreeRTOS

Posted by Thomas Johansen on February 17, 2011
Hallo

Im using a bootloader to boot the FreeRTOS with. Therefore I cannot use the LDR PC, [PC, #-0x0120] from the startup.s file, because that is relative to the program counter (PC). The reason is that the application will be compiled to 0x5100 and VicVectAddr can not be addressed with an offset relative to PC (since vector originally located at 0x18
is now at 0x5118 in the application downloaded by the bootloader).

I have therefore written my own IRQ handler to get the correct adress from VivVector

IRQ handler:

void IRQ_Handler (void) __irq
{
void (*interrupt_function)();
unsigned int vector;
vector=VICVectAddr;
interrupt_function=(void(*)())vector;
interrupt_function();
VICVectAddr = 0;
}

I then use this in my Startup.s file instead:

IMPORT IRQ_Handler

LDR PC, IRQ_Addr

IRQ_Addr DCD IRQ_Handler

But for testing I haven't build the application with any flash offset. Just to test the IRQ handler

But doing this doesn't work. If I set a breakpoint in the IRQ_Handler the correct ISR is called. But after that one IRQ FreeRTOS crashes and CPU is in Undefined exception.

So my question:

Is this not possible with FreeRTOS or have I done something wrong?

Cannot se way this crashes FreeRTOS.

Using LPS2478 and FreeRTOS 5.1.2


Thomas

RE: Custom IRQ handler not working with FreeRTOS

Posted by Richard on February 17, 2011
I believe richard_daemon has gone to some length to look up how to do this for you in post 4 of the following thread:

http://sourceforge.net/projects/freertos/forums/forum/382005/topic/4363931

If you want to perform a context switch from an ISR (which the SWI ISR *must* do) then you need to following the instructions for writing ISR function that are on the documentation page for the port you are using - and also demonstrated in the demo projects that are provided for the port you are using.

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