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


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 ]    [ 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