diff options
| author | Christopher Arndt | 2016-03-08 08:42:30 +0100 |
|---|---|---|
| committer | Damien George | 2016-03-09 13:26:23 +0000 |
| commit | 07554486eeb73665b1bf61ee9af32e4a6e7e458a (patch) | |
| tree | dec1d52f1570fc6aed6abc6581c3de2348a37693 /stmhal | |
| parent | 6b80ebe32ef57cc3bef1b6309433354181867611 (diff) | |
stmhal: Add makefile target to deploy stmhal build via ST-LINK.
Diffstat (limited to 'stmhal')
| -rw-r--r-- | stmhal/Makefile | 7 | ||||
| -rw-r--r-- | stmhal/README.md | 25 |
2 files changed, 32 insertions, 0 deletions
diff --git a/stmhal/Makefile b/stmhal/Makefile index 7e001bc30..93ff92bc8 100644 --- a/stmhal/Makefile +++ b/stmhal/Makefile @@ -29,6 +29,7 @@ USE_PYDFU ?= 1 PYDFU ?= ../tools/pydfu.py DFU_UTIL ?= dfu-util DEVICE=0483:df11 +STFLASH ?= st-flash CROSS_COMPILE = arm-none-eabi- @@ -286,6 +287,12 @@ else $(Q)$(DFU_UTIL) -a 0 -d $(DEVICE) -D $< endif +deploy-stlink: $(BUILD)/firmware.dfu + $(ECHO) "Writing $(BUILD)/firmware0.bin to the board via ST-LINK" + $(Q)$(STFLASH) write $(BUILD)/firmware0.bin 0x08000000 + $(ECHO) "Writing $(BUILD)/firmware1.bin to the board via ST-LINK" + $(Q)$(STFLASH) --reset write $(BUILD)/firmware1.bin 0x08020000 + $(BUILD)/firmware.dfu: $(BUILD)/firmware.elf $(ECHO) "Create $@" $(Q)$(OBJCOPY) -O binary -j .isr_vector $^ $(BUILD)/firmware0.bin diff --git a/stmhal/README.md b/stmhal/README.md index 18912cf8d..457aaf996 100644 --- a/stmhal/README.md +++ b/stmhal/README.md @@ -57,6 +57,31 @@ Or using `dfu-util` directly: $ sudo dfu-util -a 0 -d 0483:df11 -D build-PYBV11/firmware.dfu + +### Flashing the Firmware with stlink + +ST Discovery or Nucleo boards have a builtin programmer called ST-LINK. With +these boards and using Linux or OS X, you have the option to upload the +`stmhal` firmware using the `st-flash` utility from the +[stlink](https://github.com/texane/stlink) project. To do so, connect the board +with a mini USB cable to its ST-LINK USB port and then use the make target +`deploy-stlink`. For example, if you have the STM32F4DISCOVERY board, you can +run: + + $ make BOARD=STM32F4DISC deploy-stlink + +The `st-flash` program should detect the USB connection to the board +automatically. If not, run `lsusb` to determine its USB bus and device number +and set the `STLINK_DEVICE` environment variable accordingly, using the format +`<USB_BUS>:<USB_ADDR>`. Example: + + $ lsusb + [...] + Bus 002 Device 035: ID 0483:3748 STMicroelectronics ST-LINK/V2 + $ export STLINK_DEVICE="002:0035" + $ make BOARD=STM32F4DISC deploy-stlink + + Accessing the board ------------------- |
