|
|
Prerequisites for this guide is having installed Git, Python3, the [Miosix toolchain](https://miosix.org/wiki/index.php?title=Quick_start) and the STM32 ST-Link software.
|
|
|
Also a compatible board is needed: all the examples are made with a STM32F407VG Discovery.
|
|
|
|
|
|
This tutorial is a simple led blink test: it will teach you how to clone the boardcore repository, create your own entrypoint (*i.e. Main*) and flash the compiled binary in the target board.
|
|
|
|
|
|
## Clone the repo
|
|
|
|
|
|
Open the git console inside a folder and clone the boardcore repository:
|
|
|
|
|
|
```
|
|
|
git clone --recurse-submodules https://git.skywarder.eu/r2a/skyward-boardcore.git
|
|
|
cd skyward-boardcore
|
|
|
./sbs -v
|
|
|
```
|
|
|
|
|
|
If all was built without errors you're good to start. If you found
|
|
|
problems with the submodules, try to:
|
|
|
|
|
|
```
|
|
|
git submodule sync
|
|
|
git submodule update --init --recursive --remote
|
|
|
```
|
|
|
|
|
|
## Create your branch
|
|
|
|
|
|
First of all, create a new working branch off from testing ( [why?](Git-Workflow) ):
|
|
|
|
|
|
```
|
|
|
git checkout testing
|
|
|
git pull
|
|
|
git checkout -b tutorial-dev
|
|
|
```
|
|
|
The [git workflow](Git-Workflow) page gives you some more hints on how to use git.
|
|
|
|
|
|
## Create your entrypoint
|
|
|
|
|
|
Now that you are in your local branch, go to `src/entrypoints` and create a file called `test-led.cpp`. You can copy the code below:
|
|
|
|
|
|
```cpp
|
|
|
#include <Common.h>
|
|
|
|
|
|
using namespace miosix;
|
|
|
|
|
|
int main(){
|
|
|
while(1) {
|
|
|
ledOn();
|
|
|
miosix::Thread::sleep(200);
|
|
|
ledOff();
|
|
|
miosix::Thread::sleep(200);
|
|
|
}
|
|
|
}
|
|
|
```
|
|
|
|
|
|
## Compile with SBS
|
|
|
|
|
|
To compile your entrypoint you must add it to the build system (called [SBS](Skyward-Build-System-(SBS))): open `sbs.conf` (in the top folder), go to the end of the file and write:
|
|
|
|
|
|
```
|
|
|
[test-led]
|
|
|
Type: board
|
|
|
BoardId: stm32f407vg_stm32f4discovery
|
|
|
BinName: test-led
|
|
|
Include:
|
|
|
Defines:
|
|
|
Main: test-led
|
|
|
```
|
|
|
|
|
|
Now compile:
|
|
|
|
|
|
```
|
|
|
./sbs -b test-led -v
|
|
|
```
|
|
|
-----
|
|
|
:warning: In this and the following examples we are assuming that you will run the code on an STM32F407VG Discovery board: if that is not the case, you should change
|
|
|
the `BoardId` field in the `sbs.conf` file. The possible board IDs are defined at the beginning of the file.
|
|
|
|
|
|
----
|
|
|
|
|
|
## Flash on a board
|
|
|
|
|
|
Now the program is ready to be executed on the target you chose. To do that, you need to:
|
|
|
|
|
|
* Plug the board to your PC (may need drivers to be recognized)
|
|
|
* Open the STM32 utility software
|
|
|
* Target > Connect
|
|
|
* Target > Program and choose `bin/test-led/test-led.elf`
|
|
|
* Program
|
|
|
|
|
|
Restart the board and look at the led blinking.
|
|
|
|
|
|
If something went wrong, try looking at [how to flash on a target board](Flashing-on-a-Target-Board).
|
|
|
|
|
|
<!---
|
|
|
# What's next
|
|
|
|
|
|
These were the basis of how the build system works. You can now look at:
|
|
|
|
|
|
- [Configuring the Visual Studio Code IDE](VSCode-Configuration)
|
|
|
- [Configuring the Eclipse IDE](Eclipse-Configuration)
|
|
|
- [Workflow of the Git repository](Git-Workflow)
|
|
|
- [Some coding standards](Coding-Guidelines)
|
|
|
---> |
|
|
\ No newline at end of file |