EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

ISR handler doubts in FreeRTOS-Cortex

Started by prab...@yahoo.co.in March 31, 2010
Here is my doubts,(Using GCC)

Here is the lpc21 series isr code:

void ISRWrapper(void)__attribute__ ((naked));
void ISRWrapper( void )
{
portSAVE_CONTEXT();
ISRHandler();
VICVecAddr = 0; /* acknoweledge interrupt */

portRESTORE_CONTEXT();
}

void ISRHandler()
{
/* write handler code here*./

if(switchRequired)
portYIELD_FROM_ISR();

}
Here is my 17series code:

Code 1:

void ISRWrapper(void);
void ISRWrapper( void )
{

ISRHandler();
}

void ISRHandler()
{
/* write handler code here*./

if(switchRequired)
portYIELD(); Is it correct???

}

or

In FreeRTOSConfig.h, configUSE_PREEMPTION = 1
Code2:
void ISRWrapper( void )
{
#if configUSE_PREEMPTION == 1
*(portNVIC_INT_CTRL) = portNVIC_PENDSVSET;
#endif

ulDummy = portSET_INTERRUPT_MASK_FROM_ISR(); /* If i set all priority to 0(same) do i need to this set/clr interupt mask code */

ISRHandler();

portCLEAR_INTERRUPT_MASK_FROM_ISR( ulDummy );

}

void ISRHandler()
{
/* write handler code here*./

if(switchRequired)
portYIELD();

}

Which one is correct code?????

Thanks,

An Engineer's Guide to the LPC2100 Series


>
> Which one is correct code?????

Neither.

I suggest looking at the examples provided in the FreeRTOS download,
reading the LPC17xx documentation pages on the FreeRTOS web site, and
reading the LPC17xx version of the FreeRTOS eBook. How to write
interrupt routines on the LPC17xx is described for you, and examples are
provided, so you don't have to work it out for yourself.
Regards,
Richard.

+ http://www.FreeRTOS.org
Designed for Microcontrollers. More than 7000 downloads per month.

+ http://www.SafeRTOS.com
Certified by T as meeting the requirements for safety related systems.

I dont have FreeRTOS book.I have read documents and systick timer handler code.
I didn't see any other handler example code(in Demo code).Please point me,???

Could you please guide me about what mistake i have made????

Thanks,

________________________________
From: FreeRTOS Info
To: l...
Sent: Wed, 31 March, 2010 12:25:18 PM
Subject: Re: [lpc2000] ISR handler doubts in FreeRTOS-Cortex



>
> Which one is correct code?????

Neither.

I suggest looking at the examples provided in the FreeRTOS download,
reading the LPC17xx documentation pages on the FreeRTOS web site, and
reading the LPC17xx version of the FreeRTOS eBook. How to write
interrupt routines on the LPC17xx is described for you, and examples are
provided, so you don't have to work it out for yourself.

Regards,
Richard.

+ http://www.FreeRTOS .org
Designed for Microcontrollers. More than 7000 downloads per month.

+ http://www.SafeRTOS .com
Certified by TÜV as meeting the requirements for safety related systems.

The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/
On 31/03/2010 09:32, pra bu wrote:
> I dont have FreeRTOS book.I have read documents and systick timer handler code.
> I didn't see any other handler example code(in Demo code).Please point me,???
>
> Could you please guide me about what mistake i have made????
>
> Thanks,
>

See the section "Interrupt Service Routines" near the end of this page:
http://www.freertos.org/LPC1768_CrossWorks.html
Regards,
Richard.

+ http://www.FreeRTOS.org
Designed for Microcontrollers. More than 7000 downloads per month.

+ http://www.SafeRTOS.com
Certified by T as meeting the requirements for safety related systems.

I have seen freertos demo code( FreeRTOS-6.0.3\Demo\CORTEX_LPC1768_GCC_RedSuite\src\webserver\emac.c) and referred

vEMAC_ISR() in emac.c

It similar to my code 1.
Insead of port_yield() , they r using portEND_SWITCHING_ISR( HigherPriorityTaskWoken ); But both point same function.

another one diff is,
i am calling handler from wrapper(its my way of implementation).But i registered wrapper function in vector table.

Thanks,

________________________________
From: FreeRTOS Info
To: l...
Sent: Wed, 31 March, 2010 12:25:18 PM
Subject: Re: [lpc2000] ISR handler doubts in FreeRTOS-Cortex



>
> Which one is correct code?????

Neither.

I suggest looking at the examples provided in the FreeRTOS download,
reading the LPC17xx documentation pages on the FreeRTOS web site, and
reading the LPC17xx version of the FreeRTOS eBook. How to write
interrupt routines on the LPC17xx is described for you, and examples are
provided, so you don't have to work it out for yourself.

Regards,
Richard.

+ http://www.FreeRTOS .org
Designed for Microcontrollers. More than 7000 downloads per month.

+ http://www.SafeRTOS .com
Certified by TÜV as meeting the requirements for safety related systems.

The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/
On 31/03/2010 09:52, pra bu wrote:
> I have seen freertos demo code( FreeRTOS-6.0.3\Demo\CORTEX_LPC1768_GCC_RedSuite\src\webserver\emac.c) and referred
>
> vEMAC_ISR() in emac.c
>
> It similar to my code 1.
> Insead of port_yield() , they r using portEND_SWITCHING_ISR( HigherPriorityTaskWoken ); But both point same function.
>
> another one diff is,
> i am calling handler from wrapper(its my way of implementation).But i registered wrapper function in vector table.

There is no need to have a wrapper, especially as its a standard C
function that calls another standard C function. It will just take CPU
cycles and stack space, with no benefit.
Regards,
Richard.

+ http://www.FreeRTOS.org
Designed for Microcontrollers. More than 7000 downloads per month.

+ http://www.SafeRTOS.com
Certified by T as meeting the requirements for safety related systems.

>
>
> ________________________________
> From: FreeRTOS Info
> To: l...
> Sent: Wed, 31 March, 2010 12:25:18 PM
> Subject: Re: [lpc2000] ISR handler doubts in FreeRTOS-Cortex
>
>
>
>
>>
>> Which one is correct code?????
>
> Neither.
>
> I suggest looking at the examples provided in the FreeRTOS download,
> reading the LPC17xx documentation pages on the FreeRTOS web site, and
> reading the LPC17xx version of the FreeRTOS eBook. How to write
> interrupt routines on the LPC17xx is described for you, and examples are
> provided, so you don't have to work it out for yourself.
>
> Regards,
> Richard.
>
> + http://www.FreeRTOS .org
> Designed for Microcontrollers. More than 7000 downloads per month.
>
> + http://www.SafeRTOS .com
> Certified by TÜV as meeting the requirements for safety related systems.
>
>
>
>
>
> The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/

Thanks lot!! i will improve it.

________________________________
From: FreeRTOS Info
To: l...
Sent: Wed, 31 March, 2010 3:02:43 PM
Subject: Re: [lpc2000] ISR handler doubts in FreeRTOS-Cortex

On 31/03/2010 09:52, pra bu wrote:
> I have seen freertos demo code( FreeRTOS-6.0.3\Demo\CORTEX_LPC1768_GCC_RedSuite\src\webserver\emac.c) and referred
>
> vEMAC_ISR() in emac.c
>
> It similar to my code 1.
> Insead of port_yield() , they r using portEND_SWITCHING_ISR( HigherPriorityTaskWoken ); But both point same function.
>
> another one diff is,
> i am calling handler from wrapper(its my way of implementation).But i registered wrapper function in vector table.

There is no need to have a wrapper, especially as its a standard C
function that calls another standard C function. It will just take CPU
cycles and stack space, with no benefit.
Regards,
Richard.

+ http://www.FreeRTOS.org
Designed for Microcontrollers. More than 7000 downloads per month.

+ http://www.SafeRTOS.com
Certified by TÜV as meeting the requirements for safety related systems.

> ________________________________
> From: FreeRTOS Info
> To: l...
> Sent: Wed, 31 March, 2010 12:25:18 PM
> Subject: Re: [lpc2000] ISR handler doubts in FreeRTOS-Cortex
>
>
> >
>> Which one is correct code?????
>
> Neither.
>
> I suggest looking at the examples provided in the FreeRTOS download,
> reading the LPC17xx documentation pages on the FreeRTOS web site, and
> reading the LPC17xx version of the FreeRTOS eBook. How to write
> interrupt routines on the LPC17xx is described for you, and examples are
> provided, so you don't have to work it out for yourself.
>
> Regards,
> Richard.
>
> + http://www.FreeRTOS .org
> Designed for Microcontrollers. More than 7000 downloads per month.
>
> + http://www.SafeRTOS .com
> Certified by TÃœV as meeting the requirements for safety related systems.
>
> The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/



Yahoo! Groups Links

Your Mail works best with the New Yahoo Optimized IE8. Get it NOW! http://downloads.yahoo.com/in/internetexplorer/

The 2024 Embedded Online Conference