Digistump Forums

The Digispark => Digispark (Original) Support => Topic started by: Bluebie on May 19, 2013, 06:39:35 pm

Title: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: Bluebie on May 19, 2013, 06:39:35 pm
Emergency update for micronucleus 1.05 or 1.06 of -jumper version (normal timeout version is fine).


The bootloader mistakenly would set P5 to be an output pin instead of an input pin when deciding if it should enter bootloader mode or not. It then leaves it as an output pulled high until the bootloader exits! This creates a short circuit of about 80ma through the chip and your jumper wire or button, potentially damaging the AVR chip or it's power supply circuitry!


If anyone has had digisparks stop working while using these jumper firmwares, it is probably my fault. I suck. Sorry about that. All fixed now though!


The fix is in this file: https://github.com/Bluebie/micronucleus-t85/blob/master/upgrade/releases/micronucleus-1.06-jumper-v2-upgrade.hex


 :-[
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: DeuxVis on May 24, 2013, 05:48:18 am
Thanks for the notice, but I was dumber than you and fried the digispark which I had updated to that firmware version by giving main power to one of its pin - I had no idea my door bell button was delivering 220 AC when pushed, thought it was just a switch.

I'll make sure to get the last version when I get back on that project then.
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: dougal on May 24, 2013, 06:00:30 am
Thanks for the notice, but I was dumber than you and fried the digispark which I had updated to that firmware version by giving main power to one of its pin - I had no idea my door bell button was delivering 220 AC when pushed, thought it was just a switch.

I'll make sure to get the last version when I get back on that project then.


Heh. It's a good thing it didn't fry you while you were messing with it.  ;)
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: DeuxVis on May 24, 2013, 07:34:27 am
Well it was not possible for me to push the button and fiddle with the live end at the same time - too far away. But yeah got lucky no visitors came ringing while I was setting it up.


Back on the topic, sorry for the digression Bluebie : you should link your github to a flattr.com account, I think you deserve some materialisation of our gratitude.
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: Bluebie on May 25, 2013, 06:08:03 pm
I added that flattr thing. Curious.
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: peter on May 28, 2013, 12:59:56 pm
Hi bluebie, please can you describe how to compile firmware and command line tool under windows enviroment? I want try modify start bootloader only on external reset. Of course after reset fuse restore :)
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: Mark on May 28, 2013, 11:43:25 pm
Peter
I put together this
http://digistump.com/board/index.php/topic,320.msg1778.html#msg1778

Maybe that answers your query.


mark
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: DeuxVis on May 30, 2013, 07:29:26 am
Hi bluebie, please can you describe how to compile firmware and command line tool under windows enviroment? I want try modify start bootloader only on external reset. Of course after reset fuse restore :)

Not tested myself but looks like you need avr-dude, avr-gcc and make (gnu version ?) command line tools in your path. Then I'd try to run the usual "make" command.


After a quick glance of the makefile, I'd say the build system hasn't been designed to run under windows, you'd have at least to modify the makefiles or use cygwin or something similar to provide the missing command line tools.
You'd probably get your startup easier on that project by using some unix environment, maybe a linux live CD if you don't want to install it.
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: Bluebie on May 30, 2013, 08:47:09 am
I don't use windows. Maybe you can use one of those unix emulation layer things (cygwin? mingw?)
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: digistump on May 30, 2013, 03:57:25 pm
They all build in windows for me - using mingw
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: peter on May 31, 2013, 01:28:54 am
yes, I have mingw but still I get missing files error. I dont know what else needed to compilation :-(
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: digistump on May 31, 2013, 01:43:11 am
The mingw errors should be pointing you in the right direction - you are probably missing libusb - but perhaps easier:


Mingw would be for the command line tool - which you can also get for windows by downloading our IDE version and looking in the Arduino/Hardware/Tools/avr/bin folder and grabbing micronucleus.exe


For the firmware you need avrgcc to compile it or winavr which includes that.
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: DeuxVis on October 15, 2013, 04:11:34 am
Maybe that topic should be pinned, as it points to the latest version of the jumper firmware ?

Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: gogol on October 15, 2013, 11:55:13 pm
Maybe that topic should be pinned, as it points to the latest version of the jumper firmware ?

I think it would better to link the most recent (and some of the previos) versions in the wiki!  The wiki is from my point of view the much better place for information like this.

Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: digistump on October 16, 2013, 01:40:12 am
I agree with gogol - I updated the tips and tricks page
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: DeuxVis on October 17, 2013, 01:36:17 am
Fine, and here's the link to that wiki section : http://digistump.com/wiki/digispark/tricks?s%5B%5D=micronucleus#get_rid_of_5_second_startup_delay
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: zapta on October 30, 2013, 01:11:07 am
Let's said that I programed a DS with my program using the stock bootloader (the one with 5 secs delay) and then I program the board with this  'jumper' bootloader, do I need to reprogram the board with my program? 

Thanks,

Z.
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: DeuxVis on October 30, 2013, 09:24:09 am
From memory, I think yes you need to upload your program again.

But don't take my word on this, try it, reuploading a sketch is just some seconds away anyway (unless you lost your sources).
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: Bluebie on October 30, 2013, 03:41:12 pm
Yes you absolutely will need to upload your program again, and there is no way to recover the code for a program you've already uploaded. Well.. maybe a high voltage serial programmer could do it? Depends how @digistump set the fuses in the spark.
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: zapta on October 31, 2013, 01:13:23 pm
Thanks Bluebie.

In a related question, let's say that I have the .hex file of the jumper bootloader and .hex file of my application.  Is there a way to combine then such that people can:

1. Program both of them into a stock Digispark.

2. Not having to deal with the jumper (I care only about the first time they programming it).

(Motivation, I have an Digispark application that requires no 5 seconds delay. I want to make it easy for laymem to program it (once) on boards they order from Digistump.)
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: Bluebie on October 31, 2013, 02:31:45 pm
Nope. The upgrade hex file uses the same space as your program. It is an installer program. You have to do them in sequence. If you want to do that, currently the only way is to use a high voltage serial programmer. Then you can upload both together, which is infact how digistump load on the bootloader and the blink program when they make them I think!
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: zapta on October 31, 2013, 03:09:04 pm
Thanks Bluebie.

When the loader runs, does it have access to the program's EEPROM space and/or flash? If so, how about have a having a flag in the flash/EEPROM that will tell the boot loader if to use delay or jumper?  This will give us, app programmers, more control with the stock bootloader.

Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: Bluebie on November 01, 2013, 03:28:51 pm
That feature would make the bootloader bigger. I don't see why it's worth it when you can swap out the bootloader so easily.
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: zapta on November 01, 2013, 04:51:48 pm
That feature would make the bootloader bigger. I don't see why it's worth it when you can swap out the bootloader so easily.

Yes, swapping the bootloader is easy but than you need to deal with soldering a temporary jumper before you program the application.
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: Bluebie on November 02, 2013, 03:50:37 pm
soldering? why would you solder it? just get a piece of wire and press it in while you plug the usb connector in. In some of my projects instead I also have a button connected from d5 to gnd, which I use in my programs as input to control something, but can also be held down when plugging it in to enter the bootloader. You don't need to keep it connected for the whole upload either, just for the first 20 milliseconds or so, I think!
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: zapta on November 03, 2013, 06:45:31 am
Thanks Bluebie. 

I am trying to understand the program memory model of the tiny85. Both the bootloader and my program's hex file start at 0000. If they are in the same memory space how do they coexist?
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: Bluebie on November 03, 2013, 04:28:32 pm
It depends which bootloader hex file you use. The regular firmware/releases stuff in the github repository are the already installed images, and they don't start at 0000 - they start somewhere around 6kb in. I believe the hex files sometimes do contain 0000 or ffff padding words up until that point though.

If you're looking at the 'upgrade' stuff, it is an installer. So the regular firmware/releases stuff is read in, the padding bytes at the start are stripped off, and the bootloader program data are stored in to a byte array inside an installer program, which begins at the beginning of memory like any normal program. When the installer runs it first erases it's own interrupt vector table (the first page) making it in to a NOP sled, so if the device restarts it skips the existing bootloader and reruns the installed. Next it writes over the end of the chips program memory with the new bootloader code, then once it's installed it replaces that first page with a trampoline which bounces (jumps) to the start of the bootloader. This renders the installer dead. It then emits a beep if you have a speaker attached or if an LED is attached you see it light up for a moment, then it jumps to 0000 which trampolines in to the bootloader and connects over USB to your computer.

The reason we have the 'upgrade' installer is that you can upload it via another bootloader or via micronucleus itself, so you can use it to upgrade chips without needing to have a programmer of any sort. In the case of the digispark you would need a high voltage serial programmer which tends to cost about $50 if not for the installer program. If you're wondering, I had the idea after crashing a university course on computer security and seeing how worms deliver payloads and unpack over different parts of memory, patching things in to place and rewiring jumps. This is why I sometimes call it the 'viral installer'. In the future I'd like to add checksums and a verification step, but I still consider it very safe in it's current form.
Title: Re: Because I am stoopid, if you used a -jumper version of micronucleus, update now!
Post by: pckcomeback on May 16, 2019, 10:29:15 pm
Ok bro
ufabet (http://www.ufabet99.vip)