|
|
*TODO still work in progress*
|
|
|
|
|
|
So you wrote your driver and then created a test firmware that you want to run on a board.
|
|
|
|
|
|
You can start from STM32 Discovery board: that's a good idea, because these are very
|
|
|
You can start from an STM32 Discovery board: that's a good idea, because these are very
|
|
|
versatile boards that you can easily use for test porpouses. Otherwise, if you have one,
|
|
|
you can directly flash it on one of Skyward's Tropper/Anakin boards.
|
|
|
|
|
|
### Requirements
|
|
|
You'll need a binary file (bin, elf...) that you have built for the right board using SBS (see [here](https://github.com/skyward-er/skyward-boardcore/wiki/Skyward-Build-Systems-(SBS))).
|
|
|
You'll need a binary file (bin, elf...) that you have built for the right board
|
|
|
using SBS (see [here](https://github.com/skyward-er/skyward-boardcore/wiki/Skyward-Build-Systems-(SBS))).
|
|
|
|
|
|
Then obviously you'll need a board and a USB-to-MiniUSB cable that you'll have to plug
|
|
|
to the corresponding port (if the board has two, it's the biggest one).
|
|
|
|
|
|
What's written here is taken from Miosix's Quick start guide: <https://miosix.org/wiki/index.php?title=Quick_start#Getting_started>.
|
|
|
|
|
|
|
|
|
**Software**
|
|
|
|
|
|
*Windows*
|
|
|
|
|
|
Install ST-Link Utility.
|
|
|
|
|
|
Then obviously you'll need a board and a USB-to-MiniUSB cable that you'll have to plug to the corresponding port (if the board has two, it's the biggest one).
|
|
|
*Linux*
|
|
|
|
|
|
**Windows**
|
|
|
You can install QSTLink2
|
|
|
|
|
|
Download ST-Link Utility.
|
|
|
```
|
|
|
sudo add-apt-repository ppa:fpoussin/ppa
|
|
|
sudo apt-get update
|
|
|
sudo apt-get install qstlink2
|
|
|
wget https://raw.githubusercontent.com/mobyfab/QStlink2/master/res/49-stlinkv2.rules
|
|
|
sudo mv 49-stlinkv2.rules /etc/udev/rules.d
|
|
|
sudo chown root:root /etc/udev/rules.d/49-stlinkv2.rules
|
|
|
```
|
|
|
Or you can use `stm32flash` or `openocd` from CLI (the last one is needed to run SBS's script).
|
|
|
|
|
|
**Linux**
|
|
|
**Serial Port**
|
|
|
|
|
|
Download qstlink2(GUI) or use openocd(CLI) or qstflash(CLI).
|
|
|
*Windows*
|
|
|
|
|
|
*Linux*
|
|
|
|
|
|
Miosix redirects stdin/stdout to a serial port by default on most boards, so it is important to set up serial ports correctly on your development machine. On most Linux distros serial ports, both the physical ones like /dev/ttyS0 and the USB to serial adapters like /dev/ttyUSB0 are owned by the dialout group, so you need to add your user to that group before you can access them.
|
|
|
|
|
|
```
|
|
|
sudo usermod -a -G dialout `id -un` # Add yourself to the dialout group
|
|
|
```
|
|
|
Note that you may need to reboot your computer before the change takes effect.
|
|
|
|
|
|
Finally, you'll need a program to interact with the serial port, like GNU `screen` or `gtkterm`.
|
|
|
|
|
|
### Discovery Boards
|
|
|
|
|
|
#### STM32F429
|
|
|
#### STM32F407
|
|
|
**Flashing**
|
|
|
|
|
|
### Skyward Boards
|
|
|
Discovery boards are quite simple to use: plug your board via usb to your PC and then
|
|
|
use QSTLink to flash the binary file on the board.
|
|
|
|
|
|
Or, if you prefer, you can use two scripts that you can find in the `scripts\` folder:
|
|
|
|
|
|
#### StormTrooper Master
|
|
|
#### StormTrooper Daughter
|
|
|
- start_openocd.sh: starts openocd(leave it in background)
|
|
|
- openocd-flash.sh <binary_file_name>: connects to openocd using gdb and
|
|
|
uses it to flash the binary file into the connected board.
|
|
|
|
|
|
If the program is not running, power-cycle the board and you'll see it working!
|
|
|
|
|
|
**Serial Communication**
|
|
|
|
|
|
To see what's happening inside the board, you can communicate via serial port, either by
|
|
|
using a custom port
|
|
|
|
|
|
```cpp
|
|
|
int fd = open ("/dev/auxtty"); //Needs to be defined in miosix
|
|
|
if(fd > 0){
|
|
|
char message[11];
|
|
|
read(fd, message, 10);
|
|
|
write(fd, message, 10;
|
|
|
}
|
|
|
```
|
|
|
|
|
|
Or stdin/stdout, which is redirected on the DEFAULT serial port of that board
|
|
|
|
|
|
```cpp
|
|
|
printf("DEBUG MESSAGE!"); //This will be redirected on the default serial port
|
|
|
}
|
|
|
```
|
|
|
|
|
|
You can look at the config/arch/.../.../board-settings.h to check which is the
|
|
|
default serial port and if there are other ports available (you can find
|
|
|
some of these settings in the [Cheat Sheet](../wiki/Cheat-Sheet#serial-ports)).
|
|
|
|
|
|
Having done this, you can communicate via serial port with your board using
|
|
|
a FTDI-USB module and screen/gtkterm on *Linux* or Putty on *Windows*.
|
|
|
|
|
|
For more details on how to use these boards efficently, look at the
|
|
|
[Debugging on a Discovery](../wiki/Debugging-on-a-Discovery) guide.
|
|
|
|
|
|
### Skyward Boards
|
|
|
|
|
|
Useful links
|
|
|
-------------
|
|
|
* Miosix guide
|
|
|
* STM429 Mbed
|
|
|
* Debugging on a Discovery |
|
|
#### Anakin
|
|
|
There are two files in the `scripts` folder that can be useful:
|
|
|
- anakin.sh: flash on Anakin via serial port.
|
|
|
- anakin_client_curses: an ncurses client to visualize the data that are sent
|
|
|
on the serial port when using `anakin-test-dma`.
|
|
|
#### StormTrooper |