Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

RE: [lpc2000] How to specify the location of an object in memory(GNU)

2005-11-01 by Michel Kuenemann

Hi David,

You are completely right, I can give any adress the way you show it in your
example.

I can write

long *l = (long *) 0x00016000;

instead of declaring a section beginning at a given address in the linker
script.

Let's say it was a kind of exercise :-)

Regards

Michel Kuenemann


  -----Message d'origine-----
  De : lpc2000@yahoogroups.com [mailto:lpc2000@yahoogroups.com]De la part de
David Hawkins
  Envoyé : mardi 1 novembre 2005 21:45
  À : lpc2000@yahoogroups.com
  Objet : RE: [lpc2000] How to specify the location of an object in
memory(GNU)




  Hey Michel,

  Michel wrote:
  > I am using the KEIL IDE for ARM7 processors with the GNU Cygnus
  > compiler on a LPC2106 target. My problem is that I cannot find
  > in the documentation how to tell the compiler to locate an object
  > at a specified place (somwhere in flash memory, for instance).
  > at 0x00016000 int base;

  TomW replied with:
  > That would be the linker that would do the physical location of things.
  >
  > Compilers build relocatable objects, linkers place those into regions
  > that you specify in the linker file (script).

  Could you please tell us WHY you want to do this?

  The only time I can ever think of needed to force a particular
  code at a specific address is;

    a) an exception vector(s)
    b) an overlay for a set of device control registers

  For (a) you can define a section, and use the linker script to
  perform the locating in Flash. For (b), I've always found it
  nicer to just use a pointer to the peripherals region instead,
  eg.

    typedef struct serial {
        int control;
        int status;
        int data;
    } serial_t;

    serial_t *com1 = (serial_t *)(SERIAL_BASE_ADDR);

    registers are accessed as com1->control = ...

  If you use the linker to link this structure over a specific range
  of addresses, then the syntax changes to com1.control = ...
  But you have to do more work with the linker script.

  So, perhaps you are trying to implement something the
  difficult way, tell us what you are trying to do.

  Cheers,
  Dave





----------------------------------------------------------------------------
--
  YAHOO! GROUPS LINKS

    a..  Visit your group "lpc2000" on the web.

    b..  To unsubscribe from this group, send an email to:
     lpc2000-unsubscribe@yahoogroups.com

    c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.


----------------------------------------------------------------------------
--



[Non-text portions of this message have been removed]

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.