Happy Friday!
I'm working with this processor: http://www.a-2.com/Datasheets/A2P3_base_datasheet_NIS.pdf I don't have a lot of data on the processor, but I'm working on it. I'm using these tools: http://www.adveda.com/ I have a user's manual, but it's at work and I can't link to it now.
Anyway, the guy who had this project before me (whereabouts unknown) had some kind of magic way of forcing variables into the exact memory addresses he wanted. The data memory is a 32KB sram mapped to starting address 0x1c000. The linker script has variable space (.bss) mapped to 0x20500. However, when I compile my program, the variables are mapped as such:
var1 => 0x21514
var2 => 0x21518
etc...
At first, I thought the software was ignoring the linker script, but after contemplating over massive amounts of beer, I decided the compiler was complying with the linker script, because the variables are indeed stored within the .bss space. So, I summize that the compiler doesn't necessarily start variable storage at the beginning of the .bss space. But as I said, the guy before me make his variables go straight into the beginning of the space. I don't have the juju, so I get a work-around thusly:
#define var1 (*(unsigned int *)(&0x20500))
#define var2 (*(unsigned int *)(&0x20504))
etc.
This seems to work well enough, but still I'd like to be able to restore the software to its former glory. Also, his declarations look like this:
unsigned var1;
unsigned var2;
...
extern unsigned var1;
extern usninged var2;
...
And he has some kind of magic linker that assigns the correct address, but I don't have any idea how to do this. I'm at a loss, does anyone have a suggestion?
I'm working with this processor: http://www.a-2.com/Datasheets/A2P3_base_datasheet_NIS.pdf I don't have a lot of data on the processor, but I'm working on it. I'm using these tools: http://www.adveda.com/ I have a user's manual, but it's at work and I can't link to it now.
Anyway, the guy who had this project before me (whereabouts unknown) had some kind of magic way of forcing variables into the exact memory addresses he wanted. The data memory is a 32KB sram mapped to starting address 0x1c000. The linker script has variable space (.bss) mapped to 0x20500. However, when I compile my program, the variables are mapped as such:
var1 => 0x21514
var2 => 0x21518
etc...
At first, I thought the software was ignoring the linker script, but after contemplating over massive amounts of beer, I decided the compiler was complying with the linker script, because the variables are indeed stored within the .bss space. So, I summize that the compiler doesn't necessarily start variable storage at the beginning of the .bss space. But as I said, the guy before me make his variables go straight into the beginning of the space. I don't have the juju, so I get a work-around thusly:
#define var1 (*(unsigned int *)(&0x20500))
#define var2 (*(unsigned int *)(&0x20504))
etc.
This seems to work well enough, but still I'd like to be able to restore the software to its former glory. Also, his declarations look like this:
unsigned var1;
unsigned var2;
...
extern unsigned var1;
extern usninged var2;
...
And he has some kind of magic linker that assigns the correct address, but I don't have any idea how to do this. I'm at a loss, does anyone have a suggestion?