Where did you get the RTOS code from? The one in the FeeRTOS download supports the older ES AVR32 parts. Atmel have their own version for the newer parts in their Atmel software framework.
I started with v7.0.1 downloaded directly from the FreeRTOS site but with "exception.S" replaced with "exception.x" from the ATMEL SWF 1.7.0. The 'exception.S' provided by FreeRTOS just does not compile as it contain invalid references (now that you mentioned it, it is possible those are just old references, ex. 'AVR32_INTC_IPR0_INTLEV_OFFSET').
So, I then rolled back to v7.0.0 that comes in the ATMEL ASF 2.0 (including the ASF 2.0 exception.S that I had renamed to exception.x and added the 'ipr_val' definition as in exception.x from INTC driver to make it work). The problem persisted.
Something I haven't mentioned in the issue description is that before getting hanged at the idle task it was hanging at an "Instruction Address (alignment) Exception". After disabling size optimization on the FreeRTOS files that exception went away.
Now, I am looking at the "old" exception.S provided with the latest FreeRTOS release and if has a portion of code that has no equivalent in the ATMEL provided exception.S that reads:
#if 1 // B1832: interrupt stack changed to exception stack if exception is detected.
mfsr r12, AVR32_SR
bfextu r12, r12, AVR32_SR_M0_OFFSET, AVR32_SR_M0_SIZE + AVR32_SR_M1_SIZE + AVR32_SR_M2_SIZE
cp.w r12, 0b110
lddsp r12, sp[0 * 4]
stdsp sp[6 * 4], r12
lddsp r12, sp[1 * 4]
stdsp sp[7 * 4], r12
lddsp r12, sp[3 * 4]
sub sp, -6 * 4
...normal interrupt code follows
wondering if not having this code in place is masking another problem that may not have completely gone by disabling optimization.
I am now trying to match the compile options used in the FreeRTOS example with the ones in my project.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.