Ravi Gautam

Variable declaration at a hard coded address

Discussion created by Ravi Gautam on May 5, 2008
Latest reply on May 8, 2008 by Pascal Irrle

Hi there!
I've got a problem and have not been able to solve it for weeks. I've tried what ya'll had suggested-without much luck.
PLEASE GIVE ME A SIMPLE SOLUTION. MAYBE 4-5 lines of sample code?? PLEAE PLEASE PLEASE!
What I want to do:
1. Declare a variable at a fixed address location and be able to use it from wherever.
What I did:
dword _FLASHAddr:smileyvery-happy:VECT_FLASH_ADDR;
word  _FLASHData:smileyvery-happy:VECT_FLASH_DATA;
When I do this and compile I get a linker error. Says " Link Error: Undefined: "F_FLASHAddr" Referenced from ...."
Aparently I need to do something in the linker as well? What do I need to do?

2. Say I have a function called Boot(). I also have a hard coded constant variable CVECT_BOOT = some location in program memory. I want to be able to invoke function boot by calling a constant function pointer to CVECT_BOOT.
For example in SiLabs IDE I do both A and B:
A. In STARTUP.51 I specify the jump table for shared functions.
                                CSEG    AT      0x007B
                                EXTRN   CODE (boot)
                                AJMP        Boot
B. ((void (code *) (void)) 0x007B)();  // this calls my function boot

How do I do A and B in codewarrior?

Guys your help will be hugely hugely appreciated. Thanks in advance.

 

Installed_Plugins.txt

Message Edited by t.dowe on 2009-10-15 05:44 PM

Outcomes