ESPUSB - Chat about the software components

User avatar
By cnlohr
#54423 So, over the last several weeks, we've been able to mature the USB to be relatively stable. I really want to writ the bootloader, but the more I read about them, the more scared I get.

I don't even know how to compile for a bare bones system, i.e. I would like the bootloader to fit in 4k. How relocatable are user's code? Can we do something that will work with all the environments (arduino included)?

Does the bootloader have to do all the crazy setting up FLASHCHIP, etc?

Can the program reside, starting at 4k then the bootloader somehow maps it into IRAM? If so, that's even more confusing since the bootloader would be running FROM IRAM!

So many questions, such little understanding.
User avatar
By dnc40085
#54704 I don't know if you've seen these yet, but here are some links that you might find useful:
from here:
From Richard Burton's blog:

Here's the link to his open source bootloader repo on github.
User avatar
By cnlohr
#56203 Thanks, I should have checked this first. I have come across these more recently. I'm still running into an unusual problem getting 80 MHz main clock instead of 52 MHz -- plus the way all the flash is organized is really confusing to me, but there is a thread open on github about it and I think IGRR is gonna help out there.
User avatar
By cnlohr
#56221 I have 1/2 of the problem solved. I just don't know how to do any of the bootloader side of things.

Ok, it's a little bigger than I was initially hoping, at 2.5kB, but, it seems to work pretty solid. It's much better than when you have the wifis and everything else going.

https://github.com/cnlohr/espusb/tree/master/bootloader

Right now, it just accepts control messages of length of ~2090 bytes (2048 plus a little bit) back and forth. Check out the "main" function for more info about how it works. You also get to keep the bRequest, wIndex, and other details so you don't need to weigh down the code with a protocol ontop of the control requests. I've tried sending/receiving as quickly as I could and I seem to get around 30kB/sec down at the same time as 30kB/sec up, or 60kB/sec in one direction.

Detection that there is a computer seems to happen in .1 to .3 seconds, so that's good.

I am still trying to figure out a good way to merge the interfaces... Take a look at main and see if you want something a little different?


from: https://github.com/cnlohr/espusb/issues ... -250991632
Bootloader, itself: https://github.com/cnlohr/espusb/tree/master/bootloader