... | ... | @@ -7,16 +7,16 @@ This tutorial is a simple led blink test: it will teach you how to clone the boa |
|
|
|
|
|
Open the git console inside a folder and clone the boardcore repository:
|
|
|
|
|
|
```
|
|
|
git clone --recurse-submodules https://git.skywarder.eu/r2a/skyward-boardcore.git
|
|
|
```sh
|
|
|
git clone --recurse-submodules https://git.skywarder.eu/scs/skyward-boardcore.git
|
|
|
cd skyward-boardcore
|
|
|
./sbs -v
|
|
|
./sbs -v # build all the entrypoint (with verbose output)
|
|
|
```
|
|
|
|
|
|
If all was built without errors you're good to start. If you found
|
|
|
problems with the submodules, try to:
|
|
|
If all was built without errors you're good to start.
|
|
|
If you found problems with the submodules, try to:
|
|
|
|
|
|
```
|
|
|
```sh
|
|
|
git submodule sync
|
|
|
git submodule update --init --recursive --remote
|
|
|
```
|
... | ... | @@ -34,47 +34,49 @@ The [git workflow](Git-Workflow) page gives you some more hints on how to use gi |
|
|
|
|
|
## 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:
|
|
|
Now that you are in your local branch, go to `src/entrypoints` and create a file called `led-blink.cpp`. You can copy the code below:
|
|
|
|
|
|
```cpp
|
|
|
#include <Common.h>
|
|
|
|
|
|
using namespace miosix;
|
|
|
|
|
|
int main(){
|
|
|
while(1) {
|
|
|
int main()
|
|
|
{
|
|
|
while(1)
|
|
|
{
|
|
|
ledOn();
|
|
|
miosix::Thread::sleep(200);
|
|
|
ledOff();
|
|
|
miosix::Thread::sleep(200);
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
```
|
|
|
|
|
|
By calling *ledOn()* and *ledOff()* Miosix automatically sets high or low the [GPIO](GPIO-Usage-&-Used-Pins.md) associated to the default board LED (called `_led` and specified in `libs/miosix-kernel/arch/<your-arch>/<your-board>/interfaces-impl/bsp_impl.h`).
|
|
|
|
|
|
## 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]
|
|
|
[led-blink]
|
|
|
Type: board
|
|
|
BoardId: stm32f407vg_stm32f4discovery
|
|
|
BinName: test-led
|
|
|
BinName: led-blink
|
|
|
Include:
|
|
|
Defines:
|
|
|
Main: test-led
|
|
|
Main: led-blink
|
|
|
```
|
|
|
|
|
|
Now compile:
|
|
|
|
|
|
```
|
|
|
./sbs -b test-led -v
|
|
|
./sbs -b led-blink -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.
|
|
|
|
|
|
----
|
|
|
> :warning: **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
|
|
|
|
... | ... | @@ -83,7 +85,7 @@ Now the program is ready to be executed on the target you chose. To do that, you |
|
|
* 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`
|
|
|
* Target > Program and choose `bin/led-blink/led-blink.elf`
|
|
|
* Program
|
|
|
|
|
|
Restart the board and look at the led blinking.
|
... | ... | |