carlosdelfino/DuinOS — pull request #8 by niesteszeck (2013-03-20 16:20:45+00:00)
Title: Mega2560

Some days ago I found this thread
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=70387

They mentiones that the avr gcc has a problem with the 3 byte PC pointer.
After investigating on the web, the avr gcc has a workarround to solve this, and make trampolins (stubs) ('cause atmega2560 has 256 KBi of flash memory and 2 byte pointer works only for 128)
The problem (as discused on avr freack) is that the task function cant be in the upper part of the memory 'cause avr gcc is going to give us only a 2 byte pointer, and we have to force to have the task functions on the lower part of memory. This is achieved by ussing the atribute .task and making a change to the linker script.

I also made a branch to prove that the pointer is 2 byte wide and not 3 mega2560_fpointerTest if somemone one to see a test to this, or to check, in a future avr gcc release, if they solve the problem (not expected)