ATXMEGA384D3 port

Hi,
I am relatively new to the free RTOS but have been developing some new code using it and things have been progressing pretty well. That is until I have reached a certain code size on my device > 78500. Now when I try to delete the first startup task my code resets. I realize there is no official port but wonder if there are some pointers as to what is going wrong.
Heap and stack are ok plenty of space there.
I have enabled task delete and suspend. (using either from within the task cause a re start) Any suggestions greatly received. Jay

ATXMEGA384D3 port

Where did you get the code from?  The official ATMega port does not support the larger memory devices.  Supporting the larger memory devices is, I believe, quite straight forward and requires that a couple of extra RAMn registers are saved in the task context.  Is your port doing that? Regards.

ATXMEGA384D3 port

I got this after looking at various port attempts so couldn’t be exactly sure where it came from now.
save context is as below. #if defined(__AVR_ATxmega384D3__)
/* 3-Byte PC Save */
#define portSAVE_CONTEXT()
asm volatile ( “push r0 nt”
“in r0, __SREG__ nt”
“cli nt”
“push r0 nt”
“push r1 nt”
“clr r1 nt”
“push r2 nt”
“push r3 nt”
“push r4 nt”
“push r5 nt”
“push r6 nt”
“push r7 nt”
“push r8 nt”
“push r9 nt”
“push r10 nt”
“push r11 nt”
“push r12 nt”
“push r13 nt”
“push r14 nt”
“push r15 nt”
“push r16 nt”
“push r17 nt”
“push r18 nt”
“push r19 nt”
“push r20 nt”
“push r21 nt”
“push r22 nt”
“push r23 nt”
“push r24 nt”
“push r25 nt”
“push r26 nt”
“push r27 nt”
“push r28 nt”
“push r29 nt”
“push r30 nt”
“push r31 nt”
“lds r26, pxCurrentTCB nt”
“lds r27, pxCurrentTCB + 1 nt”
“in r0, 0x3d nt”
“st x+, r0 nt”
“in r0, 0x3e nt”
“st x+, r0 nt”
);

ATXMEGA384D3 port

Just from a brief look, without referring to the manuals, I think you need to also be storing RAMX and RAMY (or something like that) in addition to the registers in your post if you want to go above 64K.  You would also need to have initial values for the extra registers in the stack setup for a task when the task is created. Have a look at the Atmel forum in http://interactive.freertos.org to see if you can find an example.  You can also ask on http://www.avrfreaks.net Regards.

ATXMEGA384D3 port

Looking at the manual the x y and z registers run from R26 to R31. Not really sure how to use them in this instance though. Apologies. Rgards

ATXMEGA384D3 port

I have now resolved my issue. The problem was in the pxPortInitialiseStack function. The issue was with the program counter being larger than 16bit. I used yuris from https://github.com/yuriykulikov/FreeRTOS-on-XMEGA Regards Many thanks for your help.