DSPRelated.com
Forums

How to get the correct LOAD address

Started by P. Meurs February 28, 2001
Who can help me,

I want to locate some memory sections inside an external memory at load
time. But they need to run from internal memory.
I know how to set up the linker command file, and that I need a routine
which takes care of copying from externam to internal memory.
But here is the problem, I only get the run-time-addresses of the
sections (.text,.bss,.data,etext,end,edata).
According to the Assembly tools reference guide I should use the .label
directive. This is nice, but I'm writing in C. How do I set the
directive there using the asm() command does not give the correct
result.

Is there anyone who has experience with this.
I only need to know the load-time-address.
REMARK:The source code is divided into several seperate files, headers,
sources and assembly.

Regards,
Patrick




For starters, I'd have a look in the map file and see if any labels are
generated for the load addresses. You may be able to use one of those
labels directly from C. I haven't tried this, I'm only guessing.

I assume you are using the C670x ?

Andrew At 07:33 AM 2/28/01 +0100, P. Meurs wrote:
>Who can help me,
>
>I want to locate some memory sections inside an external memory at load
>time. But they need to run from internal memory.
>I know how to set up the linker command file, and that I need a routine
>which takes care of copying from externam to internal memory.
>But here is the problem, I only get the run-time-addresses of the
>sections (.text,.bss,.data,etext,end,edata).
>According to the Assembly tools reference guide I should use the .label
>directive. This is nice, but I'm writing in C. How do I set the
>directive there using the asm() command does not give the correct
>result.
>
>Is there anyone who has experience with this.
>I only need to know the load-time-address.
>REMARK:The source code is divided into several seperate files, headers,
>sources and assembly.
>
>Regards,
>Patrick >_____________________________________
>Note: If you do a simple "reply" with your email client, only the author of
>this message will receive your answer. You need to do a "reply all" if you
>want your answer to be distributed to the entire group.
>
>_____________________________________
>About this discussion group:
>
>To Join: Send an email to
>
>To Post: Send an email to
>
>To Leave: Send an email to
>
>Archives: http://www.egroups.com/group/c6x
>
>Other Groups: http://www.dsprelated.com >">http://docs.yahoo.com/info/terms/
>


Thats what I already did. In the map file no labels are generated.
Only labels to the run-time-addresses are generated.
I found a suggestion on the TI-web, but it regards the cl30 linker.
I am trying this solution. It uses asm statements to place a label
(.label __load_addres) and store it in a parameter.

I found it by searching "load address", If some of you want to try it
youre selve.

I'm using the C6202 cpu, and cc-studio. DSP/BIOS is not used ! Andrew Elder wrote:
>
> For starters, I'd have a look in the map file and see if any labels are
> generated for the load addresses. You may be able to use one of those
> labels directly from C. I haven't tried this, I'm only guessing.
>
> I assume you are using the C670x ?
>
> Andrew
>
> At 07:33 AM 2/28/01 +0100, P. Meurs wrote:
> >Who can help me,
> >
> >I want to locate some memory sections inside an external memory at load
> >time. But they need to run from internal memory.
> >I know how to set up the linker command file, and that I need a routine
> >which takes care of copying from externam to internal memory.
> >But here is the problem, I only get the run-time-addresses of the
> >sections (.text,.bss,.data,etext,end,edata).
> >According to the Assembly tools reference guide I should use the .label
> >directive. This is nice, but I'm writing in C. How do I set the
> >directive there using the asm() command does not give the correct
> >result.
> >
> >Is there anyone who has experience with this.
> >I only need to know the load-time-address.
> >REMARK:The source code is divided into several seperate files, headers,
> >sources and assembly.
> >
> >Regards,
> >Patrick
> >
> >
> >_____________________________________
> >Note: If you do a simple "reply" with your email client, only the author of
> >this message will receive your answer. You need to do a "reply all" if you
> >want your answer to be distributed to the entire group.
> >
> >_____________________________________
> >About this discussion group:
> >
> >To Join: Send an email to
> >
> >To Post: Send an email to
> >
> >To Leave: Send an email to
> >
> >Archives: http://www.egroups.com/group/c6x
> >
> >Other Groups: http://www.dsprelated.com
> >
> >
> >">http://docs.yahoo.com/info/terms/
> >
>
> _____________________________________
> Note: If you do a simple "reply" with your email client, only the author of
this message will receive your answer. You need to do a "reply all" if you want
your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join: Send an email to
>
> To Post: Send an email to
>
> To Leave: Send an email to
>
> Archives: http://www.egroups.com/group/c6x
>
> Other Groups: http://www.dsprelated.com > ">http://docs.yahoo.com/info/terms/

--

/'^`\
( o o )
-=-=-=-=-=-=-=-=-=-=-=oOOO-=(_)=-OOOo=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Patrick Meurs Philips Research Laboratories Eindhoven
Building: WY6.21 Prof. Holstlaan 4
Phone: +31 40 2744224 5656 AA Eindhoven
Fax: +31 40 2744660 The Netherlands

mail to:
or to:




One option would be to manage the internal memory yourself and leave the
arrays external. If you only have a few arrays this might not work out too
badly. You could easily make up a union structure of all the internal
memory that you want to use, or you could alloc/free chunks of it at a
time. I think the TI DSP algorithm standard has some calls that help with
this sort of thing.

Andrew

At 08:07 AM 3/1/01 +0100, P. Meurs wrote:
>Thats what I already did. In the map file no labels are generated.
>Only labels to the run-time-addresses are generated.
>I found a suggestion on the TI-web, but it regards the cl30 linker.
>I am trying this solution. It uses asm statements to place a label
>(.label __load_addres) and store it in a parameter.
>
>I found it by searching "load address", If some of you want to try it
>youre selve.
>
>I'm using the C6202 cpu, and cc-studio. DSP/BIOS is not used ! >Andrew Elder wrote:
>>
>> For starters, I'd have a look in the map file and see if any labels are
>> generated for the load addresses. You may be able to use one of those
>> labels directly from C. I haven't tried this, I'm only guessing.
>>
>> I assume you are using the C670x ?
>>
>> Andrew
>>
>> At 07:33 AM 2/28/01 +0100, P. Meurs wrote:
>> >Who can help me,
>> >
>> >I want to locate some memory sections inside an external memory at load
>> >time. But they need to run from internal memory.
>> >I know how to set up the linker command file, and that I need a routine
>> >which takes care of copying from externam to internal memory.
>> >But here is the problem, I only get the run-time-addresses of the
>> >sections (.text,.bss,.data,etext,end,edata).
>> >According to the Assembly tools reference guide I should use the .label
>> >directive. This is nice, but I'm writing in C. How do I set the
>> >directive there using the asm() command does not give the correct
>> >result.
>> >
>> >Is there anyone who has experience with this.
>> >I only need to know the load-time-address.
>> >REMARK:The source code is divided into several seperate files, headers,
>> >sources and assembly.
>> >
>> >Regards,
>> >Patrick
>> >
>> >
>> >_____________________________________
>> >Note: If you do a simple "reply" with your email client, only the author of
>> >this message will receive your answer. You need to do a "reply all" if you
>> >want your answer to be distributed to the entire group.
>> >
>> >_____________________________________
>> >About this discussion group:
>> >
>> >To Join: Send an email to
>> >
>> >To Post: Send an email to
>> >
>> >To Leave: Send an email to
>> >
>> >Archives: http://www.egroups.com/group/c6x
>> >
>> >Other Groups: http://www.dsprelated.com
>> >
>> >
>> >">http://docs.yahoo.com/info/terms/
>> >
>>
>> _____________________________________
>> Note: If you do a simple "reply" with your email client, only the author
>of this message will receive your answer. You need to do a "reply all" if
>you want your answer to be distributed to the entire group.
>>
>> _____________________________________
>> About this discussion group:
>>
>> To Join: Send an email to
>>
>> To Post: Send an email to
>>
>> To Leave: Send an email to
>>
>> Archives: http://www.egroups.com/group/c6x
>>
>> Other Groups: http://www.dsprelated.com
>>
>>
>> ">http://docs.yahoo.com/info/terms/
>
>--
>
> /'^`\
> ( o o )
>-=-=-=-=-=-=-=-=-=-=-=oOOO-=(_)=-OOOo=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
>Patrick Meurs Philips Research Laboratories Eindhoven
>Building: WY6.21 Prof. Holstlaan 4
>Phone: +31 40 2744224 5656 AA Eindhoven
>Fax: +31 40 2744660 The Netherlands
>
>mail to:
>or to:


1. It seems the easiest way to do this (for code) would be to turn the cache
on. The cache automatically stores and runs code from on-chip memory.

2. If you are bootloading code, the HEX6X.EXE utility will take care of this
for you.

3. If you want to use the DMA to move code (or data) on-chip as you indicate
below. Well, there might be a better way than this, but here's a solution.

- Put the code (and/or data) you want to move into its own section. You can
do this by putting it in its own file, or better yet, use the #pragma
CODE_SECTION (#pragma DATA_SECTION) in your C code (let's call it cfile.c).

- Let's say, using the #pragma CODE_SECTION(func1, "myCode"), you named your
section "myCode". Create an assembly file (say, asmFile.asm) that contains
something like this:
.sect "myCode"
.label myCode_start

- In your linker command file, use the following:
MEMORY{
EPROM ... /*(for ... you fill in the origin & length) */
IRAM ... }
SECTIONS {
myCode{asmFile.obj(myCode),cfile.obj(myCode)}: load=EPROM, run = IRAM
}

- This should allow you to create the starting label for the EPROM location
of the code.

4. I wonder if you can do this in your linker command file (without having
to build the asmFile.asm). I got this idea from page 7-29 of the ASM Tools
Book (SPRU186g).
SECTIONS {
myCode: load = EPROM, run = IRAM
{ myCode_start = .;
cfile.c(myCode)
}
}

Note I haven't tried either of 3 or 4. But hopefully it'll give you a place
to start working from.

sns

>From: Andrew Elder <>
>To: "" <>
>Subject: Re: [c6x] How to get the correct LOAD address
>Date: Thu, 01 Mar 2001 07:08:59 -0500 >One option would be to manage the internal memory yourself and leave the
>arrays external. If you only have a few arrays this might not work out too
>badly. You could easily make up a union structure of all the internal
>memory that you want to use, or you could alloc/free chunks of it at a
>time. I think the TI DSP algorithm standard has some calls that help with
>this sort of thing.
>
>Andrew
>
>At 08:07 AM 3/1/01 +0100, P. Meurs wrote:
> >Thats what I already did. In the map file no labels are generated.
> >Only labels to the run-time-addresses are generated.
> >I found a suggestion on the TI-web, but it regards the cl30 linker.
> >I am trying this solution. It uses asm statements to place a label
> >(.label __load_addres) and store it in a parameter.
> >
> >I found it by searching "load address", If some of you want to try it
> >youre selve.
> >
> >I'm using the C6202 cpu, and cc-studio. DSP/BIOS is not used !
> >
> >
> >
> >
> >
> >Andrew Elder wrote:
> >>
> >> For starters, I'd have a look in the map file and see if any labels are
> >> generated for the load addresses. You may be able to use one of those
> >> labels directly from C. I haven't tried this, I'm only guessing.
> >>
> >> I assume you are using the C670x ?
> >>
> >> Andrew
> >>
> >> At 07:33 AM 2/28/01 +0100, P. Meurs wrote:
> >> >Who can help me,
> >> >
> >> >I want to locate some memory sections inside an external memory at
>load
> >> >time. But they need to run from internal memory.
> >> >I know how to set up the linker command file, and that I need a
>routine
> >> >which takes care of copying from externam to internal memory.
> >> >But here is the problem, I only get the run-time-addresses of the
> >> >sections (.text,.bss,.data,etext,end,edata).
> >> >According to the Assembly tools reference guide I should use the
>.label
> >> >directive. This is nice, but I'm writing in C. How do I set the
> >> >directive there using the asm() command does not give the correct
> >> >result.
> >> >
> >> >Is there anyone who has experience with this.
> >> >I only need to know the load-time-address.
> >> >REMARK:The source code is divided into several seperate files,
>headers,
> >> >sources and assembly.
> >> >
> >> >Regards,
> >> >Patrick
> >> >
> >> >
> >> >_____________________________________
> >> >Note: If you do a simple "reply" with your email client, only the
>author of
> >> >this message will receive your answer. You need to do a "reply all"
>if you
> >> >want your answer to be distributed to the entire group.
> >> >
> >> >_____________________________________
> >> >About this discussion group:
> >> >
> >> >To Join: Send an email to
> >> >
> >> >To Post: Send an email to
> >> >
> >> >To Leave: Send an email to
> >> >
> >> >Archives: http://www.egroups.com/group/c6x
> >> >
> >> >Other Groups: http://www.dsprelated.com
> >> >
> >> >
> >> >">http://docs.yahoo.com/info/terms/
> >> >
> >>
> >> _____________________________________
> >> Note: If you do a simple "reply" with your email client, only the
>author
> >of this message will receive your answer. You need to do a "reply all"
>if
> >you want your answer to be distributed to the entire group.
> >>
> >> _____________________________________
> >> About this discussion group:
> >>
> >> To Join: Send an email to
> >>
> >> To Post: Send an email to
> >>
> >> To Leave: Send an email to
> >>
> >> Archives: http://www.egroups.com/group/c6x
> >>
> >> Other Groups: http://www.dsprelated.com
> >>
> >>
> >> ">http://docs.yahoo.com/info/terms/
> >
> >--
> >
> > /'^`\
> > ( o o )
> >-=-=-=-=-=-=-=-=-=-=-=oOOO-=(_)=-OOOo=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> >
> >Patrick Meurs Philips Research Laboratories Eindhoven
> >Building: WY6.21 Prof. Holstlaan 4
> >Phone: +31 40 2744224 5656 AA Eindhoven
> >Fax: +31 40 2744660 The Netherlands
> >
> >mail to:
> >or to: >
>_____________________________________
>Note: If you do a simple "reply" with your email client, only the author of
>this message will receive your answer. You need to do a "reply all" if you
>want your answer to be distributed to the entire group.
>
>_____________________________________
>About this discussion group:
>
>To Join: Send an email to
>
>To Post: Send an email to
>
>To Leave: Send an email to
>
>Archives: http://www.egroups.com/group/c6x
>
>Other Groups: http://www.dsprelated.com >">http://docs.yahoo.com/info/terms/

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com