Why is the stlink_upload script so convoluted?

User avatar
Rick Kimball
Posts: 754
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Why is the stlink_upload script so convoluted?

Postby Rick Kimball » Fri Jul 15, 2016 7:04 pm

This script seems to be way more complicated than it needs to be:
https://github.com/rogerclarkmelbourne/ ... ink_upload

I replaced it with this code and it works just fine.

Code: Select all

#!/bin/bash
$(dirname $0)/stlink/st-flash write "$4" 0x8000000
exit 0

Is there some reason for all the arm waving and jumping up and down? The reason I even looked at this script is because when I used to upload with the original script, the user interface gets stuck in a non responsive state for like 30-40 seconds. I just have to sit there waiting for it to do something. Often I end up manually pressing the reset button to get it to reset. If I just use my replacement script, it loads bingo bango and resets itself and life goes on in a few seconds.

Why the drama?

-rick

BTW: None of my boards have a bootloader and I mostly use a usb dongle instead of the SERIAL_USB.
-rick

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

Re: Why is the stlink_upload script so convoluted?

Postby RogerClark » Fri Jul 15, 2016 9:55 pm

Rick

I cant remember why its so complicated. I looked at the history and you commented in May 2015 after a change that someone sent me which added all the complication

https://github.com/rogerclarkmelbourne/ ... 2c44c66cbd

My original script just did the upload and didnt mess with USB

As the change wasnt via PR, I will need to try to track down who sent me the changes and why they thought they were necessary

I think this may be another case where I ended up with code in the repo that only suits one person.
Hence my current retiscence to make any changes unless they are a bug fix, e.g. recent PR by @bigjonson which reduced serial upload speed just because it didnt happen to work for him due to a out of date driver file.


In this case, I agree, the change was probably unncessary and we should probably go back to my one liner

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

Re: Why is the stlink_upload script so convoluted?

Postby RogerClark » Fri Jul 15, 2016 10:35 pm

Rick

Ive tried searching the site using google, but I cant figure out who sent me the script.

I will try checking my emails, but I normally dont keep them that long.

Do you use USB serial with your STLink?

It looks like the script has been made so complicated in an attempt to reset the board and get the USB working again, especially on Maple hardware.

Or an attempt to not exit until the Serial USB device had re-enumerated.

The script has really long time delays in it, which in hindsight is not a good idea

Can I just copy your code into the top, so it just uploads and then exists, and put a comment below saying to remove the exit if you want to wait for the serial device to be active again?

User avatar
Rick Kimball
Posts: 754
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Why is the stlink_upload script so convoluted?

Postby Rick Kimball » Fri Jul 15, 2016 10:48 pm

that would be great!
-rick

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

Re: Why is the stlink_upload script so convoluted?

Postby RogerClark » Fri Jul 15, 2016 11:15 pm

Done

PS.

I just (hopefully) merged that change in the master branch into the development branch, but the development branch seemed somewhat behind the master, as I appear to have failed to update it recently as I've been putting some quick fixes directly into the master branch

(Yes. I know I need to switch to using releases)

User avatar
Rick Kimball
Posts: 754
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Why is the stlink_upload script so convoluted?

Postby Rick Kimball » Fri Jul 15, 2016 11:34 pm

Thanks! I just tried the updated version, it works great.
-rick


Return to “STLink”

Who is online

Users browsing this forum: No registered users and 1 guest