Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

ATXMEGA384D3 port

Posted by Jay on March 12, 2013
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

RE: ATXMEGA384D3 port

Posted by Richard on March 12, 2013
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.

RE: ATXMEGA384D3 port

Posted by Jay on March 12, 2013
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 ("pushr0\n\t"\
"inr0, __SREG__\n\t"\
"cli\n\t"\
"pushr0\n\t"\
"pushr1\n\t"\
"clrr1\n\t"\
"pushr2\n\t"\
"pushr3\n\t"\
"pushr4\n\t"\
"pushr5\n\t"\
"pushr6\n\t"\
"pushr7\n\t"\
"pushr8\n\t"\
"pushr9\n\t"\
"pushr10\n\t"\
"pushr11\n\t"\
"pushr12\n\t"\
"pushr13\n\t"\
"pushr14\n\t"\
"pushr15\n\t"\
"pushr16\n\t"\
"pushr17\n\t"\
"pushr18\n\t"\
"pushr19\n\t"\
"pushr20\n\t"\
"pushr21\n\t"\
"pushr22\n\t"\
"pushr23\n\t"\
"pushr24\n\t"\
"pushr25\n\t"\
"pushr26\n\t"\
"pushr27\n\t"\
"pushr28\n\t"\
"pushr29\n\t"\
"pushr30\n\t"\
"pushr31\n\t"\
"ldsr26, pxCurrentTCB\n\t"\
"ldsr27, pxCurrentTCB + 1\n\t"\
"inr0, 0x3d\n\t"\
"stx+, r0\n\t"\
"inr0, 0x3e\n\t"\
"stx+, r0\n\t"\
);

RE: ATXMEGA384D3 port

Posted by Richard on March 12, 2013
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.

RE: ATXMEGA384D3 port

Posted by Jay on March 12, 2013
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

RE: ATXMEGA384D3 port

Posted by Jay on March 12, 2013
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.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS