My program needs lots of dynamic (heap) memory so I had to move it out of the internal RAM and into SDRAM. I made a modified version of the loader script from C:\Cygwin\usr\local\avr32\lib\ldscripts\avr32elf_uc3a0512.x into the project directory as Seneca.lds. I changed the heap specification to:
__heap_start__ = 0xD0000000;
__heap_end__ = 0xD2000000;
and added the following to the AVR32/GNU C Linker command:
The problem that I ran into is apparently somewhere in the startup code it actually does some sort of initialization of the heap area. Of course since the SDRAM controller isn't running this doesn't work.
I had written a test pattern into the SDRAM after initializing the controller as a simple test but this test pattern caused to malloc to fail after about 360Kbytes. Clearing the beginning of the heap area caused malloc to fail immediately. Setting the first 4096 bytes (I didn't determine how many bytes I had to set) to 0xFF seems to make malloc work all the way up to the end of the heap.
I just thought I would let others know of this trap. Unfortunately I just did this by testing, I have no idea what really should be written into the beginning of the heap. Maybe someone else knows.