Bootloader imported in SW4STM32 compiles but stuck after usb_init

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
User avatar
RogerClark
Posts: 7537
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Bootloader imported in SW4STM32 compiles but stuck after usb_init

Post by RogerClark » Wed Dec 06, 2017 10:15 am

PS.

There is some code for a F4 booloader using the HAL that @victor_pv wrote.

But the problem with it is that its not DFU, its DFUSE and needs a different version of dfu-util to support it and completely different DFU drivers on Windows to the ones we currently use.
Those drivers need to be manually installed using Zadig, which is a pain

Hence something that just works with conventional DFU would be a lot better as it would mean people could upload to the F1 and F4 without needing to have separate copies of dfu-util etc etc

logd32
Posts: 20
Joined: Thu Sep 07, 2017 8:41 pm

Re: Bootloader imported in SW4STM32 compiles but stuck after usb_init

Post by logd32 » Wed Dec 06, 2017 11:27 am

ohh, i was not aware of this https://github.com/stm32duino/Arduino_C ... r/variants its probably the most up to date for F3/F4 and L4.
OK the Chinese core is very very old, useless to check.
I
but that uses the HAL, and there is @danielef's core which is also HAL based.
Is it a problem to use HAL? i dont particularly like HAL for itself but for arduino STM32 core it could help unification of targets.
But the problem with it is that its not DFU, its DFUSE and needs a different version of dfu-util to support it and completely different DFU drivers on Windows to the ones we currently use.
Those drivers need to be manually installed using Zadig, which is a pain
yes i dont want to go that way neither, i think the current DFU bootloader is good, i only modified it to have 100% success on OSX and added a function to stay in perpetual bootloader mode with double tap on reset so no IO used for user key

@danielef's core https://github.com/danieleff/STM32GENER ... 2/variants
Indeed everything is there for F1 F3 L1 and L4, i wonder if he made a bootlader as well

User avatar
RogerClark
Posts: 7537
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Bootloader imported in SW4STM32 compiles but stuck after usb_init

Post by RogerClark » Wed Dec 06, 2017 7:29 pm

The Maple bootloader in my repo ( the one we all use), altready has a feature to hold if you put a magic number in backup register DR10.

I posted about this many times before.


Re: other bootloader

I don’t think @danielef has written a bootloader

@jcw wrote one ages ago, but it does not implement DFU, I think it uses a serial data format.


The Blackmagic probe has a DFU bootloader and uses LibOpenCM3, but it only supports F1.
They used to also support F4, but dropped support for it ages ago, before they did a major code reorganisation

You should be able to modify their F1 bootloader to run in F4 etc, but it isn’t quite the same as the Maple bootloader as it expects a button to be pressed at boot time to switch it into DFU mode, rather than always going into DFU for a fixed period of time before jumping to the Application code.

The good thing about the Blackmagic Probe bootloader, is it will fit in 8k

logd32
Posts: 20
Joined: Thu Sep 07, 2017 8:41 pm

Re: Bootloader imported in SW4STM32 compiles but stuck after usb_init

Post by logd32 » Fri Dec 22, 2017 11:27 am

Rick Kimball wrote:
Tue Dec 05, 2017 10:02 pm

I then created a new SW4STM32 project selecting the "Make project from existing makefile". I selected the directory of the github source . I was able to create a new build target 'generic-pc13' I did a clean and build. It also worked fine. It isn't a "true" eclipse project but it allows you to use the eclipse environment to edit.

Again this was all on linux so I have no idea how it would work on OS/X
@Rick Kimball
Hi,
Would you mind to share the SW4STM32 project? when i use "makefile from exiting code" and then select AC6 STM32 MCU GCC the resulting project can build but it only make a hex file, and when i uplaod this hex file maually (with stlink binary) it writes 60 pages or 1K, i dont know why, also it doesnt work : the target doesnt blink.
I would be curious to test with the project you made, did you try to flash the resulting binary?

logd32
Posts: 20
Joined: Thu Sep 07, 2017 8:41 pm

Re: Bootloader imported in SW4STM32 compiles but stuck after usb_init

Post by logd32 » Fri Dec 22, 2017 11:46 am

RogerClark wrote:
Wed Dec 06, 2017 7:29 pm
The Blackmagic probe has a DFU bootloader and uses LibOpenCM3, but it only supports F1.
They used to also support F4, but dropped support for it ages ago, before they did a major code reorganisation
You should be able to modify their F1 bootloader to run in F4 etc, but it isn’t quite the same as the Maple bootloader as it expects a button to be pressed at boot time to switch it into DFU mode, rather than always going into DFU for a fixed period of time before jumping to the Application code.
The good thing about the Blackmagic Probe bootloader, is it will fit in 8k
@RogerClark
thanks I will check into this, i dont like the perspective to use LibOpenCM3. Best option is probably to modifiy the current bootlader, but the makefile makes the task complicate, importing it in SW4STM32 as makefile project result in a non working binary.
I finally switched to the Arduino HAL core and the 3 boards variants are now fully working (F1, L1, F3), so bootlaoder for L1 and F3 is the last bit.
RogerClark wrote:
Wed Dec 06, 2017 7:29 pm
The Maple bootloader in my repo ( the one we all use), altready has a feature to hold if you put a magic number in backup register DR10.
I posted about this many times before.
Yes bkp10, actually the point here was allow user to set bootloader in perpetual mode with a double press on rst push button. That solution avoid the need for user push button, it is also mandatory for Arduino since users tend to upload non working code which breaks the virtual serial port and thus prevent upload of new firmware due to the "reset over virtual serial port" design. I used BKP9 and it cannot be set by user directly (part of double press detection mecanism).

Post Reply