FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [March 2017 Threads] PIC32MZ EF with FPU AddressErrorException in isrPosted 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 isrPosted 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 isrPosted 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!
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|