Quality RTOS & Embedded Software

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


Upgrading from V4.1.3 to V5.0.3 for dsPic

Posted by dennis on December 30, 2008
I am trying to switch from V4.1.3 to V5.0.3 for dsPIC port. When I do so, I found the following code changes:

The code in V4.1.3 used to be:
#define portINTERRUPT_BITS( 0x00e0 )

Now in V5.0.3, the code becomes:
#define portINTERRUPT_BITS( ( unsigned portSHORT ) configKERNEL_INTERRUPT_PRIORITY << ( unsigned portSHORT ) 5 )


I don't quite understand why in V5.0.3, portINTERRUPT_BITS depends on configKERNEL_INTERRUPT_PRIORITY. In doing so, isn't it correct to say that: critical tasks are not be protected from interrupts whose priority is greater than configKERNEL_INTERRUPT_PRIORITY?

For example, if configKERNEL_INTERRUPT_PRIORITY = 0x01 (by default),


//do something
//do something //<-- may be interrupted by ISR
//do something224


If I want to shield all interrupts, then I need to set portINTERRUPT_BITS to 0x07, and change the #32 in vPortYeild in portasm_dsPIC.S to #224, right?

Many thanks.


RE: Upgrading from V4.1.3 to V5.0.3 for dsPic

Posted by Dave on December 30, 2008
Take a look at the following links:

http://www.freertos.org/portpic24_dspic.html ("configuration and usage details section")

For converting to 5.x

RE: Upgrading from V4.1.3 to V5.0.3 for dsPic

Posted by dennis on January 5, 2009
Thank you for the information.

May I just confirm with you my understanding that:

A task critical section (taskENTER_CRITICAL(), taskEXIT_CRITICAL(), taskDISABLE_INTERRUPTS(), taskENABLE_INTERRUPTS()) can now be interrupted by interrupts that are set above the kernel interrupt priority.

And, if I really want to exclude all interrupts from a section of code, I need to create my own API such as:
#define portINTERRUPT_BITS ( 0x00e0 )
#define cli() SR |= portINTERRUPT_BITS
#define sti() SR &= ~portINTERRUPT_BITS

cli(); //clear interrupt

//do something
//do something //<-- may be interrupted by ISR
//do something

sti(); //set interrupt

RE: Upgrading from V4.1.3 to V5.0.3 for dsPic

Posted by Dave on January 5, 2009
I'm not sure if the taskENABLE/DISABLE_INTERRUPTS() macros will completely disable and enable all interrupts or not, you will have to check their definition. Normally these macros are not used directly because they don't keep track of the nesting depth like the ENTER/EXIT_CRITICAL() macros do.

If you want all interrupts to be disabled all the time then set configMAX_SYSCALL_INTERRUPT_PRIORITY to be the highest priority there is. Otherwise, if the other macros don't do what you want, then you can declare your own as you say.

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

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

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo & Nuvoton Cortex-M23 demo.

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

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

Cadence Tensilica Cortes

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