Quality RTOS & Embedded Software

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


PSVPAG error PIC24FJ256DA210

Posted by Fruitmans on November 10, 2010
I am trying to use the FreeRTOS kernel on the PIC24FJ256DA210 microcontroller from Microchip. When i select this device within the demo project and select the correct headerfile in FreeRTOS.h i get the following error.

port.c: In function 'pxPortInitialiseStack':
port.c:223: error: 'PSVPAG' undeclared (first use in this function)
port.c:223: error: (Each undeclared identifier is reported only once
port.c:223: error: for each function it appears in.)

I am pretty new to FreeRTOS so all the help i can get would be very helpfull.

Thanks in advance,

Rik Vugteveen

RE: PSVPAG error PIC24FJ256DA210

Posted by woops_ on November 10, 2010
The Microchip\MPLAB C30\support\PIC24F\h folder holds a header for each device individually in which PSVPAG is referenced. Are you including the header? It is normally inc from FreeRTOSconfig header.

RE: PSVPAG error PIC24FJ256DA210

Posted by Richard Damon on November 10, 2010
It looks like that chip has a new feature (Extended Data Space) that may require a small change in the port to handle. It looks like the PSVPAG register becomes the DSWPAG and DSRPAG for EDS parts.

RE: PSVPAG error PIC24FJ256DA210

Posted by m_aunsbjerg on August 5, 2011
A late reply, but here goes.

I had the same problem with a EDS pic device, a PIC24FJ256GB210.
I found a post on the microchip forum that dealt with the same issue: http://www.microchip.com/forums/m568144-print.aspx.

The suggested solution is to change the kernel code in a few places. In port.c under the portRESTORE_CONTEXT() macro, replace the line "POP PSVPAG" with POP "DSWPAG" and "POP DSRPAG". The order of the pops is important!

In port.c under in the pxPortInitialiseStack function definition, replace the lines
*pxTopOfStack = PSVPAG; pxTopOfStack++;
*pxTopOfStack = DSRPAG; pxTopOfStack++; *pxTopOfStack = DSWPAG; pxTopOfStack++

Finally in portasm_PIC24.S in the _vPortYield section, replace "PUSH PSVPAG" with "PUSH DSRPAG" and "PUSH DSWPAG", and replace the line "POP PSVPAG" with "POP DSWPAG" and "POP DSRPAG". Again, notice the order of push and pops.

These changes make FreeRTOS run on the fore mentioned micro, but I cannot guarantee that they will work under all circumstances.

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

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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

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

Xilinx Microblaze and Zynq partner