how to define a memory position variable and give it a value

From: Mark (yodai_at_spamnot.mail.vu)
Date: 03/31/04


Date: Wed, 31 Mar 2004 13:59:47 GMT

I've already had Mark A. Odell answer this question saying this can't be
done portably. He also sugested me coming to this group with the question
see if anyone here has some idea on how to do this... I am working on a
MSP430 and using IAR ew compiler...

<reposted>
Hey all.... I'm trying to do something that should be easy, but my compiler
doesn't allow me... I am trying to define a variable into a certain memory
position and then assign a default value for it....

#define _CLAVE1 ((uint16_t*)0xD000)

//This memory position is located on a flash memory
//of an embedded system and has to have the
//startup value of '99' but it will be changed from time
//to time from inside my program, which writes into the flash...
// so I try to define it's value, but my compiler says
// "_CLAVE1 redefined" if I do this

#define ((uint16_t*)0xD000) 99

//I've tried all sorts of combinations, and still, nothing works...

Any idea on how to define a memory position and it's initial value without
initialising the value from inside the program?



Relevant Pages

  • Re: how to define a memory position variable and give it a value
    ... Mark wrote in message ... > I've already had Mark A. Odell answer this question saying this can't be ... I am trying to define a variable into a certain memory ... I don't know if this would work with the IAR compiler but it certainly does ...
    (comp.arch.embedded)
  • how to define memory position and assign number....
    ... I'm trying to do something that should be easy, but my compiler ... I am trying to define a variable into a certain memory ... //This memory position is located on a flash memory ...
    (comp.lang.c)
  • Re: WWDC -- MacBook Pro?
    ... ....but once the program has loaded it into its program memory, ... boundaries, int16 are aligned on 2 byte boundaries, int32 are ... people are always able to come up with the compiler ... Case B, same glass, same ice code water.  ...
    (comp.sys.mac.system)
  • Re: Javas performance far better that optimized C++
    ... The compiler is extremely stupid. ... no memory leaks are guaranteed. ... However I have GC in my .NET programming. ... "C.9.1 Automatic Garbage Collection ...
    (comp.lang.cpp)
  • Re: Compiler and How It Handles Scope
    ... VB's compiler isn't really "state of the art" David. ... memory, no matter how many processes map the code into their virtual address ... words, no real distinction is made between Public/Private variables, or even ... > Modules can contain Public and Private variables, ...
    (microsoft.public.vb.winapi)