Quality RTOS & Embedded Software

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


ATXMEGA384D3 port

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


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?


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"\
"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


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.


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


Many thanks for your help.

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

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

Latest News

FreeRTOS v10.2.0 is available for immediate download. MIT licensed, and including RISC-V and ARMv8-M (Cortex-M33) demos.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

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

Xilinx Microblaze and Zynq partner