daniel-thompson / i2c-star

A clone of the i2c-tiny-usb based upon STM32 and libopencm3
GNU General Public License v3.0
124 stars 31 forks source link

Why have a two step (STLink and DFU) install process for STM32F1 #9

Closed tomverbeure closed 5 years ago

tomverbeure commented 5 years ago

Hey!

Thanks for i2c-star. It made my life a lot easier!

One remark: in the current README and build flow, installing i2c-star is a two-step process: first install a DFU bootloading, and then flashing the actual firmware.

Instead of doing that, I simply address 0x08002000 to 0x08000000 in ./src/lctech-f103.ld, compiled the code, ran arm-none-eabi-objcopy -O binary i2c-stm32f1-usb.elf i2c-stm32f1-usb.bin and then flashed it directly into the Blue Pill: st-flash write i2c-stm32f1-usb.bin 0x08000000.

If you need an STLINK anyway to flash the DFU, why go through the trouble to make this a two-step process?

Thanks! Tom

daniel-thompson commented 5 years ago

If you need an STLINK anyway to flash the DFU, why go through the trouble to make this a two-step process?

It means the STLink is only required when the board is "manufactured". With a bootloader we are able to update the firmware in a deployed device without having to attach the STLink to it again (pressing reset will take the board in/out of bootloader mode).

Not only is this hugely convenient for development/debugging but also it means you can give one to a friend without having to give them an STLink as well...

BTW if you are building a lot of these items and simply want a single flashing step then there is no need to rip out the bootloader. You can construct a one-shot binary with objcopy and a carefully crafted pair of dd commands.

Finally note that the STM32F4 version does not have a bootloader. That is because most other STM32 series devices (almost everything except STM32F1) have a DFU bootloader in ROM already.

tomverbeure commented 5 years ago

Ok, that makes sense.

I'll document in my own notes how I made things work without DFU.

Thanks again. My I2C controlled sensor is working very nicely.

Tom