Difference between revisions of "MSP-EXP430F5529LP"

From MAGEEC
Jump to: navigation, search
(Toolchain)
(Simulator)
 
(3 intermediate revisions by the same user not shown)
Line 55: Line 55:
 
  $ apt-get install gcc-msp430 msp430mcu gdb-msp430
 
  $ apt-get install gcc-msp430 msp430mcu gdb-msp430
  
The C library can be installed from the package msp430-libc. However this is missing several functions. If trying to run BEEBS on the board then the required version of pow is missing from the library. The following steps patch the library (patch applied on commit 292e920cff2ab95b1f6eb160a6eedd2b39bc7a60):
+
The C library can be installed from the package msp430-libc. However this is missing several functions. If trying to run BEEBS on the board then the required version of pow is missing from the library. The following steps patch the library:
  
 
  $ git clone git://mspgcc.git.sourceforge.net/gitroot/mspgcc/msp430-libc  
 
  $ git clone git://mspgcc.git.sourceforge.net/gitroot/mspgcc/msp430-libc  
 
  $ cd msp430-libc
 
  $ cd msp430-libc
 +
$ git checkout release/20120224
 
  $ [Put patch file listed below into msp430_libc_patch]
 
  $ [Put patch file listed below into msp430_libc_patch]
 
  $ patch -p1 < msp430_libc_patch
 
  $ patch -p1 < msp430_libc_patch
Line 67: Line 68:
  
 
Patch file:
 
Patch file:
 +
 
  diff --git a/src/libm/ef_pow.c b/src/libm/ef_pow.c
 
  diff --git a/src/libm/ef_pow.c b/src/libm/ef_pow.c
  index 9a21339..fe000b7 100644
+
  index 9a21339..03dc0ff 100644
 
  --- a/src/libm/ef_pow.c
 
  --- a/src/libm/ef_pow.c
 
  +++ b/src/libm/ef_pow.c
 
  +++ b/src/libm/ef_pow.c
 
  @@ -257,3 +257,16 @@ float powf(float x, float y)
 
  @@ -257,3 +257,16 @@ float powf(float x, float y)
else SET_FLOAT_WORD(z,j);
+
        else SET_FLOAT_WORD(z,j);
return s*z;
+
        return s*z;
 
   }
 
   }
 
  +
 
  +
Line 79: Line 81:
 
  +
 
  +
 
  +#ifdef __STDC__
 
  +#ifdef __STDC__
  + double pow(double x, double y)
+
  +   double pow(double x, double y)
 
  +#else
 
  +#else
  + double pow(x, y)
+
  +   double pow(x, y)
  + double x, y;
+
  +   double x, y;
 
  +#endif
 
  +#endif
 
  +{
 
  +{
  + return (double) powf((float) x, (float) y);
+
  +   return (double) powf((float) x, (float) y);
 
  +}
 
  +}
 
  +#endif
 
  +#endif
diff --git a/src/libm/fpmulparts.S b/src/libm/fpmulparts.S
+
 
index 439abf7..05ad679 100644
+
==Simulator==
--- a/src/libm/fpmulparts.S
+
 
+++ b/src/libm/fpmulparts.S
+
This section is current work in progress on getting a tracing simulator to work.
@@ -35,10 +35,10 @@
+
 
 
+
Build GDB as in [http://sourceforge.net/apps/mediawiki/mspgcc/index.php?title=Install:fromsource]
  #define lowresult R14
+
 
  #define highresult R15
+
Currently the simulator with GDB does not support the extended instruction set, so binaries must be build with <TT>-mcpu=430</TT>.
-
+
 
-#if __MSP430X__ - 0
+
Following command needed to patch GDB.
- .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
+
 
-#endif /* __MSP430X__ */
+
  sed -i -e 's/@colophon/@@colophon/' \
+
+
      -e 's/doc@cygnus.com/doc@@cygnus.com/' bfd/doc/bfd.texinfo
+#if __MSP430X__ - 0
+
 
+; .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
+
Apply the patch at [https://gist.github.com/jpallister/8004422] to fix the simulator.
+#endif /* __MSP430X__ */
 
 
 
  .global __fpmulparts
 
  .type __fpmulparts,@function
 
diff --git a/src/misc/__bswap_32.S b/src/misc/__bswap_32.S
 
index fbb7ca0..822729f 100644
 
--- a/src/misc/__bswap_32.S
 
+++ b/src/misc/__bswap_32.S
 
@@ -30,10 +30,10 @@
 
  * OF THE POSSIBILITY OF SUCH DAMAGE
 
  *
 
  */
 
-
 
-#if __MSP430X__ - 0
 
- .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
 
-#endif /* __MSP430X__ */
 
+
 
+#if __MSP430X__ - 0
 
+; .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
 
+#endif /* __MSP430X__ */
 
 
 
.section .text
 
.global __bswap_32
 
diff --git a/src/misc/__bswap_64.S b/src/misc/__bswap_64.S
 
index 1b1e762..d7fb116 100644
 
--- a/src/misc/__bswap_64.S
 
+++ b/src/misc/__bswap_64.S
 
@@ -30,10 +30,10 @@
 
  * OF THE POSSIBILITY OF SUCH DAMAGE
 
  *
 
  */
 
-
 
-#if __MSP430X__ - 0
 
- .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
 
-#endif /* __MSP430X__ */
 
+
 
+#if __MSP430X__ - 0
 
+; .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
 
+#endif /* __MSP430X__ */
 
 
 
.section .text
 
.global __bswap_64
 
diff --git a/src/stdlib/abort.S b/src/stdlib/abort.S
 
index b06b31c..21fce5e 100644
 
--- a/src/stdlib/abort.S
 
+++ b/src/stdlib/abort.S
 
@@ -1,6 +1,6 @@
 
-#if __MSP430X__ - 0
 
- .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
 
-#endif /* __MSP430X__ */
 
+#if __MSP430X__ - 0
 
+; .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
 
+#endif /* __MSP430X__ */
 
 
 
          .text
 
          .p2align 1,0
 
diff --git a/src/stdlib/div.S b/src/stdlib/div.S
 
index 444ec2f..91320e2 100644
 
  --- a/src/stdlib/div.S
 
+++ b/src/stdlib/div.S
 
@@ -6,9 +6,9 @@
 
  #define RETX ret
 
  #endif /* C20 */
 
 
 
-#if __MSP430X__ - 0
 
- .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
 
-#endif /* __MSP430X__ */
 
+#if __MSP430X__ - 0
 
+; .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
 
+#endif /* __MSP430X__ */
 
 
 
.section .text.div
 
.global div
 
diff --git a/src/stdlib/exit.S b/src/stdlib/exit.S
 
index 32373ed..d87360c 100644
 
--- a/src/stdlib/exit.S
 
+++ b/src/stdlib/exit.S
 
@@ -32,9 +32,9 @@
 
  * Multitasking exiting and such.
 
  */
 
 
 
-#if __MSP430X__ - 0
 
- .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
 
-#endif /* __MSP430X__ */
 
+#if __MSP430X__ - 0
 
+; .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
 
+#endif /* __MSP430X__ */
 
 
 
          .text
 
          .p2align 1,0
 
diff --git a/src/stdlib/ldiv.S b/src/stdlib/ldiv.S
 
index 41d68f6..4644d9e 100644
 
--- a/src/stdlib/ldiv.S
 
+++ b/src/stdlib/ldiv.S
 
@@ -6,9 +6,9 @@
 
  #define RETX ret
 
  #endif /* C20 */
 
 
 
-#if __MSP430X__ - 0
 
- .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
 
-#endif /* __MSP430X__ */
 
+#if __MSP430X__ - 0
 
+; .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
 
+#endif /* __MSP430X__ */
 
 
 
.section .text.ldiv
 
.global ldiv
 
diff --git a/src/stdlib/setjmp.S b/src/stdlib/setjmp.S
 
index 3920d60..038b422 100644
 
--- a/src/stdlib/setjmp.S
 
+++ b/src/stdlib/setjmp.S
 
@@ -48,9 +48,9 @@
 
  #define BRX br
 
  #endif /* C20 */
 
 
 
-#if __MSP430X__ - 0
 
- .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
 
-#endif /* __MSP430X__ */
 
+#if __MSP430X__ - 0
 
+; .cpux_target bits=__MSP430X__ ; Encode build options for link-time validation
 
+#endif /* __MSP430X__ */
 
 
 
.global setjmp
 
.type setjmp, @function
 
  
 
==Links==
 
==Links==

Latest revision as of 11:27, 17 December 2013


Platform details

Processor MSP430F5529
Architecture MSP430
Instruction sets MSP430
Memory 128kB Flash, 8kB RAM

Hardware modifications

None necessary, attach probes to the 3V3 jumper.

Software setup

udev rules

$ cat /etc/udev/rules.d/62-msp-exp430f5529lp.rules
ATTRS{idVendor}=="2047", ATTRS{idProduct}=="0013", MODE="0666", GROUP="plugdev"

GDB server

To build:

$ git clone git://git.code.sf.net/p/mspdebug/code mspdebug
$ cd mspdebug
$ make

To run:

$ ./mspdebug ezfet gdb

This starts a gdb server on port 2000, however doesn't seem to allow flashing of the device (although you can debug, and step through programs).

$ wget http://www-s.ti.com/sc/techzip/slac460.zip
$ unzip slac460.zip
$ cd MSPDebugStack_OS_Package

$ wget http://mspdebug.sourceforge.net/misc/slac460f_unix.diff
$ patch -p1 <slac460f_unix.diff
$ cd ThirdParty
$ chmod +x install_thirdparty.sh 
$ ./install_thirdparty.sh 
$ cd ..
$ make
$ sudo make install

This creates libmsp430.so, which allows the tilib driver of mspdebug to be used. This seems to be able to successfully flash the board.

 $ ./mspdebug tilib gdb

Toolchain

$ apt-get install gcc-msp430 msp430mcu gdb-msp430

The C library can be installed from the package msp430-libc. However this is missing several functions. If trying to run BEEBS on the board then the required version of pow is missing from the library. The following steps patch the library:

$ git clone git://mspgcc.git.sourceforge.net/gitroot/mspgcc/msp430-libc 
$ cd msp430-libc
$ git checkout release/20120224
$ [Put patch file listed below into msp430_libc_patch]
$ patch -p1 < msp430_libc_patch
$ ./configure
$ cd src
$ make
$ sudo make PREFIX=/usr install

Patch file:

diff --git a/src/libm/ef_pow.c b/src/libm/ef_pow.c
index 9a21339..03dc0ff 100644
--- a/src/libm/ef_pow.c
+++ b/src/libm/ef_pow.c
@@ -257,3 +257,16 @@ float powf(float x, float y)
        else SET_FLOAT_WORD(z,j);
        return s*z;
 }
+
+#ifdef _DOUBLE_IS_32BITS
+
+#ifdef __STDC__
+   double pow(double x, double y)
+#else
+   double pow(x, y)
+   double x, y;
+#endif
+{
+   return (double) powf((float) x, (float) y);
+}
+#endif

Simulator

This section is current work in progress on getting a tracing simulator to work.

Build GDB as in [1]

Currently the simulator with GDB does not support the extended instruction set, so binaries must be build with -mcpu=430.

Following command needed to patch GDB.

sed -i -e 's/@colophon/@@colophon/' \
      -e 's/doc@cygnus.com/doc@@cygnus.com/' bfd/doc/bfd.texinfo

Apply the patch at [2] to fix the simulator.

Links