Another possibility is to use part of the sections that specifies where
each variable gets stored (doesn't have to be one section per variable).

SECTIONS {
  .aSection 0x0100:
  {
     Var1 = 0x600;  /* 0x600 rel to 0x0100, ABS is 0x0700 */
     Var2 = 0x602;
     Var3 = 0x604;
  }
}

This is basically useful if you want to keep your C code standard and put
all the non-standard stuff elsewhere.

P.S. Sry Peter, meant to send this to the list the first time.


>
> On Mon, Dec 12, 2011 at 1:39 PM, Peter Bigot <big...@acm.org> wrote:
>
>> On Mon, Dec 12, 2011 at 2:31 PM, Timothy Logan <timothy.lo...@gmail.com>
>> wrote:
>> > Hello,
>> >
>> > I am porting some code from IAR which involves me having to place a few
>> > different structures in very specific addresses in the MSP430 memory.
>> >
>> > In IAR there is a pragma to do it:
>> > http://supp.iar.com/Support/?note=27787&from=search+result
>> >
>> > The way I see doing it in mspgcc is to create a custom linker script
>> with
>> > custom memory sections, and simply use the "section" attribute to manage
>> > specific variable memory locations in declarations. This seems a little
>> > overkill though as I would have to make different memory sections for
>> each
>> > variable and would have to rewrite the entire memory table as a side
>> > effect.
>> >
>> > My question: Is there an easier way to control which address in memory a
>> > variable/structure is stored in without having to muck around with
>> linker
>> > scripts?
>>
>> You can use asm statements, as are done with the peripheral register
>> declarations.  Something like:
>>
>> volatile unsigned int specialdata __asm__("0x1320");
>>
>> will force the definition of specialdata to be placed at address 0x1320.
>>
>> If the structures are related to peripheral registers, the addresses
>> may already be defined.  If you need things to be placed in
>> information memory, then there are existing sections appropriate for
>> that.
>>
>> Peter
>>
>> >
>> > Tim
>> >
>> >
>> ------------------------------------------------------------------------------
>> > Learn Windows Azure Live!  Tuesday, Dec 13, 2011
>> > Microsoft is holding a special Learn Windows Azure training event for
>> > developers. It will provide a great way to learn Windows Azure and what
>> it
>> > provides. You can attend the event by watching it streamed LIVE online.
>> > Learn more at http://p.sf.net/sfu/ms-windowsazure
>> > _______________________________________________
>> > Mspgcc-users mailing list
>> > Mspgcc-users@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>> >
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Windows Azure Live!  Tuesday, Dec 13, 2011
>> Microsoft is holding a special Learn Windows Azure training event for
>> developers. It will provide a great way to learn Windows Azure and what it
>> provides. You can attend the event by watching it streamed LIVE online.
>> Learn more at http://p.sf.net/sfu/ms-windowsazure
>> _______________________________________________
>> Mspgcc-users mailing list
>> Mspgcc-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>>
>
>
------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to