Line 4... |
Line 4... |
<ul>
|
<ul>
|
<li><a href="#1.%20Introduction"> 1. Introduction</a></li>
|
<li><a href="#1.%20Introduction"> 1. Introduction</a></li>
|
<li><a href="#2.%20openmsp430-loader"> 2. openmsp430-loader</a></li>
|
<li><a href="#2.%20openmsp430-loader"> 2. openmsp430-loader</a></li>
|
<li><a href="#3.%20openmsp430-minidebug"> 3. openmsp430-minidebug</a></li>
|
<li><a href="#3.%20openmsp430-minidebug"> 3. openmsp430-minidebug</a></li>
|
<li><a href="#4.%20openmsp430-gdbproxy"> 4. openmsp430-gdbproxy</a></li>
|
<li><a href="#4.%20openmsp430-gdbproxy"> 4. openmsp430-gdbproxy</a></li>
|
<li><a href="#5.%20MSPGCC%20Toolchain"> 5. MSPGCC Toolchain</a>
|
<li><a href="#5.%20MSPGCC(4)%20Toolchain"> 5. MSPGCC(4) Toolchain</a>
|
<ul>
|
<ul>
|
<li><a href="#5.1%20Some%20notes%20regarding%20msp430-gdb"> 5.1 Some notes regarding msp430-gdb</a></li>
|
<li><a href="#5.1%20Compiler%20options"> 5.1 Compiler options</a></li>
|
<li><a href="#5.2%20CPU%20selection%20for%20msp430-gcc"> 5.2 CPU selection for msp430-gcc</a></li>
|
<li><a href="#5.2%20MCU%20selection"> 5.2 MCU selection</a></li>
|
|
<li><a href="#5.3%20Custom%20linker%20script"> 5.3 Custom linker script</a></li>
|
</ul>
|
</ul>
|
</li>
|
</li>
|
</ul>
|
</ul>
|
|
|
<a name="1. Introduction"></a>
|
<a name="1. Introduction"></a>
|
Line 22... |
Line 23... |
<li><b>openmsp430-loader:</b> a simple command line boot loader.</li>
|
<li><b>openmsp430-loader:</b> a simple command line boot loader.</li>
|
<li><b>openmsp430-minidebug:</b> a minimalistic debugger with simple GUI.</li>
|
<li><b>openmsp430-minidebug:</b> a minimalistic debugger with simple GUI.</li>
|
<li><b>openmsp430-gdbproxy:</b> GDB Proxy server to be used together with MSP430-GDB and the Eclipse, DDD, or Insight graphical front-ends.</li>
|
<li><b>openmsp430-gdbproxy:</b> GDB Proxy server to be used together with MSP430-GDB and the Eclipse, DDD, or Insight graphical front-ends.</li>
|
</ul>
|
</ul>
|
|
|
All these software development tools have been developed in TCL/TK and were successfully tested on both Linux and Windows XP.
|
All these software development tools have been developed in TCL/TK and were successfully tested on both Linux and Windows (XP/Vista/7).
|
<br><br>
|
<br><br>
|
<b>Note:</b> in order to be able to directly execute the scripts, <a href="http://www.tcl.tk/software/tcltk/">TCL/TK</a>
|
<b>Note:</b> in order to be able to directly execute the scripts, <a href="http://www.tcl.tk/software/tcltk/">TCL/TK</a>
|
needs to be installed on your system. Optionally for Windows users, the
|
needs to be installed on your system. Optionally for Windows users, the scripts can be turned into single-file binary executable programs
|
scripts have been turned into single-file binary executable programs
|
using <a href="http://freewrap.sourceforge.net/">freeWrap</a> by running/clicking the <i>"tools/freewrap642/generate_exec.bat"</i> file provided in the project repository.
|
using <a href="http://freewrap.sourceforge.net/">freeWrap</a>.
|
|
|
|
|
|
<a name="2. openmsp430-loader"></a>
|
<a name="2. openmsp430-loader"></a>
|
<h1>2. openmsp430-loader</h1>
|
<h1>2. openmsp430-loader</h1>
|
This simple program allows the user to load the openMSP430 program
|
This simple program allows the user to load the openMSP430 program
|
Line 56... |
Line 56... |
</tr>
|
</tr>
|
</tbody></table>
|
</tbody></table>
|
<br>
|
<br>
|
These screenshots show the script in action under Linux and Windows:
|
These screenshots show the script in action under Linux and Windows:
|
<br><br>
|
<br><br>
|
<img src="getimg.php?1248897300" alt="openmsp430-loader Linux" title="openmsp430-loader Linux" width="75%">
|
<img src="usercontent,img,1306525377" alt="openmsp430-loader Linux" title="openmsp430-loader Linux" width="75%"/>
|
<br><br>
|
<br><br>
|
<img src="getimg.php?1249244501" alt="openmsp430-loader Windows" title="openmsp430-loader Windows" width="75%">
|
<img src="getimg.php?1249244501" alt="openmsp430-loader Windows" title="openmsp430-loader Windows" width="75%"/>
|
<br>
|
<br>
|
<a name="3. openmsp430-minidebug"></a>
|
<a name="3. openmsp430-minidebug"></a>
|
<h1>3. openmsp430-minidebug</h1>
|
<h1>3. openmsp430-minidebug</h1>
|
This small program provides a minimalistic graphical interface enabling simple interaction with the openMSP430:
|
This small program provides a minimalistic graphical interface enabling simple interaction with the openMSP430:
|
<br><br>
|
<br><br>
|
<img src="usercontent,img,1297506385" alt="openmsp430-minidebug" title="openmsp430-minidebug" width="75%">
|
<img src="usercontent,img,1306665243" alt="openmsp430-minidebug" title="openmsp430-minidebug" width="75%"/>
|
<br><br>
|
<br><br>
|
As you can see from the screenshot, it allows the following actions:
|
As you can see from the screenshot, it allows the following actions:
|
<ul>
|
<ul>
|
<li><b><font color="#ff0000">(1)</font></b> Connect to the openMSP430 Serial Debug Interface</li>
|
<li><b><font color="#ff0000">(1)</font></b> Connect to the openMSP430 Serial Debug Interface.</li>
|
<li><b><font color="#ff0000">(2)</font></b> Load the program memory with an ELF or Intel-HEX file</li>
|
<li><b><font color="#ff0000">(2)</font></b> Load the program memory with an ELF or Intel-HEX file</li>
|
<li><b><font color="#ff0000">(3)</font></b> Control the CPU: Reset, Stop, Start and Single-Step</li>
|
<li><b><font color="#ff0000">(3)</font></b> Control the CPU: Reset, Stop, Start, Single-Step and Software breakpoints</li>
|
<li><b><font color="#ff0000">(4)</font></b> Read/Write individual status bits</li>
|
<li><b><font color="#ff0000">(4)</font></b> Read/Write access of the CPU registers</li>
|
<li><b><font color="#ff0000">(5)</font></b> Read/Write access of the CPU registers</li>
|
<li><b><font color="#ff0000">(5)</font></b> Read/Write access of the whole memory range (program, data, peripherals)</li>
|
<li><b><font color="#ff0000">(6)</font></b> Read/Write access of the whole memory range (program, data, peripherals)</li>
|
<li><b><font color="#ff0000">(6)</font></b> Basic disassembled view of the loaded program (current PC location is highlighted in green, software breakpoints in yellow, pink and violet)</li>
|
<li><b><font color="#ff0000">(7)</font></b> Source a custom external TCL script</li>
|
<li><b><font color="#ff0000">(7)</font></b> Choose the disassembled view type</li>
|
<li><b><font color="#ff0000">(8)</font></b> Basic disassembled view of the loaded program (current PC location is highlighted in yellow)</li>
|
<li><b><font color="#ff0000">(8)</font></b> Source a custom external TCL script</li>
|
<li><b><font color="#ff0000">(9)</font></b> Choose the disassembled view type</li>
|
|
</ul>
|
</ul>
|
|
|
<a name="4. openmsp430-gdbproxy"></a>
|
<a name="4. openmsp430-gdbproxy"></a>
|
<h1>4. openmsp430-gdbproxy</h1>
|
<h1>4. openmsp430-gdbproxy</h1>
|
The purpose of this program is to replace the '<b><i>msp430-gdbproxy</i></b>' utility provided by the mspgcc toolchain.<br>
|
The purpose of this program is to replace the '<b><i>msp430-gdbproxy</i></b>' utility provided by the mspgcc toolchain.<br>
|
Line 88... |
Line 87... |
handles the communication with the target hardware. In our case, it is
|
handles the communication with the target hardware. In our case, it is
|
basically a bridge between the RSP communication protocol from GDB and
|
basically a bridge between the RSP communication protocol from GDB and
|
the serial debug interface from the openMSP430.<br>
|
the serial debug interface from the openMSP430.<br>
|
Schematically the communication flow looks as following:
|
Schematically the communication flow looks as following:
|
<br><br>
|
<br><br>
|
<img src="getimg.php?1248897690" alt="GDB Proxy flow" title="GDB Proxy flow" width="40%">
|
<img src="getimg.php?1248897690" alt="GDB Proxy flow" title="GDB Proxy flow" width="40%"/>
|
<br><br>
|
<br><br>
|
Like the original '<b><i>msp430-gdbproxy</i></b>' program, '<b><i>openmsp430-gdbproxy</i></b>' can be controlled from the command line. However, it also provides a small graphical interface:
|
Like the original '<b><i>msp430-gdbproxy</i></b>' program, '<b><i>openmsp430-gdbproxy</i></b>' can be controlled from the command line. However, it also provides a small graphical interface:
|
<br><br>
|
<br><br>
|
<img src="getimg.php?1248897753" alt="openmsp430-gdbproxy" title="openmsp430-gdbproxy" width="60%">
|
<img src="usercontent,img,1306525816" alt="gdbproxy" title="gdbproxy" width="60%"/>
|
<br><br>
|
<br><br>
|
These two additional screenshots show the script in action together with the Eclipse and DDD graphical frontends:
|
These two additional screenshots show the script in action together with the Eclipse and DDD graphical frontends:
|
<br><br>
|
<br><br>
|
<img src="getimg.php?1248897844" alt="openmsp430-gdbproxy and Eclipse" title="openmsp430-gdbproxy and Eclipse" width="100%">
|
<img src="usercontent,img,1306525935" alt="gdbproxy-Eclipse" title="gdbproxy-Eclipse" width="100%"/>
|
<br><br>
|
<br><br>
|
<img src="getimg.php?1248897887" alt="openmsp430-gdbproxy and DDD" title="openmsp430-gdbproxy and DDD" width="100%">
|
<img src="usercontent,img,1306526049" alt="gdbproxy-DDD" title="gdbproxy-DDD" width="100%"/>
|
<br><br>
|
<br><br>
|
<b>Tip:</b> There are several tutorials on Internet explaining how to
|
<b>Tip:</b> There are several tutorials on Internet explaining how to
|
configure Eclipse for the MSP430. As an Eclipse newbie, I found the
|
configure Eclipse for the MSP430. As an Eclipse newbie, I found the
|
followings quite helpful:
|
followings quite helpful (the <b><i>msp430-gdbproxy</b></i> sections should of course be ignored as we are using our own <b><i>openmsp430-gdbproxy</b></i> program :-) ):
|
<ul>
|
<ul>
|
<li><a href="http://matthias-hartmann.blogspot.com/2009/02/use-eclipse-and-mspgcc-easy-way.html">Use Eclipse and mspgcc - The easy way</a> (English)</li>
|
<li><a href="http://www.43oh.com/2010/11/a-step-by-step-guide-msp430-programming-under-linux/">A Step By Step Guide To MSP430 Programming Under Linux</a> (English)</li>
|
<li><a href="http://msp430.ms.funpic.de/doku.php?id=msp430:entwicklungumgebung">MSP430 - Entwicklungumgebung</a> (German)</li>
|
<li><a href="http://www.mikrocontroller.net/articles/MSP430_eclipse_helios_mspgcc4_gdb-proxy">MSP430 eclipse helios mspgcc4</a> (German)</li>
|
</ul>
|
</ul>
|
|
|
<a name="5. MSPGCC Toolchain"></a>
|
<a name="5. MSPGCC(4) Toolchain"></a>
|
<h1>5. MSPGCC Toolchain</h1>
|
<h1>5. MSPGCC(4) Toolchain</h1>
|
|
|
<a name="5.1 Some notes regarding msp430-gdb"></a>
|
<a name="5.1 Compiler options"></a>
|
<h2>5.1 Some notes regarding msp430-gdb</h2>
|
<h2>5.1 Compiler options</h2>
|
|
|
As of today (July 2009), the GDB port for the MSP430 has some problems (<a href="http://www.nabble.com/Help-with-gdb-commands-td21942613.html">here</a>).<br>
|
The <b>msp430-gcc</b> compiler accepts the following MSP430 specific command line parameters (copied from the MSPGCC <a href="http://mspgcc.sourceforge.net/manual/c745.html">manual page</a>):
|
The stepping over function is not available and the backtrace and finish commands don't work properly.<br>
|
<br><br>
|
There is fortunately a <a href="http://www.nabble.com/Useful-new-GDB-fixes-td19554922.html">patch</a>
|
<table align="center" border="1">
|
existing, and until it is included into GDB, I can only recommend to
|
<tbody>
|
recompile GDB with it (I didn't try it for Windows but it is quite
|
<tr><td>-mmcu= </td><td>Specify the MCU name </td></tr>
|
straight forward to do for Linux). <a name="5.2 CPU selection for msp430-gcc"></a>
|
<tr><td>-mno-volatile-workaround</td><td>Do not perform a volatile workaround for bitwise operations. </td></tr>
|
<h2>5.2 CPU selection for msp430-gcc</h2>
|
<tr><td>-mno-stack-init </td><td>Do not initialize the stack as <i>main()</i>starts. </td></tr>
|
|
<tr><td>-minit-stack= </td><td>Specify the initial stack address. </td></tr>
|
|
<tr><td>-mendup-at= </td><td>Jump to the specified routine at the end of <i>main()</i>. </td></tr>
|
|
<tr><td>-mforce-hwmul </td><td>Force use of a hardware multiplier. </td></tr>
|
|
<tr><td>-mdisable-hwmul </td><td>Do not use the hardware multiplier. </td></tr>
|
|
<tr><td>-minline-hwmul </td><td>Issue inline code for 32-bit integer operations for devices with a hardware multiplier. </td></tr>
|
|
<tr><td>-mnoint-hwmul </td><td>Do not disable and enable interrupts around hardware multiplier operations. This makes
|
|
multiplication faster when you are certain no hardware multiplier operations will occur
|
|
at deeper interrupt levels. </td></tr>
|
|
<tr><td>-mcall-shifts </td><td>Use subroutine calls for shift operations. This may save some space for shift intensive
|
|
applications. </td></tr>
|
|
</tbody>
|
|
</table>
|
|
<br>
|
|
|
|
|
|
<a name="5.2 MCU selection"></a>
|
|
<h2>5.2 MCU selection</h2>
|
|
|
The following table aims to help selecting the proper <b>-mmcu</b> <a href="http://mspgcc.sourceforge.net/manual/c745.html">option</a> for the <b>msp430-gcc</b> call:<br><br>
|
The following table aims to help selecting the proper MCU name for the <b>-mmcu</b> <a href="http://mspgcc.sourceforge.net/manual/c745.html">option</a> during the <b>msp430-gcc</b> call:
|
|
<br><br>
|
<table align="center" border="1">
|
<table align="center" border="1">
|
<tbody><tr align="center"><td><b>-mmcu option</b></td><td><b> Program <br>Memory</b></td><td><b>Data<br> Memory </b></td><td style="vertical-align: top; text-align: center;"><span style="font-weight: bold;">Hardware<br>
|
<tbody><tr align="center"><td><b>-mmcu option</b></td><td><b> Program <br>Memory</b></td><td><b>Data<br> Memory </b></td><td style="vertical-align: top; text-align: center;"><span style="font-weight: bold;">Hardware<br>
|
Multiplier </span><br>
|
Multiplier </span><br>
|
</td>
|
</td>
|
</tr>
|
</tr>
|
Line 816... |
Line 833... |
<td style="vertical-align: top; text-align: center;"><span style="font-weight: bold;">Yes</span>
|
<td style="vertical-align: top; text-align: center;"><span style="font-weight: bold;">Yes</span>
|
</td>
|
</td>
|
</tr>
|
</tr>
|
|
|
</tbody></table><br>
|
</tbody></table><br>
|
<span style="text-decoration: underline;">Note 1:</span> the program memory size should imperatively match the openMSP430 configuration.<br>
|
<span style="text-decoration: underline;">Note:</span> the program memory size should imperatively match the openMSP430 configuration.<br>
|
|
|
<span style="text-decoration: underline;">Note 2:</span> the <span style="font-weight: bold;">-mforce-hwmul</span> parameter will force <b>msp430-gcc </b>to use the hardware multiplier.<br>
|
|
|
|
<span style="text-decoration: underline;">Note 3:</span> the <span style="font-weight: bold;">-mdisable-hwmul</span> parameter will force <b>msp430-gcc </b>not to use the hardware multiplier.<br>
|
|
<br>
|
<br>
|
|
<a name="5.3 Custom linker script"></a>
|
|
<h2>5.3 Custom linker script</h2>
|
|
The use of the <b>-mmcu</b> switch is of course <b>NOT</b> mandatory. It is simply a convenient way to use the pre-existing linker scripts provided with the MSPGCC4 toolchain.<br>
|
|
<br>
|
|
However, if the peripheral address space is larger than the standard 512B of the original MSP430 (see the <a href="http://opencores.org/project,openmsp430,core#2.1.3.2 Advanced System Configuration)">Advanced System Configuration</a> section), a customized linker script <b>MUST</b> be provided.<br>
|
|
<br>
|
|
To create a custom linker script, the simplest way is to start from an existing one:
|
|
<ul>
|
|
<li>the MSPGCC(4) toolchain provides a wide range of examples for all supported MSP430 models (see "<b><i>msp430/lib/ldscripts/</i></b>" sub-directory, in the MSPGCC(4) installation directory).</li>
|
|
<li>the openMSP430 project also provide a simple linker script example: <a href="http://opencores.org/websvn,filedetails?repname=openmsp430&path=/openmsp430/trunk/core/sim/rtl_sim/src/ldscript_example.x">ldscript_example.x</a></li>
|
|
</ul>
|
|
<br>
|
|
From there, the script can be modified to match <b>YOUR</b> openMSP430 configuration:
|
|
<ul>
|
|
<li>In the <b><i>text (rx)</i></b> section definition, update the <b><i>ORIGIN</i></b> and <b><i>LENGTH</b></i> fields to match the <b>PROGRAM MEMORY</b> configuration.</li>
|
|
<li>In the <b><i>data (rwx)</i></b> section definition, update the <b><i>ORIGIN</i></b> field to match the <b>PERIPHERAL SPACE</b> configuration and the <b><i>LENGTH</b></i> field to match the <b>DATA MEMORY</b> configuration.</li>
|
|
<li>At last, update the stack pointer initialization value (look for the "<b><i>PROVIDE (__stack =</i></b>" section) and make sure that it falls in the data memory space (the stack size should also matches your application requirements, i.e. not to small... and not to big :-P ).</li>
|
|
</ul>
|
|
<br><br>
|
|
|
|
|
</body></html>
|
</body></html>
|
No newline at end of file
|
No newline at end of file
|