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




Loading

PIC32MZ EF with FPU AddressErrorException in isr

Posted by poweruli on March 28, 2017

Hello,

the xISRStack needs to be 8 Byte aligned for PIC32 MZ EF with FPU and it is not 8 byte aligned.

Error occurs only when the hardware floating point option is released in the compiler.

The MIPS® Architecture For Programmers manual is written: Restrictions: An AddressErrorException occurs if EffectiveAddress2..0 ≠ 0 (not doubleword-aligned).

Original FreeRTOS V9.00 Source: File port.c Line 192:

StackTypet xISRStack[ configISRSTACKSIZE ] = { 0 }; const StackTypet * const xISRStackTop = &( xISRStack[ configISRSTACKSIZE - 7 ] );

My suggestion to improve is :

StackTypet attribute ((aligned (8))) xISRStack[ (configISRSTACK_SIZE & 0xFFFFFFFE) ] = { 0 }

const StackTypet * const xISRStackTop = &( xISRStack[ (configISRSTACK_SIZE & 0xFFFFFFFE) - 8 ] );

Best regards,

Uli


PIC32MZ EF with FPU AddressErrorException in isr

Posted by rtel on March 28, 2017

Hi Uli - thanks for taking the time.

This problem was already noted, although the fix in not publicly available yet. The relevant part of the updated code is below. I would be grateful if you could try it and confirm it fixes your issue. The original code is commented out, and the replacement code following immediately after:

/* The stack used by interrupt service routines that cause a context 
switch.  8
byte alignment is required to allow double word floating point stack pushes
generated by the compiler. */
//StackType_t xISRStack[ configISR_STACK_SIZE ] = { 0 };
StackType_t xISRStack[ configISR_STACK_SIZE ] __attribute__ ( ( aligned( 
8 ) ) ) = { 0 };

/* The top of stack value ensures there is enough space to store 6 
registers on
the callers stack, as some functions seem to want to do this. */
//const StackType_t * const xISRStackTop = &( xISRStack[ 
configISR_STACK_SIZE - 7 ] );
const StackType_t * const xISRStackTop = &( xISRStack[ 
configISR_STACK_SIZE - 8 ] );

PIC32MZ EF with FPU AddressErrorException in isr

Posted by poweruli on March 29, 2017

Hi Real Time Engineers,

this code fixed the issue and it's semilar to my suggestion, excecpt the optional mask (configISRSTACKSIZE & 0xFFFFFFFE). I have made this to ensure that any defenition of configISRSTACKSIZE size will work. Default is 400 and it's ok, but odd sizes may result in 4 Byte aligned top of stack. An additional information text in the FreeRTOSConfig.h would also be useful.

Thank you also for your quick response!


[ 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