BusPirate / Bus_Pirate

Community driven firmware and hardware for Bus Pirate version 3 and 4
632 stars 131 forks source link

Unify pirate-loader code to handle both v3 and v4 #68

Open agatti opened 7 years ago

agatti commented 7 years ago

Right now there are two separate pirate-loader codebases, one for each model. Ideally there should be only one tool to be used for uploading both firmware types.

kallisti5 commented 7 years ago

I assume this is about:

A quick diff shows that the BPv4 pirate-loader only seems to be a slightly newer version of the BPv3 pirate-loader.

diff -Naur BPv4-bootloader/pirate-loader/pirate-loader.c BPv3-bootloader/pirate-loader/pirate-loader.c

Are we sure the pirate-loader in Bootloaders/BPv4-bootloader/pirate-loader doesn't work with the BPv3? The only requirement seems to be "v4+ bootloader".

It appears there are special steps + code to upgrade the v2 bootloader to v4.

From what i've gathered...

agatti commented 7 years ago

Technically there's v4.5 as well for v3 and v1.1 for v4, which include the jump to bootloader fix. However, I have no idea on whether BPv4's pirate-loader works on v3 and whether that can flash bootloaders too. If that's the case, then we should move pirate-loader from Bootloaders/BPv4-bootloader/pirate-loader to tools/ and remove other copies.

kallisti5 commented 7 years ago

Correct. Tomorrow I will:

Any additional steps? Since both came with the latest bootloader (from what I can tell) it seems like all I need to do is drop the firmware version to pre-v6.2

It sounds like we'll need a documented workaround of people needing a PicKit if anyone updated beyond the Dangerous Prototypes v6.1 release on the BPv3 or BPv4?

agatti commented 7 years ago

For v4 there should be no real workaround needed I think, but for v3 things can get hairy pretty quickly and bricking the device is a real possibility, so yes, some documentation is needed.

As far as additional steps go, short of trying to upgrade v3's bootloader to v4.5 from all released bootloader versions maybe there isn't anything left to do - but this is something that can be done later.

kallisti5 commented 7 years ago

Technically there's v4.5 as well for v3 and v1.1 for v4, which include the jump to bootloader fix.

I updated the list of bootloaders above. Do we want to bump the bootloader versions? I didn't see it done in e2bd0a093f3030c7818a9e38a804596fe50343bf or 2bfccf2c027c1bf3ffc28082cb0c6b809b43901c

I assume the BL version is the VER_H and VER_L in bootloader.c for BPv4? (4 + a, 4.10 , 4.1 ) EDIT: yech. So the BPv4 "1.0 bootloader" is really internally 4.10? Really DangerousPrototypes? EDIT2: BPv3's v4.5 bootloader is at least 4.5 via BLVERSION in the assembly.

agatti commented 7 years ago

Ouch, sorry for not bumping the v4 bootloader version - please bump it up then.

On the other hand, the v3 bootloader directory needs a good scrub for sure!

kallisti5 commented 7 years ago

ok. working on a cleanup commit now.

kallisti5 commented 7 years ago

https://github.com/BusPirate/Bus_Pirate/pull/69

tldr:

agatti commented 7 years ago

Awesome, let's merge the whole lot once the firmware/bootloaders update tests prove successful then.

kallisti5 commented 7 years ago

Sounds good. I'll append the version bumps in that PR as well.

USBEprom commented 7 years ago

@kallisti5

For what I know and experimented pirate-loader does work with Bus Pirate v3 by allowing me to upgrade bootloader from v4.4 to v4.5:

http://dangerousprototypes.com/forum/viewtopic.php?f=28&t=8498&start=75&sid=c72e26d3dde472fbd8ab7226df6d3db8

http://dangerousprototypes.com/forum/viewtopic.php?f=28&t=8498&start=75&sid=c72e26d3dde472fbd8ab7226df6d3db8#p67127

Just out of curiosity.

kallisti5 wrote:

bootloader v4.5 (Bootloaders/BPv3-bootloader/firmware-v4.5) (SparkFun release version)

About bootloader 4.5, what is SparkFun release version? Truthfully speaking I have never heard of it and I would love to know more. Is there somewhere its code? Thanks.

agatti commented 6 years ago

Moving to 7.2...