Topic : How to put a C-function on a fixed address?

Forum : 8051

Original Post
Post Information Post
September 9, 2009 - 9:49am
Guest

Hi,

I need to bootload the AT98C51CC03 at (for example) address 0xC000.

This address can be set by the Atmel Flip application.

But how do I make some C-function in my source code, start at this address 0xC000?

Thanks,

Henk

Replies
Post Information Post
+1
0
-1
September 10, 2009 - 10:11am
Raisonance Support Team

Hi Henk,

On the Raisonance Compiler, you can just use the "at" absolute qualifier this way:

at 0xC000 myfunc(void)
{
    // ... code here
}

The linker will locate the myfunc() function at address 0xC000. There is no need for linker scripts or specific commands.

Regards,
Bruno

+1
0
-1
September 15, 2009 - 11:45am
Guest

Hi Bruno,

Great!

but an additional question is:

How do I make (not only just one single) but a series of (bootloader) c-functions be stored starting from address 0xC000?

thanks

Henk

+1
0
-1
September 15, 2009 - 2:25pm
Raisonance Support Team

Henk,

To relocate a set of functions, put them in the same file and use the linker CODE directive.

If your file is FOO.C with main and bye functions.

CODE(?PR?MAIN?FOO(0xC000),?PR?BYE?FOO)

will locate main at 0xC000 followed by bye.

To properly retreive the segment names, copy them from your map file (.M51)

This process is explained in the linker documentation.

Stéphane