aboutsummaryrefslogtreecommitdiff
path: root/src/platforms/native/usbdfu.c
diff options
context:
space:
mode:
authorbon@elektron.ikp.physik.tu-darmstadt.de2014-01-06 12:51:09 +0100
committerGareth McMullin2014-01-24 04:59:09 +0800
commit0c9d5d816639c2b4ebce2b234be52e6aac4275a7 (patch)
treea21f5a20d8c8a3890c6086e0335d6649789fcc16 /src/platforms/native/usbdfu.c
parentac0fc8216ad086a350f0478b9d83c7a924fcb94b (diff)
Add dfu bootloader update application and use absolute delay for stlink
Hello, appended 3 patches - adds a dfu-bootloader appliaction - uses absolute delays when waiting for pull-up delays on the STLINK (hopefully fixes issue #30) Updating the dfu-bootloader by additional application is helpfull for the STLINK, as for flashing the bootloader by SWDb otherwise jumpers need to be soldered or external SWD is not possible. Use like: - dfu-util -s 0x08002000:leave -D dfu_upgrade.bin - dfu-util -s 0x08000000:leave -D blackmagic_dfu.bin - Push reset buttom and reconnect to enter new dfu bootloader - dfu-util -s 0x08002000:leave -D blackmagic.bin -- Uwe Bonnes bon@elektron.ikp.physik.tu-darmstadt.de Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ---------- >From fae5022c304a8866f056ea66660ac7ce3809dcf8 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> Date: Sun, 20 Oct 2013 15:00:36 +0200 Subject: F1: Prepare to update dfu bootloader via DFU with additional application.
Diffstat (limited to 'src/platforms/native/usbdfu.c')
-rw-r--r--src/platforms/native/usbdfu.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/platforms/native/usbdfu.c b/src/platforms/native/usbdfu.c
index 068138e..e9094a3 100644
--- a/src/platforms/native/usbdfu.c
+++ b/src/platforms/native/usbdfu.c
@@ -25,6 +25,8 @@
#include "usbdfu.h"
+uint32_t app_address = 0x08002000;
+
void dfu_detach(void)
{
/* USB device must detach, we just reset... */
@@ -38,7 +40,7 @@ int main(void)
if(gpio_get(GPIOB, GPIO12))
dfu_jump_app_if_valid();
- dfu_protect_enable();
+ dfu_protect(DFU_MODE);
rcc_clock_setup_in_hse_8mhz_out_72mhz();
systick_set_clocksource(STK_CSR_CLKSOURCE_AHB_DIV8);
@@ -56,7 +58,7 @@ int main(void)
gpio_set_mode(GPIOB, GPIO_MODE_INPUT,
GPIO_CNF_INPUT_FLOAT, GPIO2 | GPIO10);
- dfu_init(&stm32f103_usb_driver);
+ dfu_init(&stm32f103_usb_driver, DFU_MODE);
gpio_set(GPIOA, GPIO8);
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_2_MHZ,