Link different code sections

Friends,

Can anyone please help me with the following:

My application is running from non-volatile memory mapped at

0x0000-0x4000.

I also have external RAM mapped at 0x8000 and above.

Events caused in my application changes the execution to a jump vector at the beginning of the external RAM and each of the entries at the jump vector should jump to a specific routine (or C label) residing in the external RAM (starting at the end of the jump vector).

How can I specify to the linker which code goes where?

  1. Can it use some kind of link file (if so where can I find documentation on this)?

  1. Can I solve this using in code directives?

Thanks, Runin

Reply to
runin225
Loading thread data ...

Not unless you give more details about the compiler and linker that you are using.

/Probably/

Andrew

Reply to
Andrew Jackson

Most decent, newer tool sets designed for embedded use offer some mechanism for doing this.

Note the five qualifiers in the above sentence: the first four condition the guarantee that there will be _any_ method, and the last one pretty much guarantees that you'll have to dig for it.

If your tool chain is based on the Gnu tool chain then your linker/loader will use the standard Gnu linker/loader format, and you can go with that. Otherwise, you'll have to dig through the tool chain vendor's documentation (and probably lots of example code, too) to find out what you need.

Reply with the specific tool chain you're using, and maybe there'll be someone who has experience with it who can either help you directly or point you to some documentation.

--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
Reply to
Tim Wescott

Use the "link at 8000" and "link at 0" commands. What, you don't see them? Well, maybe you aren't using the same software as I am. Just go and buy my software.

Does that give you some idea of what is missing in your query?

--
 [mail]: Chuck F (cbfalconer at maineline dot net) 
 [page]: 
            Try the download section.
Reply to
CBFalconer

at

documentation

Guys,

Thanks for the assistance and the ideas. I'm using the sdcc for the 8051. I was able to manipulate the code to the desired location by adding to the C code a naked function:

void external_memory( void ) __naked { __asm .area XSEG ; place code in external RAM

; implementation of jump vector in assembly __endasm;

// C code implementation // (jump labels are implemented in assembly as sdcc assembly // can not jump to C, vice versa) __asm .area CSEG ; return all code generation to CSEG __endasm; }

Runin

Reply to
runin225

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.