Replace Devo7E bootloader?

More
06 Oct 2015 03:12 #38462 by mwm
Replace Devo7E bootloader? was created by mwm
In my investigations, I discovered that PB had already looked into this, and apparently decided not to do it. But that may have been before the port to the 7E, and certainly before the current space issues on it started.

I suspect we could recover 4-6K of space on the 7E by replacing the Walkera bootloader with our own. I think that's worth putting in the effort to create the bootloader (well, modify one I'm already working on for another project, anyway), but not if nobody is willing to make this mod.

So, how many of you are willing to flash a new bootloader on a 7E if it meant we would have breathing room for extra features again? Instructions can be found at www.deviationtx.com/forum/6-general-disc...-7e-bootloader#34250 .

More interesting, how many are willing to test such code for me, considering I don't have a 7E or interest in getting one? Before answering, you might verify that you can flash walkera's bootloader, which is available via the links section.

The other change that I''d probably do here is to remove Walkera's "encryption" code, so we could use standard dfu tools instead of having to use theirs. Given the lack of support from them, this is a must and PB is already moving in that direction but with their bootloader.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
06 Oct 2015 13:51 #38469 by blackmoon
Replied by blackmoon on topic Replace Devo7E bootloader?
I think it's the way to go ( particularly getting rid of the walkera encryption for all the devos), this or the mcu change like PB did with his Devo7e 256k 'Ulitimate' . Nevertheless, I foresee the same issue in the future, while 4-6K is a big step it can't be compared to the gain of changing the mcu, I'm no programmer so I can't speculate on when the 7E will it the wall again.

I have a spare 7E that I could use, only if there is enough interest, and I can revert to the WK bootloader if this endeavor is not pursued.

Please Log in or Create an account to join the conversation.

More
06 Oct 2015 18:09 #38474 by Fernandez
Replied by Fernandez on topic Replace Devo7E bootloader?
I willing to flash it but:

Assuming that we always can flash it back.
Also need to get clear instructions, how to do it.
Let me know what flash tool to order, this one andi'll get one on my nextorder;
www.banggood.com/ST-LINK-V2-Emulator-Dow...-STM32-p-973898.html

If deviation will support it with firmware, I would alos like to gofor the super duper version, with two more analog pots, ch9 en ch10 as per PB instructions and also change the cpu
as done here:
STM32F103RET6 512kB Flash, 64kB RAM 64pin package
SST25VF032B 4MB SPI NOR Flash
www.deviationtx.com/forum/6-general-disc...de-the-devo-7e#38278

If I upgrade as such can still run the old builds for 7e, or need to compile special builds for change of cpu and memory?

Please Log in or Create an account to join the conversation.

More
06 Oct 2015 18:42 - 06 Oct 2015 18:43 #38475 by FDR
Replied by FDR on topic Replace Devo7E bootloader?
Actually I don't think that replacing the bootloader is the way to go in general.
If we replace the bootloader, we loose the possibility to reflash the stock firmware!
While I don't think I will ever use the original fw again, many people, especially those who are new to deviation or only want to try it, appreciate that they can easily revert to the Walkera fw.

I see that a few kilobytes would help at the moment, but not for long. The 7E will face that limit again sooner then later.
I wouldn't like if the future of deviation would determined by the weakest hardware...
Last edit: 06 Oct 2015 18:43 by FDR.

Please Log in or Create an account to join the conversation.

More
06 Oct 2015 21:30 #38486 by SadSack
Replied by SadSack on topic Replace Devo7E bootloader?
I say drop boot loader completely it's not needed there's all ready high speed serial hardwired 300k+ Pain to use as is but add 10k res, push button. Entering bootloader is just hold button turn on tx or just use ST link both cost about same. Then just right click bin/hex 'send to'. Both ST's software can be run from command line so all very simple setup under Windows.
So usb DFU loader gone but can be replaced anytime.
Don't sound like a good idea...what about newbie well just keep an entry level option which uses DFU and once there happy with change move to full option.
BTW when was last update for devo7e, when's next one due!

Replace mcu......Yes I'm in! I've used few very cheap ways that worked for me and now have better tools to get job done great. And willing help/support (online only) people make the change but 64 pin fine pitch mcu. Ending up with dead tx is an issue and not easy work around via text messages.

Need better options :
Get Deviationtx module live! That would free up a mass of space and all hardware across all tx would use same code.
Issue with that it's all on PB's shoulders, pocket! I failed trying to help. If we could help fund it....

What if serial interface(all Devo's)could be added to stock tx then just add better mcu which drives tx as a slave. Then any amount of pots,buttons or what ever could be added. Could be done very cheaply. BUT pretty sure that would be massive change to code base.

Please Log in or Create an account to join the conversation.

More
06 Oct 2015 23:50 - 07 Oct 2015 00:09 #38489 by blackmoon
Replied by blackmoon on topic Replace Devo7E bootloader?
I agree with FDR, sooner or later, you won't be able to add more stuff to the 7E, maybe just freeze the code for it and fix bugs. It's already a great achievement compared to the stock firmware. If people want something more they should be encouraged to upgrade to the 10 or whatever they see fit.

When the cup is full, putting in the last drop of juice won't make a difference, and I do honestly thing the 7E as reached is peek. This said if PB pursue is Ultimate 7E goal, I'll be replacing the mcu in my spare one.
Last edit: 07 Oct 2015 00:09 by blackmoon.

Please Log in or Create an account to join the conversation.

More
07 Oct 2015 02:02 #38499 by mwm
Replied by mwm on topic Replace Devo7E bootloader?
OK, there's interest.

For those thinking this is pointless - the 7E is by far the most popular platform that deviation runs on. As far as PB is concerned, any change that won't run on the 7E and makes things incompatible with it if installed on the other Tx's won't happen. I've thought about forking deviationTx to drop 7E support, but can't quite convince myself it would succeed.

More information on bootloader replacement:
  1. Link to the update instructions were in the original post, but repeated here: www.deviationtx.com/forum/6-general-disc...-7e-bootloader#34250
  2. The hardware required for that process is an ST-LINK V2, but see below.
  3. You can use the same process to go back to the factory bootloader available via the Links page.
  4. You can go back to the factory firmware by first going back to the factory bootloader.

This would be another build target, with more room and capabilities. The original 7E build would still be available for those who couldn't upgrade, at least initially. Hopefully removing things from only the lesser of the two would meet with less resistance than it does now.

Personally, I'd like this on my 6 and 10 so I could flash new software from my desktop, where standard st & dfu utilities work, but the walkera specific ones don't.

If PB is right in speculating about which USART the trainer is tied to, it may be possible to upgrade the boot loader with a serial connection to the trainer port. In that case, ditching the boot loader entirely is not only possible, but easier than any other hardware mod, as you just need to wire the Ext button to short the boot0 jumper as well as what it does now. The only problem is that there would be no indication that you actually turned the thing on when you did it, which some might find disconcerting.

If you have a 7E and are interested in trying the trainer port hack, here's what to do:
  1. Check to see if the trainer port signals are tied to pins 42 and 43. If not, you can stop now - it won't work.
  2. Install the stm32flash software on your computer.
    1. Windows download
    2. Source for Linux or Unix build .
  3. Short the BOOT0 jumper as described by PB.
  4. Connect a TTL-level serial line to the trainer port. Rx line to pin 42, Tx to 43. A USB<->Serial adapter should work fine.
  5. Connect the other end of the serial line to your computer. Windows users may have to install a device driver. Sorry, can't help with that.
  6. Turn on the 7e
  7. Run "stm32flash PORT" for the port the transmitter is on.

This just checks the connection, and won't make any changes to your Tx. If it works, you should get a report about the device. Otherwise, you'll get an initialization error. Here's what a good run looks like on the next CPU down from the one in the 7E:
stm32flash 0.4.1

https://github.com/mwm/stm32flash

Interface serial_posix: 57600 8E1
Version      : 0x22
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0410 (Medium-density)
- RAM        : 20KiB  (512b reserved by bootloader)
- Flash      : 128KiB (sector size: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
07 Oct 2015 04:44 - 07 Oct 2015 04:44 #38501 by RoGuE_StreaK
Replied by RoGuE_StreaK on topic Replace Devo7E bootloader?
Personally I think going in this direction would stop many (most?) potential converts; it's one thing to just plug in a USB cable and run some software, it's another entirely to have to pull apart the TX, solder or pogo some headers, buy a programming dongle, etc. Most casual users will run screaming.

Not saying it's not a possible development branch, but I think the main release needs to be as user-friendly as possible. THEN when they get hooked they might go for the more hardcore dev branches.
Last edit: 07 Oct 2015 04:44 by RoGuE_StreaK.

Please Log in or Create an account to join the conversation.

More
07 Oct 2015 05:25 - 07 Oct 2015 05:26 #38502 by SeByDocKy
Replied by SeByDocKy on topic Replace Devo7E bootloader?
What maybe it would be nice (and maybe it have been already proposed) is to develop a Web interface for a personalized Devo7E NB.
Users could online select or unselect some features until the memory limit is reached then recompiled online.
Last edit: 07 Oct 2015 05:26 by SeByDocKy.

Please Log in or Create an account to join the conversation.

More
07 Oct 2015 05:34 #38503 by blackmoon
Replied by blackmoon on topic Replace Devo7E bootloader?

RoGuE_StreaK wrote: Not saying it's not a possible development branch, but I think the main release needs to be as user-friendly as possible. THEN when they get hooked they might go for the more hardcore dev branches.


If I understood mwm, the standard way and build would be staying at least for some time.

This would be another build target, with more room and capabilities. The original 7E build would still be available for those who couldn't upgrade, at least initially. Hopefully removing things from only the lesser of the two would meet with less resistance than it does now.


I for one can do it, but only end of next week, tied doing some work on the house that I have procrastinated for to long.

@mwm how do you propose if the trainer port is indeed tied to 42,43 to comply with the sorting of power supply as explained by PB :

It turns out I had to do this today, so I can be pretty specific.
1st you need an stlink-v2 and a copy of the devo7e bootloader

You'll be using the 20pin header on the stlink.
on the 7e board, there is a 5-pin unpopulated header below the MCU, one pin is labeled RESET. We;ll call this pin '1'....
.
.
just above the 5-pin header is a 2-pin unpopulated header. this is BOOT0. you need to place a jumper between the 2 pins.
On the upper left of the 7e circuit board is another 2-pin unpopulated header. This is power bypass. You'll need to short these together too, but not yet.....


Or is this only needed if you use the internal 5 pins programing header?

Please Log in or Create an account to join the conversation.

More
07 Oct 2015 06:51 - 07 Oct 2015 06:52 #38505 by mwm
Replied by mwm on topic Replace Devo7E bootloader?

RoGuE_StreaK wrote: Personally I think going in this direction would stop many (most?) potential converts; it's one thing to just plug in a USB cable and run some software, it's another entirely to have to pull apart the TX, solder or pogo some headers, buy a programming dongle, etc. Most casual users will run screaming.


That's pretty much how the whole open source tx movement got started - you had to pull apart a TH9X, solder or pogo in a connector, buy an atmel dongle, etc. I think OpenTx - even if you ignore the Taranis - is still more popular than deviationTx. But it's hard to say for sure.

SeByDocKy wrote: What maybe it would be nice (and maybe it have been already proposed) is to develop a Web interface for a personalized Devo7E NB.
Users could online select or unselect some features until the memory limit is reached then recompiled online.


This is a web version of some of what the OpenTx CompanionTx tool does. A web version would be a nice touch, since then people wouldn't have to install the tool chain. I've thought about re-organizing the sources to support something like that, but without a tool to automate the builds, it doesn't work very well.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.
Last edit: 07 Oct 2015 06:52 by mwm.

Please Log in or Create an account to join the conversation.

More
07 Oct 2015 07:11 #38506 by mwm
Replied by mwm on topic Replace Devo7E bootloader?

blackmoon wrote: If I understood mwm, the standard way and build would be staying at least for some time.


Correct. Right now, the path is try deviationTx on a stock 7e, then start modding it for more features - better range, more models, switches, whatever. Actually, I think most people go right to "more models", but that's just me.

This would - at least initially - be just another possible mod. Change the bootloader firmware, and get more features! If we use our own bootloader, no hardware mods needed, but you have to open it up to flash the new bootloader. If we choose to use the embedded bootloader, who knows?

@mwm how do you propose if the trainer port is indeed tied to 42,43 to comply with the sorting of power supply as explained by PB :

On the upper left of the 7e circuit board is another 2-pin unpopulated header. This is power bypass. You'll need to short these together too, but not yet.....


Or is this only needed if you use the internal 5 pins programing header?


I don't know. I hadn't considered using the embedded bootloader until today, so there's more questions than answers. I don't have a 7e, and I'm not clear what the power bypass does. He's describing reflashing the bootloader on a bricked Tx, so my suspicion is that it's only needed because the CPU wasn't properly turning on power. But I don't know for sure.

I'm still iffy on the idea of using the embedded boot loader, because that won't have any output to the LCD at all. So if it comes on, it'd be in the power up state. But the boot loader uses ~10% of the memory in the 7E so it's a huge win. I haven't gotten serious about writing an STM32F103 boot loader yet, but I suspect it'll weigh in at about half that. I want more information before deciding.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
07 Oct 2015 08:16 #38508 by SadSack
Replied by SadSack on topic Replace Devo7E bootloader?
If you use STlink programmer you can bypass power problem but it's just a one jumper. Using embedded bootloader you need to follow PB's guide.
Look at current libopencm3.org many new examples of bootloaders.
And can't be sure of this but if you look at section of where bootloader is dumped to serial port. You could re write bootloader using software. Only need serial/STlink if you get it wrong.

Please Log in or Create an account to join the conversation.

More
07 Oct 2015 08:24 #38509 by SadSack
Replied by SadSack on topic Replace Devo7E bootloader?
You could use the screen back light to say your in upgrade mode.

Please Log in or Create an account to join the conversation.

More
07 Oct 2015 08:32 #38510 by SadSack
Replied by SadSack on topic Replace Devo7E bootloader?

mwm wrote: I'm still iffy on the idea of using the embedded boot loader, because that won't have any output to the LCD at all. So if it comes on, it'd be in the power up state. But the boot loader uses ~10% of the memory in the 7E so it's a huge win. I haven't gotten serious about writing an STM32F103 boot loader yet, but I suspect it'll weigh in at about half that. I want more information before deciding.


Devo 6s,7e and 10 all use a jumper.

Please Log in or Create an account to join the conversation.

More
07 Oct 2015 11:04 - 07 Oct 2015 11:10 #38515 by blackmoon
Replied by blackmoon on topic Replace Devo7E bootloader?

mwm wrote: I'm still iffy on the idea of using the embedded boot loader, because that won't have any output to the LCD at all. So if it comes on, it'd be in the power up state. But the boot loader uses ~10% of the memory in the 7E so it's a huge win. I haven't gotten serious about writing an STM32F103 boot loader yet, but I suspect it'll weigh in at about half that. I want more information before deciding.


Concerning the output to the LCD, thousands of people (including myself) only have the output from the program they use to flash their ST based multirotor flight controller, be it the STloader, CLeanflight Configurator or OpenPilot GCS, etc... I never looked at my TX display while flashing (does it actually show progress ?).

You cited the ER9x project, flashing doesn't give any lcd indication to, if I remember correctly :unsure:

If not mistaken WK boot loader served two purposes:
1. enable usb flashing
2. protect their IP so an encrypted dfu could be used (now history)

A small boot loader that enables usb programing is all we need, and a unencrypted dfu to be loaded.

One thing tough, is it the WK boot loader or deviation that puts the TX in usb disk mode ?
Last edit: 07 Oct 2015 11:10 by blackmoon.

Please Log in or Create an account to join the conversation.

More
07 Oct 2015 12:09 #38520 by mwm
Replied by mwm on topic Replace Devo7E bootloader?
SadSack, I think you got the power thing backwards. The embedded bootloader is via a USART, and just needs power to the CPU as well. The ST-LINK/SWD seems to be similar: two signal lines (data and clock, I think), power, ground and a reset line that doesn't exist on my dev board (same CPU as the 7e, just less flash). However, the ST-LINK won't connect unless the dev board is also getting power from somewhere else, just like the serial line - the power & ground link don't seem to power it. In fact, trying to connect without power leaves the dev board bricked.

Based on that - and without knowing what the jumper connects, or being able to find any reference to "power bypass" or "power override" in the chip specs - it still feels like this is something that provides power even when the CPU isn't responding to the wake-up signal from the switch to power itself on.

And which jumper are you referring to on the 6S and 10 as well as the 7E? They all use STM32F103 chips, which all have a BOOT0 jumper to switch between booting the embedded bootloader and flash.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
07 Oct 2015 12:29 #38521 by mwm
Replied by mwm on topic Replace Devo7E bootloader?
Ok, now boot sequence options.

The STM32F103 boot sequence is to check BOOT0. That switches between booting to flash or the embedded bootloader. I assume that the walkera bootloader then looks for the Ext button to decide if it's going to boot the Tx firmware that lives above it, or go into DFU mode. The Tx firmware - deviation in our case - then checks the Ent button to decide whether or not to go into USB mode or transmitter mode. On anything but the 7E, you can get to USB mode from the Transmitter menus. That was taken out of the 7E to save a little space.

AFAIK, all the Walkera bootloader does is turn on a USB flash program that incorporates the Walkera encryption/checksum/IP stuff. My guess is that it's a modified version of the ST dfu bootloader, which comes from one of their applications notes. it also puts up a static image on the LCD screen.

I've looked at the libopencm3 dfu example code. That's where I got the 6K figure. Their example dfu bootloader fits in about 6K compared to the 12K for the walkera bootloader. That would be the "small bootloader to enable usb programming". I think it could toggle the backlight the way it currently does a dev board LED in those examples, but was hoping to do some kind of status update. I know I look for them, then curse when I remember it's a static image. It also ought to be possible to have it automatically boot the Tx after you flash the new firmware: the maple mini loader (like my dev board, but with the 7E CPU on it) does that. So does the stm32duino bootloader for those two boards, in even less space

The embedded bootloader can't toggle the backlight on the LCD screen - it doesn't know the screen exists. It doesn't know anything about any hardware not on the ยต-controller chip. I think you're right that we can live without messages if we can get the embedded bootloader in some reasonable manner. Anyone who can deal with flashing a new flash-based bootloader can certainly deal with nothing but messages from their computer. But w still have to figure out if we can make that work.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
07 Oct 2015 13:28 #38524 by SadSack
Replied by SadSack on topic Replace Devo7E bootloader?
There a minor downer using serial bootloader if you don't get right it hangs forever and a day before it times out. That why I added mod to boot 0 boot 1 After that I could hit bootloader everything. Having to move jumper on Dev boards get boring very fast.
Think I've posted details of mod on regroups let me look....

Please Log in or Create an account to join the conversation.

More
07 Oct 2015 14:05 - 07 Oct 2015 14:06 #38527 by blackmoon
Replied by blackmoon on topic Replace Devo7E bootloader?
Using only the embedded boot loader is from the pov of performance the way to go, but not when you put yourself in the shoes of some less tech oriented people, even I don' want to mess with shorting pins and stuff, one time to put a light usb boot loader on the chip it's ok, having to do that with each upgrade no way...

Imho, the way mwm sees it is the way to go, a light BL in place of the WK's one.

Thx for the boot sequence explanation, mwm.
Last edit: 07 Oct 2015 14:06 by blackmoon.

Please Log in or Create an account to join the conversation.

Time to create page: 0.082 seconds
Powered by Kunena Forum