Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » AVR-GCC
  • » [avr-gcc-list] use of specific RAM location [RSS Feed]

#1 Nov. 29, 2005 03:41:10

Erik C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

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


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:

MEMORY
{
...

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

SECTIONS
{
...

.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. ;-)

YMMV,
Erik


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

  • Root
  • » AVR-GCC
  • » [avr-gcc-list] use of specific RAM location [RSS Feed]

Board footer

Moderator control

Enjoy the 20th of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support