Quality RTOS & Embedded Software

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




Loading

Error on C18 port?

Posted by Marcelo Adrian Lorenzati Sanz on October 19, 2008
Hello all,

I´ve been dealing some time with different errors in FreeRTOS with C18 port.

Looking in the port i´ve found this:

#pragma code high_vector=0x08
static void prvLowInterrupt( void )
{
/* Was the interrupt the tick? */
if( PIR1bits.CCP1IF )
{
_asm
goto prvTickISR
_endasm
}

/* Was the interrupt a byte being received? */
if( PIR1bits.RCIF )
{
_asm
goto vSerialRxISR
_endasm
}

/* Was the interrupt the Tx register becoming empty? */
if( PIR1bits.TXIF )
{
if( PIE1bits.TXIE )
{
_asm
goto vSerialTxISR
_endasm
}
}
}
#pragma code

In accordance with C18 manual the pragma code place obviously code in the specified direction, but in the case of the interrupt it´s mean to be used just for a computed goto to the isr routine because the next positions (0x18) are mean for the low interrupt service.
I think the previous code is writing beyond his range, also if you want to use priority level it definitely wont fit.


Here I post a modified example:


#pragma code high_vector=0x08
static void highIsr( void )
{
_asm
goto prvHighInterrupt
_endasm
}
#pragma code

#pragma code low_vector=0x18
static void lowIsr( void )
{
_asm
goto prvLowInterrupt
_endasm
}
#pragma code


#pragma interrupt prvHighInterrupt //save=PRODH, PRODL, TABLAT, section(".tmpdata")
static void prvHighInterrupt( void )
{
/*Timer Related Interrupt*/
if( PIR1bits.CCP1IF )
{
_asm
goto prvTickISR
_endasm
}
}

#pragma interruptlow prvLowInterrupt //save=PRODH, PRODL, TABLAT, section(".tmpdata")
static void prvLowInterrupt( void )
{
/* Was the interrupt a byte being received? */
if( PIR1bits.RCIF )
{
_asm
goto vSerialRxISR
_endasm
}

/* Was the interrupt the Tx register becoming empty? */
if( PIR1bits.TXIF )
{
if( PIE1bits.TXIE )
{
_asm
goto vSerialTxISR
_endasm
}
}
}

Two more method def are required prvHighInterrupt and prvLowInterrupt.

Regards

RE: Error on C18 port?

Posted by Dave on October 20, 2008
PIC18? - eek.

RE: Error on C18 port?

Posted by Marcelo Adrian Lorenzati Sanz on October 20, 2008
Yeap, PIC18 with MCC18.
Does anyone have a newer working example for this micro?
I mean MCC18 3.2 FreeRTOS 5.0.4 and a new micro (like PIC18F2620).
I can not manage to get it working properly with this micro and compiler.
In some point I always get a stack under-over flow reset or a read over a wrong code place.


[ 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