简体   繁体   中英

Porting FreeRTOS to Arduino MEGA 2560 Rev3 (ATmega2560)

I'm currently implementing a FreeRTOS -based program on the Arduino platform.

I would like to use the Arduino MEGA 2560 Rev3 (which is based on an ATmega2560 ) for this project, but I couldn't find a working port.c file.

Could anyone please share a working port.c ?

I'm using Eclipse IDE, WinAVR , AVR Plugin , Arduino Lib , FreeRTOS 7.6.0 (I will eventually switch to v8.0.0) and C++ as the main programming language.

Thanks.

EDIT:

I've came across avrfreertos which generates a FreeRTOS static library for the ATmega2560, but when I link my project against it, I get the following error:

c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/bin/ld.exe: section .task [00003282 -> 0000328f] overlaps section .data [00003282 -> 0000339d]
make: *** [MY_PROJECT_NAME.elf] Error 1

EDIT:

I found a fix for the linking problem

Your issue is resolved by the change to avr6.x as you found. There is a .task attribute included in the portmacro.h file, which is needed to keep the freeRTOS task you define in the lower part of flash.

Good news. There are some updates in the latest avrbinutils and avrlibc 1.8.0 that include a .lowtext attribute, which has similar functionality to the .task attribute I added to the avr6.x file.

In the port for freeRTOS800 I changed the attribute defined in portmacro.h to point to .lowtext. This means there is no need to change the avr6.x file any more.

Either, change to use the freeRTOS800 port AVRfreeRTOS or just make the change in portmacro.h yourself.

For further reference, I've made an Arduino Library that can be included in Arduino to get experience with freeRTOS on any AVR device.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM