avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Allocating variables to a fixed address


From: Robert von Knobloch
Subject: Re: [avr-gcc-list] Allocating variables to a fixed address
Date: Mon, 11 May 2009 14:55:17 +0200
User-agent: Thunderbird 1.5.0.14 (X11/20060911)

Weddington, Eric wrote:
> Why do you need global variables to be at a specific address?
>   
Because my software consists of a:
A fixed part - main plus User Interface - This is test equipment for
small electronic products
and
Several loadable parts which can be loaded via rs232 as Intel hex and
'blown' into the flash as required - These are custom-built for each
product.
The entire code is one entity, loadables will be added and removed and I
cannot have this affecting the main code.

I need separation so that updates to any part of the software do not
disturb the relationship between the main part and the 'loadable' parts.
To this end, I need to fix all calls & variables that are common to the
2 parts of the system - what I am calling an 'API'.

I thought that I had the flash part all under control but now see that
the compiler is out to get me again:

I have defined all cross-module routines and give them 'psuedo-calls' in
a vector table so:

/*
******************************************************************************
* Function entry points for independent test routines
******************************************************************************
*/

// LCD Display
FUNCTION_SECTION NOINLINE void test_lcd_2(PGM_P string)
{
prog_lcd_string2(string);
}

FUNCTION_SECTION NOINLINE void test_lcd_string(PGM_P string)
{
prog_lcd_string(string);
}

FUNCTION_SECTION NOINLINE void test_clearlcd2(void)
{
clearlcd2();
}

FUNCTION_SECTION NOINLINE void test_lcd_hex4out(uint8_t byte)
{
return lcd_hex4out(byte);
}

FUNCTION_SECTION NOINLINE void test_lcd_hex8out(uint8_t byte)
{
return lcd_hex8out(byte);
}

FUNCTION_SECTION NOINLINE void test_lcd_hex16out(uint16_t word)
{
return lcd_hex16out(word);
}
................../snip

Where FUNCTION_SECTION is located at 0xff00

Now I see that the compiler is no longer preserving the order of these
vectors:

avr-nm -n main.elf gives:

0000ff00 T test_read_mSecDownCnt
0000ff10 T test_write_mSecDownCnt
0000ff1e T test_geta2d
0000ff3c T test_nSec400Wait
0000ff42 T test_lcd_hex4out
0000ff48 T test_lcd_hex8out
0000ff4e T test_lcd_hex16out
0000ff54 T test_lcd_string
0000ff5a T test_clearlcd2
0000ff60 T test_lcd_2
0000ff66 T test_milliSecDelay
0000ff6c T test_getkey
0000ff72 T test_getkey_blink
0000ff78 T test_pollkey
0000ff7e T test_isp_connect
0000ff84 T test_flash_read
0000ff8a T test_flash_write
0000ff90 T test_eeprom_read
0000ff96 T test_eeprom_write
0000ff9c T test_fuse_read
0000ffa2 T test_fuse_write
0000ffa8 T test_isp_disconnect

Is there a way to achieve this? The project is much too big for
assembler (not enough time & maintenance).
I can force variable access through functions, of couse. But this
doesn't help when I can't trust my vector table to stay constant.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]