[Top][All Lists]

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

Re: [avr-gcc-list] How to define a ROM data in a perticular address?

From: Erik Christiansen
Subject: Re: [avr-gcc-list] How to define a ROM data in a perticular address?
Date: Wed, 26 Apr 2006 14:29:42 +1000
User-agent: Mutt/1.5.9i

On Mon, Apr 24, 2006 at 06:23:04PM +0530, Ruwan Jayanetti wrote:
> I need to define some data in a particular address in ROM (flash). Any
> idea how can I do this?
> I tried including an assembler file:
> .org 0x80
>  .byte 0xaa
>  .byte 0x55
> But compiler / linker don't seems to care about .org directive. The
> bytes are getting in with other program strings defined in C, but
> leaving a gap of 0x80.

Hi Ruwan,

The linker script is very convenient for managing an embedded system's
memory map. You can replace the .org with:

   .section .elephant,"a"

Then, in the linker script:


   .elephant : AT (0x12345) { *(.elephant) } > text


Where 0x12345 is your preferred flash address. You can also use
e.g. "AT (62K)"

You can also add global labels to the assembler source:

   .global message

   .section .elephant,"a"
   .asciz "Hello World"

Remember to use the avr-gcc option -T to specify your modified linker
script. There are several for each avr family, in
/usr/local/avr/avr/lib/ldscripts/avr. (Or vicinity)

As I understand it, it'll also be necessary to employ the progmem
functions if you need to access the data in C, unless your own assembler
access functions are provided.


reply via email to

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