Hi Peter,

Forgot to mention I am using mspgcc4 from SVN with msp430-libc from
20100430.

Thanks for clearing up about the difference between the two sections.
For several of my projects I use these segments to store calibration
data. I usually used a bunch of shellscript to create a TITEXT file
containing the infomem bits and in the code used a fixed pointer to
reference this data.

This morning I wanted to include those data into the ELF directly and
by gazing over the linkerscript to find the correct section I
noticed the wrong address.

Here is a code snippet to test infomem
locations.

--------------------------------------8<---------------------
#include <msp430x54xx.h>

int  a __attribute__ ((section (".infomem"))) = 3;

int main (void) {

        int i;
        for (;;) {
                i = a;
        }
        return 0;
}
-------------------------------->8--------------------------

I used the following commands to compile it (from my Makefile):

/usr/local/msp430/bin/msp430-gcc -c -Dmsp430x5438 -mmcu=msp430x5438
-DMSP_CODE -O2 -g -Wall --std=gnu99 -Wa,-adhlns=testinfo.lst
testinfo.c -o testinfo.o 

/usr/local/msp430/bin/msp430-gcc -Dmsp430x5438
-mmcu=msp430x5438 -DMSP_CODE -O2 -g -Wall --std=gnu99
-Wa,-adhlns=testinfo.lst   testinfo.o  --output infomem-test.elf -m
msp430x5438 
/usr/local/msp430/bin/msp430-objcopy -O ihex
infomem-test.elf infomem-test.hex 

/usr/local/msp430/bin/msp430-objdump
-h -S -C -t infomem-test.elf >
infomem-test.lss 
/usr/local/msp430/bin/msp430-nm -n infomem-test.elf >
infomem-test.sym 

ihex2titext infomem-test.hex > infomem-test.titext


Continue in your reply:

On Thu, 27 May 2010 06:58:03 -0500
Peter Bigot <[email protected]> wrote:

> (I speak here with reference to the binutils patches in the mspgcc4
> repository.  Not sure which release you're using.)
> 
> Chip-specific constants like that are stored in ld/emulparams/msp430all.sh.
> It appears ones for INFO and BOOT were added for some (but not all) chips,
> but are never referenced. They probably should be used in ld/scripttempl/
> elf32msp430.sc in place of the hard-coded constants.  (And maybe
> elf32msp430_3.sc; not sure why that family merits its own script).

Yeah, the msp430all.sh seems to have the correct locations defined
although I'd prefer to also have infomem split into their A, B, C, D
parts to let the linker check for overruns. I.e. if you want to update
some part of A, you can then copy A to B, erase A, copy-and-modify B
back to A. This is the way to do it in the smaller MSP's anyway.
Manually I modified the original msp430x5438.x to
have .infomem, .infomem[ABCD], .infomemnobits and .infomemnobits[ABCD]
and if you mix .infomem and .infomemA the linker will find overlapping
memory errors. This way you can choose to use the infomem as one big
chunk or use it as four seperate parts.

The old 3XX controllers don't seem to have infomem flash so that might
explain the seperate script.  But indeed the INFO and BOOT values are
ignored in elf32msp430.sc.

> 
> Did you discover this by analysis, or can you provide a short shell sequence
> that generates an elf32 with content in these sections so I can verify
> before/after behavior on various chips?
> 
> Below are sections from the ld manual; I don't know specifically why one
> would want to put data into a memory section but not write it to the chip.
> 
> ``.bootloader''
>      Defines the bootloader portion of the ROM (if applicable).  Any
>      code in this section will be uploaded to the MPU.
> 
> ``.infomem''
>      Defines an information memory section (if applicable).  Any code in
>      this section will be uploaded to the MPU.
> 
> ``.infomemnobits''
>      This is the same as the `.infomem' section except that any code in
>      this section will not be uploaded to the MPU.
> 
> Peter
> 
> On Thu, May 27, 2010 at 5:33 AM, Hans Nieuwenhuis <[email protected]> wrote:
> 
> > Hi all,
> >
> > Just found out that binutils (2.20.1, but also older revs.) installs
> > incorrect linker files for the msp430x54xx parts. These parts have
> > their bootloader starting at 0x1000, but as shown in the snippet blow
> > that's where the linker puts the infomem section. Infomem should be
> > four blocks of 128 bytes starting at 0x1800.
> >
> >  bootloader(rx)    : ORIGIN = 0x0c00,     LENGTH = 1K
> >  infomem(rx)       : ORIGIN = 0x1000,     LENGTH = 256
> >  infomemnobits(rx) : ORIGIN = 0x1000,     LENGTH = 256
> >
> > What is the purpose of the sections infomem and infomemnobits as they
> > both point the same start address? Can someone shed a light on this?
> >
> > Thanks,
> >
> > Hans
> >
> >
> >
> > ------------------------------------------------------------------------------
> >
> > _______________________________________________
> > Mspgcc-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
> >

Reply via email to