Seems to be Ok , Oleg.
I just cannot remember everything :)
I'll thing if I"ll add some overlay sections to binutils.
Juts have to figure out which ones and how.
~d
On Monday 17 February 2003 21:42, Oleg Skydan wrote:
> Hi, All !
>
> I want to tell about the simple and very convenient solution of my problem.
>
> I used a custon linker script and __attribute__ keyword.
>
> for example define somewhere in the sources:
>
> int __attribute__((section (".finput, \"aw\", @nobits;"))) a;
> int __attribute__((section (".finput, \"aw\", @nobits;"))) b;
> char __attribute__((section (".bandscope, \"aw\", @nobits;"))) c[10];
>
>
> then copy standard linker scrip to your project and add the following
> to the SECTIONS after definition of .noinit section:
>
> OVERLAY SIZEOF(.noinit) + ADDR(.noinit) :
> {
> .bandscope
> {
> *(.bandscope)
> *(COMMON)
> }
> .finput
> {
> *(.finput)
> *(COMMON)
> }
> } > data
>
> then pass --script=scriptname option to the ld
>
> Ad you will get the two overlapped sections in the RAM!
>
> It is a very convenient and flexible method if you want to reduce memory
> requirements
> by using the same address space for the variable that have no simultaneous
> use and
> could not declare them as locals.
>
> To Dmitry: Please let me know am I correct ?
>
> The output of .map file (for the real program, not for the above sample) is
> here (and it
> seems all is OK):
>
> .bandscope 0x00000758 0x58
> *(.bandscope)
> .bandscope 0x00000758 0x58 ScopeScrn.o
> 0x00000760 Spectrum
> 0x00000758 ScopeVFO
> *(COMMON)
> 0x00000758
> __load_start_bandscope=LOADADDR(.bandscope)
> 0x000007b0
> __load_stop_bandscope=(LOADADDR(.bandscope)+SIZEOF(.bandscope))
>
> .finput 0x00000758 0xa load address 0x000007b0
> *(.finput)
> .finput 0x00000758 0xa FInpScrn.o
> 0x00000758 FInpVal
> 0x00000760 Pos
> *(COMMON)
> 0x000007b0
> __load_start_finput=LOADADDR(.finput)
> 0x000007ba
> __load_stop_finput=(LOADADDR(.finput)+SIZEOF(.finput))
> 0x000007b0
> .=(ADDR(.bandscope)+(SIZEOF(.bandscope)6SIZEOF(.finput)))
>
>
> All the best !
> Bye,
> Oleg.
>
> ----- Original Message -----
> From: "Dmitry" <[email protected]>
> To: <[email protected]>
> Sent: Saturday, February 15, 2003 9:05 PM
> Subject: Re: [Mspgcc-users] How to define overlapping sections ?
>
> > Well, in this example var2 will not be allocated at all.
> > So, once allocated var1 will do all the job.
> > This will work !
> > (at least it works in libc:)
> >
> > Obviously you can define your own section and put vars there.
> >
> > define a section like '.bss' :
> > .section .mysection, "aw", @nobits
> > or
> > type __attribute__ ((section (".mysection, "aw", @nobits;"))) a,b,c;
> >
> > then pass the section address to the linker.
> >
> > ~d
> >
> > On Saturday 15 February 2003 21:02, Oleg Skydan wrote:
> > > Hi, Dmitry,
> > >
> > > > use alias for variable:
> > > >
> > > > long var1;
> > > > long var2 asm("var1");
> > > >
> > > > Actually it doe not matter if var1 and var2 will have different
> > > > sizes.
> > >
> > > It does matter. The RAM space will be allocated for var1.
> > > So it will not work if sizeof(var2)>sizeof(var1), right ?
> > >
> > > > P.S. if you're using variables within some 'area' declare them as
>
> local
>
> > > > :)
> > >
> > > Usually I do so, but in this case it is a large project and different
>
> tasks
>
> > > should have access for particular variable, so it should be global :(.
> > >
> > > Any other ideas ?
> > > May be the custom linker script would be helpful ?
> > >
> > > Thanks,
> > > Oleg.
> > >
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This sf.net email is sponsored by:ThinkGeek
> > > Welcome to geek heaven.
> > > http://thinkgeek.com/sf
> > > _______________________________________________
> > > Mspgcc-users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
> >
> > --
> > *********************************************************************
> > ("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
> > `6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys
> > (_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44
> > _..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
> > (il),-'' (li),' ((!.-' +7 (812) 314-8860, 5585314
> > *********************************************************************
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > Mspgcc-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
--
/********************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys
(_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 3468202, 5585314
********************************************************************/