[En-Nut-Discussion] Function placed in iram
enut at cicely.de
Wed May 12 21:35:48 CEST 2010
On Wed, May 12, 2010 at 07:08:24PM +0200, Andre Riesberg wrote:
> Hello all,
> I try to place a function in the internal RAM of an AT91SAM7SE512 (the
> board is the EIR).
> First I add to linker script (at91sam7se512_rom.ld) this lines:
> .iram :
> . = ALIGN(4);
> } > iram
> My test function looks like this:
> static uint32_t __attribute__ ((section(".iram"),used)) Test(void)
> return (uint32_t) &Test;
> Compile and link are successful. But OpenOCD give me this message:
> writing 262144 bytes only - as image section is 2097164 bytes and bank
> is only 262144 bytes
> My application works correct, the result of function Test() is 0x200000.
> The generated .bin file is more then 2MByte big and mostly filled with
> 0x00's. It looks that the complete area from the end of my application
> up to the Test() function is filled with 0x00's.
> When I place then Test() function in then .data section the generated
> .bin file is much smaller and works correct too (the result of Test() is
> now 0x20000000).
> I think with the attribute .data the Test() function is placed in the
> flash and copy during startup to the external RAM.
> Whats the way to have the same functionality with .iram ?
The AT keyword in the loader script is the key to get the it relocated
into flash starting at __extext rom address.
It gets later copied to ram in arch/arm/init/crtat91sam7sex_rom.S.
The problem might be to setup an additional __etext, since you must
know the size of data as an offset - there is surely a way, but I'm
not an ld-script exptert.
B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
More information about the En-Nut-Discussion