Hi,

Apologies for the length of this but I think it might be useful.

I'm still having some issues with building for these devices and have
found a problem to be with how the link is performed.

Can somebody else give me an example of how they build using the toolchain?

I have been using building using msp430-gcc for compilation and
linking as I was using a makefile from the examples and Chris
Liechti's eclipse plugin,  but I've found that the output of the link
doing this is different to linking by directly invoking msp430-ld.
msp430-ld is being correctly patched but however gcc invokes the
linker is incorrect.

The map outputs from linking through msp430-gcc and msp430-ld are below:

msp430-gcc -Xlinker,-Map="mem.map" -mmcu=msp430x2410 -o"test.elf"  ./main.o

-----------------------------
Memory Configuration

Name             Origin             Length             Attributes
text             0x00002100         0x0000dec0         xr
data             0x00001100         0x00001000         xrw
vectors          0x0000ffc0         0x00000040         rw
bootloader       0x00000c00         0x00000400         xr
infomem          0x00001000         0x00000100         xr
infomemnobits    0x00001000         0x00000100         xr
*default*        0x00000000         0xffffffff
-----------------------------

msp430-ld -mmsp430x2410 -Map="ld_test.map" -o"ld_test.elf"
/usr/local/msp430/msp430/lib/crt430x2410.o main.o
/usr/local/msp430/lib/gcc-lib/msp430/3.2.3/msp2/libgcc.a

-----------------------------
Memory Configuration

Name             Origin             Length             Attributes
text             0x00002100         0x0000dee0         xr
data             0x00001100         0x00001000         xrw
vectors          0x0000ffe0         0x00000020         rw
bootloader       0x00000c00         0x00000400         xr
infomem          0x00001000         0x00000100         xr
infomemnobits    0x00001000         0x00000100         xr
*default*        0x00000000         0xffffffff
-----------------------------

The difference is that the ld output (the second map) is correct as
per Gunther's binutils patch as the vector table is reduced to 32
bytes, the map from gcc is not correct (and I cant find where it is
generating it from).

Linking through the gcc call does not work correctly for 241x devices
or 26x devices, the startup and interrupt vectors are not linked.

This can be done using the patched binutils, the command below
produced a fully linked version (use "msp430-objdump -dSt ld_2619.elf
> ld_2619.lst"  to check after)

msp430-ld -mmsp430x2619 -Map="ld.map" -o"ld_2619.elf"
/usr/local/msp430/msp430/lib/crt430x2619.o main.o
/usr/local/msp430/lib/gcc-lib/msp430/3.2.3/msp2/libgcc.a

I hope this is helpful to people with 26x devices.

Mat

Reply via email to