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


ISB isntructions on Cortex-M4 port

Posted by npoulokefalos on March 11, 2017


I have a question for the ISB instruction usage in GCC ARM_CM4F port [FreeRTOS v9.0.0].

It is used inside xPortPendSVHandler() after:

"    mrs r0, psp                            \n"
"    isb    

and after:

"    msr psp, r0                            \n"
"    isb    

In constrast, ISB is not used in the GCC ARMCM4MPU port when PSP is loaded/stored. Is there any reason for why this is required in one case and not to the other? I just need to verify that i am not missing something.

I am also curious about the ISB in the fist scenario, after "mrs r0, psp". Why it is needed?

ISB isntructions on Cortex-M4 port

Posted by rtel on March 12, 2017

The ISB instructions are required to be in strict compliance with the ARM Cortex-M specification. However for a long time actual purchasable implementations of the architecture did not, in practice, need the instructions. That changed a little while back, especially when the Cortex-M7 came out, and as the Cortex-M4F port is also used on Cortex-M7 chips the Cortex-M7 port was updated accordingly. The instructions should also be included in the MPU port too, as they become more relevant, and will be added.

ISB isntructions on Cortex-M4 port

Posted by npoulokefalos on March 12, 2017

Thanks for the reply,

To my knowledge, at least for te M4 port, the ISB would be required when MSR is used on the stack pointer currently used. Etc "MSR msp, r0" from whithin an ISR with subsequent push/pop instructions or in thread mode if MSP is also used there.

I am not familiar with Cortex M7, but is there any actual case where "MRS r0, psp" (not MSR) would require an ISB? Or it is just used after MSR/MRS in any case -- even if next instructions does not require it, just to be inline with the specification?

ISB isntructions on Cortex-M4 port

Posted by rtel on March 12, 2017

You may be right, that it is not required when moving from a special purpose register into a general purpose register. Having a look at the the source code I can only see one place where an MRS is followed by an ISB, and that is at the start of the PendSV handler.

[ 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