naren0nindiatimes / tinyos-main

Automatically exported from code.google.com/p/tinyos-main
0 stars 0 forks source link

Shimmer I2C with msp430-gcc v4.5.3 #54

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
After upgrading to msp430-gcc v4.5.3 from the stanford repository 
(http://tinyos.stanford.edu/tinyos/dists) no application that uses the shimmer 
magnetometer will now compile for me.

To reproduce try compiling the BoilerPlate application (updated from 
sourceforge on 23 Aug 2011) using the latest tinyos-main tree (revision 5697).

When I revert to msp430-gcc v3.2.3 the application compiles successfully.

The error I'm seeing is as follows (I presume the warning about the Adc12 
registers is not causing the problem, but including it here for completeness):

/opt/tinyos-main/tos/chips/msp430/adc12/Msp430Adc12.h:181:2: warning: #warning 
"Accessing Adc12 registers via bitfield structures: this is discouraged mspgcc 
version >= 4 as it may result in faulty code!"
In file included from 
/opt/tinyos-main/tos/platforms/shimmer2/chips/hmc5843/MagnetometerC.nc:65,
                 from BoilerPlateAppC.nc:76:
In component `Msp430I2CP':
/opt/tinyos-main/tos/platforms/shimmer/chips/msp430/Msp430I2CP.nc: In function 
`localRxData':
/opt/tinyos-main/tos/platforms/shimmer/chips/msp430/Msp430I2CP.nc:169: `I2CDR' 
undeclared (first use in this function)
/opt/tinyos-main/tos/platforms/shimmer/chips/msp430/Msp430I2CP.nc:169: (Each 
undeclared identifier is reported only once
/opt/tinyos-main/tos/platforms/shimmer/chips/msp430/Msp430I2CP.nc:169: for each 
function it appears in.)
/opt/tinyos-main/tos/platforms/shimmer/chips/msp430/Msp430I2CP.nc: In function 
`localTxData':
/opt/tinyos-main/tos/platforms/shimmer/chips/msp430/Msp430I2CP.nc:248: `I2CDR' 
undeclared (first use in this function)
make: *** [exe0] Error 1

Original issue reported on code.google.com by kevdaly1...@gmail.com on 23 Aug 2011 at 7:40

GoogleCodeExporter commented 8 years ago

Original comment by philip.l...@gmail.com on 24 Aug 2011 at 3:37

GoogleCodeExporter commented 8 years ago
I wouldn't necessarily ignore that ADC12 warning.  One of the guys who did 
mspgcc4 (before me) made a change that might well have broken the alignment 
between a structure declaration and physical memory.  If the structure is not 
marked as "packed", it's probably going to be wrong.

While a "quick fix" would be to place structure definitions that are no longer 
part of mspgcc into TinyOS, this is very much the wrong approach from a 
portability and reliability perspective.  I strongly encourage all use of 
structs that overlay MSP430 peripheral memory structures to be eliminated in 
favor of the use of bit operations on the byte and word registers, as is 
supported in mspgcc, IAR, and TI's CCS compilers using the headers provided by 
TI.

Original comment by pabi...@gmail.com on 24 Aug 2011 at 1:53

GoogleCodeExporter commented 8 years ago
tos/platforms/shimmer/chips/msp430/Msp430I2CP.nc was updated with an ifdef 
macro to support both old and new toolchains, as 4.x.x replaced I2CDR_ with 
I2CDRB_ and W_.

fix committed.

Original comment by steveay...@gmail.com on 24 Aug 2011 at 4:27