Difference between revisions of "SDIN Boards"

From RobolaboWiki
Jump to: navigation, search
 
(33 intermediate revisions by 2 users not shown)
Line 16: Line 16:
  
 
<pre>
 
<pre>
sudo cp -r gcc-arm-none-eabi-<VERSION> /opt/compilerNucleoST
+
sudo cp -r gcc-arm-none-eabi-<VERSION> /opt/compilerSTM32
 +
</pre>
 +
 
 +
<b> Important!! </b> If in a 64 bits machine, you will need to install the following libs:
 +
 
 +
<pre>
 +
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0
 
</pre>
 
</pre>
  
 
<h2> Install OpenOCD On-Chip Debugger</h2>
 
<h2> Install OpenOCD On-Chip Debugger</h2>
  
Instal dependencies:
+
Install dependencies:
 
<pre>
 
<pre>
sudo apt-get install flex bison libgmp3-dev libmpfr-dev libncurses5-dev libmpc-dev autoconf texinfo build-essential \\
+
sudo apt-get install flex bison libgmp3-dev libmpfr-dev libncurses5-dev libmpc-dev autoconf texinfo build-essential \
 
libftdi-dev libusb-1.0-0-dev libexpat1-dev
 
libftdi-dev libusb-1.0-0-dev libexpat1-dev
 
</pre>
 
</pre>
Line 42: Line 48:
 
Configure openocd compilation:
 
Configure openocd compilation:
 
<pre>
 
<pre>
./configure --prefix=/opt/openocd/ --enable-jlink --enable-amtjtagaccel --enable-ftdi --enable-buspirate --enable-stlink \\  
+
./configure --prefix=/opt/openocd/ --enable-jlink --enable-amtjtagaccel --enable-ftdi --enable-buspirate --enable-stlink \
 
--enable-ftdi --enable-rlink
 
--enable-ftdi --enable-rlink
 +
 
</pre>
 
</pre>
  
Line 58: Line 65:
 
Prepare its use according to udev:
 
Prepare its use according to udev:
 
<pre>
 
<pre>
sudo cp -r contrib/openocd.rules /etc/udev/rules.d/90-jtag.rules
+
(old versions)
 +
sudo cp -r contrib/openocd.udev /etc/udev/rules.d/90-jtag.rules
 +
 
 +
(new versions)
 +
sudo cp -r contrib/99-openocd.rules /etc/udev/rules.d/
 +
 
 
sudo udevadm control --reload-rules
 
sudo udevadm control --reload-rules
 +
</pre>
 +
 +
 +
Grant permits to user: user must be in plugdev:
 +
 +
<pre>
 +
sudo vi /etc/group
 +
</pre>
 +
 +
<h1> Basic Usage </h1>
 +
 +
Need to load environment.
 +
Create a env.sh file with:
 +
<pre>
 +
export PATH=/opt/openocd/bin:/opt/compilerSTM32/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
 +
</pre>
 +
 +
Load the environment:
 +
 +
<pre>
 +
source env.sh
 +
</pre>
 +
 +
Open ocd:
 +
 +
<pre>
 +
openocd -f openocd.cfg -c "init" -c "halt" -c "reset halt"
 
</pre>
 
</pre>
  
 
<h1> Eclipse Environment  </h1>
 
<h1> Eclipse Environment  </h1>
 
It is mandatory to install the Base Environment first
 
It is mandatory to install the Base Environment first
 +
 +
  
 
<h2> Install Eclipse </h2>
 
<h2> Install Eclipse </h2>
 +
(More info at: http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Fgetting_started%2Fcdt_w_import.htm)
  
 
Download last version of Eclipse IDE for C/C++ Developers from: http://www.eclipse.org/downloads/
 
Download last version of Eclipse IDE for C/C++ Developers from: http://www.eclipse.org/downloads/
Line 71: Line 113:
 
Untar eclipse:
 
Untar eclipse:
 
<pre>
 
<pre>
tar -xvzf eclipse-cpp-mars-1-linux-gtk-x86_64.tar.gz
+
tar -xvzf eclipse-cpp-<VERSION>-linux-gtk-x86_64.tar.gz
 
</pre>
 
</pre>
  
Line 81: Line 123:
 
</pre>
 
</pre>
  
Define workspace (e.g. /home/<USER>/stm32EclipseWorkspace
+
Define workspace (e.g. /home/<USER>/stm32EclipseWorkspace)
  
<h3> Lets now install C/C++ Developping tools </h3>
+
<h3> Install C/C++ Developping tools </h3>
 
+
Go to Help -> Install New Sofware --> add <br>
+
- Name: CDT-Mars <br>
+
- Location: http://download.eclipse.org/tools/cdt/releases/8.8 <br>
+
  
 +
Go to Help -> Install New Sofware -> Choose from the drop-down list <br>
 +
- Name: CDT-<ECLIPSE VERSION> <br>
 +
- Location: http://download.eclipse.org/tools/cdt/releases/<VERSION> <br>
 +
''For example:'' <br>
 +
- ''Name:'' CDT-Neon.2 <br>
 +
- ''Location:'' http://download.eclipse.org/tools/cdt/releases/9.2 <br>
  
 
- Click Ok <br>
 
- Click Ok <br>
 
- Select: CDT Optional Features -> C/C++ GDB Hardware Debugging <br>
 
- Select: CDT Optional Features -> C/C++ GDB Hardware Debugging <br>
- Next, Agree, Finish <br>
+
- Next, Next, Agree, Finish <br>
 
- Restart <br>
 
- Restart <br>
  
 
<br>
 
<br>
<h3> Lets now install GNU ARM Plugins </h3>
+
<h3> Install GNU ARM Plugins </h3>
  
Go to Help -> Installa New Sofware --> add <br>
+
Go to Help -> Install New Sofware -> add <br>
 
- Name: GNU ARM Eclipse Plugins <br>
 
- Name: GNU ARM Eclipse Plugins <br>
 
- Location: http://gnuarmeclipse.sourceforge.net/updates <br>
 
- Location: http://gnuarmeclipse.sourceforge.net/updates <br>
Line 106: Line 150:
 
- Select All <br>
 
- Select All <br>
 
- Next, Next, Agree, Finish <br>
 
- Next, Next, Agree, Finish <br>
- Accept all not know <br>
+
- You will be asked to accept some specific not known content, do it <br>
 
- Restart <br>
 
- Restart <br>
  
  
 
<h2> Import Project </h2>
 
<h2> Import Project </h2>
 +
(More info at: http://gnuarmeclipse.github.io/plugins/install/)
 +
 +
Go to File -> New -> C Project <br>
 +
- Name: test <br>
 +
- Location: Select where the code is <br>
 +
- Project type -> Makefile project -> Empty Project -> Cross ARM GCC <br>
 +
 +
- Next, Next <br>
 +
 +
Toolchain: <br>
 +
- Name: GNU Tools for ARM Embedded Processors (arm-none-eabi-gcc) <br>
 +
- Path: /opt/compilerSTM32 (if installed as in previous section, if not check where did you do it!!) <br>
 +
 +
- Finish <br>
 +
 +
If everything ok, you are able to compile with the hammer.
  
 
<h2> Set OpenOCD </h2>
 
<h2> Set OpenOCD </h2>
 +
(More info at: https://balau82.wordpress.com/2014/02/23/stm32-p152-development-with-eclipse-on-linux/)
 +
 +
- Run -> External tools -> External Tools Configurations <br>
 +
- Program -> New <br>
 +
- Location: /opt/openocd/bin/openocd (if installed as in previous section, if not check where did you do it!!) <br>
 +
- Working Directory: A Dir where there is the openocd.cfg (typically where our porject is) <br>
 +
- Arguments: -f openocd.cfg -c "init" -c "halt" -c "reset halt"
 +
- Apply
  
 
<h2> Set GDB </h2>
 
<h2> Set GDB </h2>
 +
(More info at: https://pixhawk.org/dev/jtag/gdb_eclipse)
 +
 +
Go to Run -> Debug Configurations <br>
 +
Create a GDB Hardware Debugging <br>
 +
In Main: <br>
 +
- Application: The .elf file that will be generated by the project (e.g. sensedin.elf) <br>
 +
- Project: The project location <br>
 +
- Use workspace settings <br>
 +
- Select legacy GDB Hardware Debugging Launcher by clinking Select other <br>
 +
 +
In Debugger: <br>
 +
- GDB Command: /opt/compilerSTM32/bin/arm-none-eabi-gdb <br>
 +
- Standard(Linux) <br>
 +
- Version: mi <br>
 +
- Use remote target <br>
 +
- JTag: TCP/IP <br>
 +
- IP: localhost <br>
 +
- Port: 3333 <br>
 +
 +
In Startup: <br>
 +
- Un-click Reset and Delay <br>
 +
- Un-click Halt <br>
 +
- In command box type:  <br>
 +
- monitor reset halt <br>
 +
- Click Load Image <br>
 +
- Click Load symbols <br>
 +
- In Run Commands write: <br>
 +
- set $pc = Reset_Handler <br>
 +
- stepi <br>
 +
 +
Finally click Apply

Latest revision as of 19:22, 10 July 2018

Base Environment

Install Compiler gcc-arm-none-eabi

Download last version of GCC ARM Embedded from: https://launchpad.net/gcc-arm-embedded/+download

Untar the compiler:

tar -xvjf gcc-arm-none-eabi-<VERSION>.tar.bz2

Copy it to a common place:

sudo cp -r gcc-arm-none-eabi-<VERSION> /opt/compilerSTM32

Important!! If in a 64 bits machine, you will need to install the following libs:

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 

Install OpenOCD On-Chip Debugger

Install dependencies:

sudo apt-get install flex bison libgmp3-dev libmpfr-dev libncurses5-dev libmpc-dev autoconf texinfo build-essential \
libftdi-dev libusb-1.0-0-dev libexpat1-dev

Download last version of Openocd from: http://openocd.org/

Untar openocd:

tar -xvzf openocd-<VERSION>.tar.gz

Go into the directory:

cd openocd-<VERSION>

Configure openocd compilation:

./configure --prefix=/opt/openocd/ --enable-jlink --enable-amtjtagaccel --enable-ftdi --enable-buspirate --enable-stlink \
--enable-ftdi --enable-rlink

Compile it:

make

Install:

sudo make install

Prepare its use according to udev:

(old versions)
sudo cp -r contrib/openocd.udev /etc/udev/rules.d/90-jtag.rules

(new versions)
sudo cp -r contrib/99-openocd.rules /etc/udev/rules.d/

sudo udevadm control --reload-rules


Grant permits to user: user must be in plugdev:

sudo vi /etc/group

Basic Usage

Need to load environment. Create a env.sh file with:

export PATH=/opt/openocd/bin:/opt/compilerSTM32/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

Load the environment:

source env.sh

Open ocd:

openocd -f openocd.cfg -c "init" -c "halt" -c "reset halt"

Eclipse Environment

It is mandatory to install the Base Environment first


Install Eclipse

(More info at: http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Fgetting_started%2Fcdt_w_import.htm)

Download last version of Eclipse IDE for C/C++ Developers from: http://www.eclipse.org/downloads/

Untar eclipse:

tar -xvzf eclipse-cpp-<VERSION>-linux-gtk-x86_64.tar.gz

Go into directory and execute eclipse:

cd eclipse
./eclipse

Define workspace (e.g. /home/<USER>/stm32EclipseWorkspace)

Install C/C++ Developping tools

Go to Help -> Install New Sofware -> Choose from the drop-down list
- Name: CDT-<ECLIPSE VERSION>
- Location: http://download.eclipse.org/tools/cdt/releases/<VERSION>
For example:
- Name: CDT-Neon.2
- Location: http://download.eclipse.org/tools/cdt/releases/9.2

- Click Ok
- Select: CDT Optional Features -> C/C++ GDB Hardware Debugging
- Next, Next, Agree, Finish
- Restart


Install GNU ARM Plugins

Go to Help -> Install New Sofware -> add
- Name: GNU ARM Eclipse Plugins
- Location: http://gnuarmeclipse.sourceforge.net/updates


- Click Ok
- Select All
- Next, Next, Agree, Finish
- You will be asked to accept some specific not known content, do it
- Restart


Import Project

(More info at: http://gnuarmeclipse.github.io/plugins/install/)

Go to File -> New -> C Project
- Name: test
- Location: Select where the code is
- Project type -> Makefile project -> Empty Project -> Cross ARM GCC

- Next, Next

Toolchain:
- Name: GNU Tools for ARM Embedded Processors (arm-none-eabi-gcc)
- Path: /opt/compilerSTM32 (if installed as in previous section, if not check where did you do it!!)

- Finish

If everything ok, you are able to compile with the hammer.

Set OpenOCD

(More info at: https://balau82.wordpress.com/2014/02/23/stm32-p152-development-with-eclipse-on-linux/)

- Run -> External tools -> External Tools Configurations
- Program -> New
- Location: /opt/openocd/bin/openocd (if installed as in previous section, if not check where did you do it!!)
- Working Directory: A Dir where there is the openocd.cfg (typically where our porject is)
- Arguments: -f openocd.cfg -c "init" -c "halt" -c "reset halt" - Apply

Set GDB

(More info at: https://pixhawk.org/dev/jtag/gdb_eclipse)

Go to Run -> Debug Configurations
Create a GDB Hardware Debugging
In Main:
- Application: The .elf file that will be generated by the project (e.g. sensedin.elf)
- Project: The project location
- Use workspace settings
- Select legacy GDB Hardware Debugging Launcher by clinking Select other

In Debugger:
- GDB Command: /opt/compilerSTM32/bin/arm-none-eabi-gdb
- Standard(Linux)
- Version: mi
- Use remote target
- JTag: TCP/IP
- IP: localhost
- Port: 3333

In Startup:
- Un-click Reset and Delay
- Un-click Halt
- In command box type:
- monitor reset halt
- Click Load Image
- Click Load symbols
- In Run Commands write:
- set $pc = Reset_Handler
- stepi

Finally click Apply