generated from squadracorsepolito/c-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6effa82
commit 90a933b
Showing
2 changed files
with
66 additions
and
17 deletions.
There are no files selected for viewing
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,83 @@ | ||
# TSAL Latch Board - Battery Side - Firmware | ||
This repo contains the firmware and bootloader for the SensorBoard Device v3.1 | ||
|
||
 | ||
 | ||
|
||
--- | ||
## Develop | ||
**PLEASE STOP USING CRLF LINE ENDING : use LF as normal people do** | ||
|
||
Git can handle this for you correctly! | ||
|
||
If you want it configured for this project only use `--local` otherwise for your whole system use `--global`. | ||
|
||
- On windows: `git config --local core.autocrlf=true` | ||
- On Linux/OSX: `git config --local core.autocrlf=input` | ||
|
||
Checkout out either [this](https://www.git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_formatting_and_whitespace) or [this](https://stackoverflow.com/a/46347609/9167660) for more information. | ||
|
||
Don't use `.gitattributes` it gets messy very quickly. | ||
|
||
## Dependencies | ||
- `CMake` | ||
- `arm-none-eabi-gcc` | ||
- `openocd` | ||
- `STM32CubeMx` | ||
- `arm-none-eabi-gdb`, `arm-none-eabi-gcc`, `arm-none-eabi-newlib`,`arm-none-eabi-binutils`: ARM toolchain necessary to compile and debug the firmware | ||
- `make`: or similar | ||
- `openocd`: to flash the firmware on the target via a debug probe (STLINK) | ||
- `bootcommander`, `libopenblt`: to flash the firmware via can-bus | ||
|
||
## Compile | ||
To compile the code in Debug configuration (standard method) | ||
## Build | ||
If all the software dependencies are available through `$PATH` | ||
```bash | ||
make | ||
``` | ||
otherwise specify them via: | ||
```bash | ||
make GCC_PATH=/<path_to_compiler> | ||
``` | ||
This will build the firmware to be flashed via `openocd` and a debug probe (STLINK) | ||
## Build Bootloader | ||
All software dependencies must be available in `$PATH` | ||
```bash | ||
cd ./openblt_f446re | ||
make | ||
cd .. | ||
``` | ||
This will build the Bootloader firmware to be flashed via `openocd` and a debug probe (STLINK) | ||
|
||
## Flash | ||
Two approaches for flashing: | ||
- Baremetal no bootloader | ||
- Bootloader + flash via can | ||
### Baremetal no bootloader | ||
Make sure the debug probe is attached to the target and they see each other. | ||
To verify this run this command from the project rootdir: | ||
```bash | ||
openocd -f openocd.cfg | ||
``` | ||
To compile the code in Release configuration (optimized, no debug symbols) | ||
It should look something like this: | ||
```bash | ||
TODO add openocd status | ||
``` | ||
make BUILD_TYPE=Release | ||
|
||
Make sure you have `openocd` dependency in `$PATH`. | ||
```bash | ||
make flash | ||
``` | ||
## Flash On Linux | ||
1) the stlink programmer is correctly connected. | ||
2) the board is powerd on (24V power with DC/DC or 5V power without) | ||
3) Linux Udev rules are correctly set for `openocd` (check `/etc/udev/rules.d` folder or the [openocd documentation](https://openocd.org/doc-release/README)). The result of not having correctly set `udev` rules is that `openocd` will not run because of missing permissions, while it will run with `sudo` (** DON'T RUN OPENOCD or any other binary WITH SUDO **) | ||
4) Run from the repo root directory | ||
otherwise specify the path via: | ||
```bash | ||
make flash OPENOCD_PATH=/<openocd_path> | ||
``` | ||
### Bootloader + flash via can | ||
First flash the bootloader on the device (all dependencies must be in `$PATH`, the debugger probe must be able to talk to the target see ) | ||
```bash | ||
cd ./openblt_f446re | ||
make flash | ||
cd .. | ||
``` | ||
Or | ||
Then connect the sensorboard device on a CAN bus network where you can send and receive data. | ||
```bash | ||
make can_flash | ||
``` | ||
openocd -f openocd.cfg -c "program build/tlb_battery.elf verify reset exit" | ||
If `bootcommander` dependency is not in `$PATH` specify it like this: | ||
```bash | ||
make can_flash BOOTCOMMANDER_PATH=/<path_to_bootcomamnder_dir> | ||
``` | ||
|