Author Topic: bootloader discussion  (Read 12545 times)

CBcracker

  • Jr. Member
  • **
  • Posts: 80
bootloader discussion
« on: August 22, 2013, 12:00:06 pm »
I'm starting this thread to consolidate part of the discussions in other threads related to the digiSpark bootloader.

The current bootloader has a 5s delay before launching a user sketch.  I think it is better (and it takes less code) to have the bootloader controlled by a jumper.  Erik made a good point that it could lead to support issues - users not being able to download their sketch because the jumper is not on.  A possible mitigation to that could be having the digispark manufactured with the jumper on, or if that impacts manufacturing costs have the bootloader code only launch the application when the jumper is on.  At the end of the download the digispark IDE could display a message to remove the digispark and enable the "application" jumper.

Personally I thought my first digispark was a dud because of the 5s bootloader timeout.  I have two, and when the second one didn't show up when I ran lsusb, I then remembered the 5s timeout (fortunately I was recently reading the bootloader code).  I still find it a pain having to run the downloader within 5 seconds of plugging it in, so I plan to flash a version of micronucleus with the jumper enabled once I build a HVSP programmer (a good excuse to test out gogol's HVSP).

Who prefers the current timeout, and who would prefer the bootloader disabled/enabled via jumper?


Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Re: bootloader discussion
« Reply #1 on: August 22, 2013, 06:29:17 pm »
1) You don't need to run the micronucleus upload within 5 seconds of plugging it in. You run the upload and then plug it in. Micronucleus was never designed to reliably upload to devices which have already been plugged in when the upload tool starts running. The micronucleus upload program waits for the digispark device to appear on the USB bus, polling roughly four times per second until it sees it, and immediately grabs it and starts the upload process. Just press upload in the IDE or run the micronucleus command line tool, then at your leisure plug in a digispark to program. There's no rush, no dramas.
2) Digispark's are designed to be cheap. If you want a jumper it is trivial for you to add one, but I don't think more expense should be added to the hardware design.
3) You don't need a HVSP programmer to change the bootloader on your digispark to the jumper version. Just use the micronucleus command line tool to upload this hex file: https://github.com/Bluebie/micronucleus-t85/blob/master/upgrade/releases/micronucleus-1.06-jumper-v2-upgrade.hex - it will give you a bit more space for your programs and fix an issue with clock speed inconsistencies which affect's the bootloader installed by default on Digispark's. You can change back at any time by uploading the non -jumper version of that file from the same folder in the micronucleus repository.
4) Who cares what the default is? It takes literally 30 seconds to change the bootloader for the jumper version if that's what you want.

CBcracker

  • Jr. Member
  • **
  • Posts: 80
Re: bootloader discussion
« Reply #2 on: August 22, 2013, 08:11:00 pm »
3) You don't need a HVSP programmer to change the bootloader on your digispark to the jumper version. Just use the micronucleus command line tool to upload this hex file: https://github.com/Bluebie/micronucleus-t85/blob/master/upgrade/releases/micronucleus-1.06-jumper-v2-upgrade.hex - it will give you a bit more space for your programs and fix an issue with clock speed inconsistencies which affect's the bootloader installed by default on Digispark's. You can change back at any time by uploading the non -jumper version of that file from the same folder in the micronucleus repository.
That's great, I'll give it a try.  I didn't know about the upgrade program.  I think it's time to change the Readme.txt:
"While nobody has yet written an upgrade program, it is theoretically possible to upgrade the bootloader in place by uploading a special upgrade program to it which overwrite the bootloader with a newer version when run."

Mark

  • Full Member
  • ***
  • Posts: 196
Re: bootloader discussion
« Reply #3 on: August 23, 2013, 04:13:38 am »
http://digistump.com/board/index.php/topic,320.0.html

Its the 5th under support and the 2nd on a search query "bootloader"

Mark

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Re: bootloader discussion
« Reply #4 on: August 23, 2013, 06:39:12 am »
I fixed the readme. ^_^

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: bootloader discussion
« Reply #5 on: August 24, 2013, 12:10:16 am »
I found a button that *might* be small enough and *might* be cheap enough and *might* be placeable by a pick and place - Probably not!
But if it were possible would people prefer a PRO model with
1) 13 pins and a button to enter the programmer
2) 13 pins and a reset button
3) 14 pins and neither with the footprint to add a button of their own if they want to switch to a button to enter programming version?

defragster

  • Sr. Member
  • ****
  • Posts: 467
Re: bootloader discussion
« Reply #6 on: August 24, 2013, 02:25:37 am »
 #3 seems right and cheaper.
#2 was noted as just a power cycle and when installed reset may be inaccessible or accidentally hit.
 #1 could be wired during development then allow at least partial pin 14 usage

CBcracker

  • Jr. Member
  • **
  • Posts: 80
Re: bootloader discussion
« Reply #7 on: August 24, 2013, 07:28:30 am »
3) You don't need a HVSP programmer to change the bootloader on your digispark to the jumper version. Just use the micronucleus command line tool to upload this hex file: https://github.com/Bluebie/micronucleus-t85/blob/master/upgrade/releases/micronucleus-1.06-jumper-v2-upgrade.hex - it will give you a bit more space for your programs and fix an issue with clock speed inconsistencies which affect's the bootloader installed by default on Digispark's. You can change back at any time by uploading the non -jumper version of that file from the same folder in the micronucleus repository.
That's great, I'll give it a try.  I didn't know about the upgrade program.  I think it's time to change the Readme.txt:
"While nobody has yet written an upgrade program, it is theoretically possible to upgrade the bootloader in place by uploading a special upgrade program to it which overwrite the bootloader with a newer version when run."
It worked great - I connected a tiny (0.4W) speaker and got a short beep when it was done.

CBcracker

  • Jr. Member
  • **
  • Posts: 80
Re: bootloader discussion
« Reply #8 on: August 24, 2013, 07:46:02 am »
I found a button that *might* be small enough and *might* be cheap enough and *might* be placeable by a pick and place - Probably not!
But if it were possible would people prefer a PRO model with
1) 13 pins and a button to enter the programmer
2) 13 pins and a reset button
3) 14 pins and neither with the footprint to add a button of their own if they want to switch to a button to enter programming version?

Did you mean to say a jumper for option 1?

I've realized that leaving a digispark plugged into a windows pc is not a likely use case since after micronucleus has timed out and started the application it stops responding to USB packets.  Then windows starts complaining about usb device not responding, so you have to unplug the digispark to get windows to shut up.

If the plus does the D- pullup in software, then this would not be an issue; when the application is running D- goes low and the PC thinks nothing is plugged into the port.  When you want to reprogram the plus, then you could just press the reset, the bootloader runs and pulls D- high and reappears to the PC.

I would second option 3, but it's not really possible.  The option is really 13 pins with pads for a reset button you can add, since once you've programmed the reset fuse you can't undo it in software; i.e. no bootloader upgrade to support a reset button.

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Re: bootloader discussion
« Reply #9 on: August 24, 2013, 07:49:16 am »
I vote whatever makes the PCB smallest. Smallness is my number 1 concern!

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: bootloader discussion
« Reply #10 on: August 24, 2013, 10:51:59 am »
Did you mean to say a jumper for option 1?
Nope I mean a button - hold the button while you plug it in/reset it with a jumper version of the bootloader.

I've realized that leaving a digispark plugged into a windows pc is not a likely use case since after micronucleus has timed out and started the application it stops responding to USB packets.  Then windows starts complaining about usb device not responding, so you have to unplug the digispark to get windows to shut up.
I do this constantly, with several - other than the initial device not recognized it works fine - if you do anything with pin 3 or 4 then it might keep bugging you.

If the plus does the D- pullup in software, then this would not be an issue; when the application is running D- goes low and the PC thinks nothing is plugged into the port.  When you want to reprogram the plus, then you could just press the reset, the bootloader runs and pulls D- high and reappears to the PC.
That will be awesome - though I imagine windows wills till bug you if you use pin 3 or 4 (or perhaps just p4), no way around that - I still haven't had a chance to test that, been busy arguing with factories

I would second option 3, but it's not really possible.  The option is really 13 pins with pads for a reset button you can add, since once you've programmed the reset fuse you can't undo it in software; i.e. no bootloader upgrade to support a reset button.
Not a reset button, a program button - hold down while plugging in (or toggling with the programmer tool)
« Last Edit: August 24, 2013, 08:46:04 pm by digistump »

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: bootloader discussion
« Reply #11 on: August 24, 2013, 08:53:10 pm »
NOTE: Several posts that led up to an extremely inappropriate post have been removed.


This is an all ages/all sexes/all skill levels/everyone is welcome forum - comments and posts that are in any way discriminatory, vulgar, or otherwise in appropriate will be removed, anyone who continues to make such posts and comments will be banned. This is an open forum in the sense that you can criticize our products, designs, etc and provide constructive feedback to anyone whether they like it or not - as long as that feedback is not personal relates to the topics at hand. Personal attacks, name calling, etc will never be tolerated.


Any subsequent posts on this thread should be on topic or they will be removed.


We have a really awesome community around here, with lots of smart folks, helpful folks, and lots of disagreements about features, technical things, etc but very little conflict - I think that makes this a wonderful place - please, lets not ruin it.


Thanks,
Erik

CBcracker

  • Jr. Member
  • **
  • Posts: 80
Re: bootloader discussion
« Reply #12 on: August 25, 2013, 06:56:19 am »
This is an all ages/all sexes/all skill levels/everyone is welcome forum - comments and posts that are in any way discriminatory, vulgar, or otherwise in appropriate will be removed, anyone who continues to make such posts and comments will be banned.

Well you should save yourself the trouble and ban me now.  I've had problems with oversensitive prudes before, so I emailed you about my concern that some emotional people might CHOOSE to take offense to my posts.  You responded, "I wouldn't be afraid to step on any toes there".

"appropriate" is a subjectived (i.e. unscientific) and arbitrary standard.  If I say "those connectors are shit", some people might take offense.  But it means *exactly* the same thing as saying "those connectors are crap".  In a land of supposed free speech, banning specific words is just stupid.  If you're going to ban words, why not ban "Voldemort"?  The hypocrisy of a nation that allows churches to publish "God hates fags" under the guise of free speech while banning the occasional use of the f-bomb is a scathing indictment of America.

BTW, up here in Canada our equivalent to the FCC (the CRTC) doesn't consider "shit" a bad word.  I even heard former CRTC commissioner Barbara Cram use it in a public hearing.  Telus had made a rather obvious statement, and commissioner Cram responded, "No shit, Sherlock."

p.s. Canada also has hate speech laws; we ban speech that is actually damaging (like that "God hates fags" crap), while allowing words like "shit" and "bitch" to be used.  A current example of that is the "Britney bitch" line in "Scream & shout" which you could hear during daytime hours on Canadian radio but not on US radio.

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Re: bootloader discussion
« Reply #13 on: August 25, 2013, 08:16:48 am »
Lets make one thing clear: You made me the sexual object of a sexist joke when I disagreed with you about the future direction of a piece of software I wrote and remain the primary maintainer of, and when I called you on it, you called me a bitch and used dominating masculine language to assert power you do not have and certainly are not entitled to. You are the very worst kind of person, CBcracker.


I can promise you one thing: I will never knowingly taint the micronucleus code tree with any of your work, and if you fork, I will never acknowledge your work except to shine light on your behaviour. You cannot hide being a terrible sexist patriarchal douchenozzle behind weak appeals to cultural sensitivity. It didn't work for Linus Torvolds and it certainly isn't going to work for you, Ralph. Your discussion of swear words is pure strawman.


Digistump's website is a safe space for women and minorities. I intend to make sure of it.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: bootloader discussion
« Reply #14 on: August 25, 2013, 10:32:41 am »


"I wouldn't be afraid to step on any toes there".


CBcracker sent an email asking if he should be worried about offending anyone by debating the bootloader - I responded that people here "enjoy a good debate on what works, doesn't work, etc so I wouldn't be afraid to step on any toes there"


I certainly hope it is obvious that turning that into "it is OK to call people names and be disrespectful" is a bit far fetched.


CBcracker has been banned, not for the words he used (we aren't going to be the language police around here) but for the lack of respect he showed and the hateful personal attacks that he made.


To reiterate our policy:


This is an open forum in the sense that you can criticize our products, designs, etc and provide constructive feedback to anyone whether they like it or not - as long as that feedback is not personal relates to the topics at hand. Personal attacks, name calling, etc will never be tolerated.


Bluebie gets it right:


Digistump's website is a safe space for women and minorities. I intend to make sure of it.


Digistump and myself intend to make sure of that as well.


I've locked this thread to leave it up for record and because it seems to be dead as far as real topical discussion is concerned - feel free to start a new thread if you'd like to continue the bootloader discussion.
« Last Edit: August 25, 2013, 10:34:43 am by digistump »