[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] use of specific RAM location

From: Erik Christiansen
Subject: Re: [avr-gcc-list] use of specific RAM location
Date: Tue, 29 Nov 2005 14:36:15 +1100
User-agent: Mutt/1.5.6+20040722i

An attractive alternative is for the linker script to define, and
document in a single place, the complete memory map of the board, with a
MEMORY segment for each device region in the address space:


   sram     : ORIGIN = 0x0200000, LENGTH = 0x010000   /* 64K RAM */
   fpga_reg : ORIGIN = 0x0100000, LENGTH = 0x100      /* Thingy  */


   .fpgareg (NOLOAD) : { *(.fpgareg) } > fpga_reg


Then, in a C header, declare a struct for the fpga registers, and make
it "__attribute__ ((section(".fpgareg")));" Compiler and linker then
place it at the ORIGIN specified for fpga_reg.

Now, when the board changes, and those fifty different pesky addresses
move, it's all updated in the linker script. The code then only deals
with abstractions, and has no magic numbers. The linker script
encapsulates the hardware addressing issues. Nice and orderly. ;-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]