-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flashing problem #11
Comments
Aha, you too!?!? I just spend hours with this.. not to mention cursing at it. |
What more files do you have in the same folder as BOOT_LOADER_EXE ?!? ITS_A_CARD.hex doesn't seem to be enough |
For the normal Rev.G you need to have the files Chameleon-Mini.hex and the Chameleon-Mini.eep in the same directory where the flash.bat is located. |
I think that the BOOT_LOADER_EXE file has the dfu-programmer as well as the required "original" hex files embed into it. So, it works standalone. The only thing required is for the Chameleon to be in bootloader mode with the libusb drivers loaded for it. |
Actually, my bad, it needs the following two files:
|
I don't know. I put the libusb0.dll and some of the warnings went away.
|
you can create the first myfile.bin if you put the ITS_A_CARD.hex in the same folder and run the bat file. |
oops.. I removed the libusb.file and my BOOT_LOADER_EXE.exe worked.. It feels we figured out something important here. When compiling the project, we can now get the myfile.. |
Now that you mentioned it, when I had the libusb0.dll in the same folder, the flashing (with the BOOT_LOADER_EXE) wasn't working. I had to remove that dll in order to work. |
Ha, you found out fast enough! :) |
Could be. lets test. |
Yep! That worked! :) |
yes, It worked for me too! I took some time looking at the generated bin files. It adds two bytes to the end of the file and scramble/encrypt/xor the whole file. So we can update the flash.bat, to copy and rename. Give instructions to copy hex,eep file from compilation, and run flash, then copy to BOOT_LOADER_EXE folder, and run... |
Bravo! We have now unlocked achivement, flash your own firmware onto device. |
Someone wants to compile the official revE firmware and test? ;) |
Hehe, I was thinking of doing either that or try to compile the initial commit of your repo. Before the migration, just to see if it gives the same functionality as the "stock" flash files. |
I just did flash this repo ;) However, since I don't know the functions before, that was maybe a pre-hasten idea. Never mind, why look back? Now that it can get some bug fixes from the offical revE and RevG |
Added some draft wiki page for flashing on windows. I have no clue how the linux/osx based users will be able to flash given the need for BOOT_LOADER_EXE.exe. We would need source code for that file, or decompile it ourselfs. |
It seems weird to me that even if that BOOT_LOADER_EXE seems to be using dfu-programmer, the needed files for it are in binary format. As far as I have seen, dfu-programmer only accepts ihex files for flashing. Could this exe be (re-)extracting the ihex data from the supplied binaries, using also somehow those two bytes you noticed that the Createbin.exe utility is adding to them? Maybe we should first figure out what this Createbin.exe file does. By the way, decompilation is almost impossible for those two binaries (probably written in C++). We need someone with disassembling skills. |
Don't know. SInce it uses two files to compile, and the orignal hex is only one file. Try and see what happens on a linux? Someone with IDA pro skills can do their magic :) when it comes to decompilation. That even I manage but understanding whats going on from the deadlisting is not my cup of tea. |
ok, I chatted with manufacturer, the createbin does apperantly a AES encryption. The software was developed (gui, code) by a external developer. Sad part of story, the developer seems to have forgotten which key was used. Still, if its encryption, it needs to be decrypted somewhere. If there is a decryption, the key must be there too. |
I passed an all zero file to CreateBin.exe and the resulting myfile.bin has 256 byte block of repeating apparently random data. |
AES with padding also fits the two extra bytes. In order to fit a aes blocksize of 16bytes. Since the myfile.bin is completely encrypted and padded with 2bytes, the key is not added to the file. PEiD also shows that BOOT_LOADER_EXE.exe uses AES. So createbin encrypts -> boot_loader_exe decrypts and flashes. |
Createfile.exe is called with two params. myfile.bin The second param allows bin or txt where text generates a file with hex strings of the file instead . |
Running Createbin.exe txt on an empty file (0 bytes) returns this: Since we are stuck for the time being with these utilities, I updated the flash.bat script to work with those two (+avr-objcopy.exe), having the eep and hex files as input. |
nice. I pushed it, why don't you make a pull request (PR) and use github for what its built for? |
Indeed, I will next time. Maybe we should also copy the BOOT_LOADER_EXE.exe into the /Software/FlashTools/ directory? To have there everything needed for flashing. |
Its under a differnt folder, Win32, We would need a better structure of files. Many binaries which we don't have source code for. Maybe a wget/curl script which downloads all needed binaries. |
ok, I probably bricked my chameleon :-D dfu-programmer atxmega32a4u erase then I tried to flash the dfu-programmer atxmega32a4u flash ChameleonMiniRDV2.0_ATxmega32A4U.hex dfu-programmer atxmega32a4u flash ChameleonMiniRDV2.0_ATxmega32A4U.hex --suppress-bootloader-mem with more debug: dfu-programmer atxmega32a4u flash ChameleonMiniRDV2.0_ATxmega32A4U.hex --suppress-bootloader-mem --debug 300 dfu.c:414: dfu_device_init( 1003, 12260, 0x7fff59f5e6e0, true, false ) ps ... I'm working on Mac OSX update: OK ... not the way it should be, but seems to work: I suppose the eep is for the settings, but the ChameleonMiniRDV2.0_ATxmega32A4U.hex |
@bogiton I believe you are right! |
This 3rd file is indeed doing a xor operation related to the constants I see in CreateBin.exe (that the two others files aren't doing). I guess the "best" file to stick around is the |
@slurdge Hello, where is the RevE-atxmega32a4u_104_modified.hex available? How to flash it to replace the original bootloader? I am trying to flash on Linux, but no luck so far. |
@slurdge I built bootloader from sources. Changes needed for ports & pins for rebooted are in this commit: exander77/ChameleonMini-rebooted-bootloader@0578952 IAR AVR is needed to build it, evaluation version with 4kB limit is sufficient: https://www.iar.com/iar-embedded-workbench/#!?architecture=AVR |
@exander77 Nice! The original modified hex is there: https://github.com/emsec/ChameleonMini/blob/master/RevE/Firmware/Atmel%20DFU%20Bootloader/RevE-atxmega32a4u_104_modified.hex Where did you find the original source? |
@slurdge From the Microchip Technology Inc., but finding it on their site is next to impossible, all prebuilt bootloaders for AVR including sources are available here: http://ww1.microchip.com/downloads/en/DeviceDoc/AVR1916.zip |
@slurdge How did you flashed bootloader? |
@exander77 I flashed with a special hardware... Actually I'm still working on it, my goal would be to have a future proof method of "unlocking" the firmware. It was near what you did in the other thread. My basic assumption is that you should merge (or not, program data is not important at that point) program and bootloader (which is at the end), scramble, then force upload. It should unlock the bootloader with a correct version, from that point, I could flash without encrypting/scrambling etc. But the unlock part was done with a AVR mkII programmer. |
@slurdge Do you have the pinout to flash through the programmer? |
@slurdge, @exander77 - it seems like tremendous discover here.
So again, if I get it well and due to all this, we could probably do as follow to flash a Atmel-provided ATxmega32A4U DFU USB bootloader source to RevE (with tuned PINing), and get a fully unlocked RevE:
And voilà?! |
@ShinHub , unfortunately, the bootloader isn't self-programmable as far as I know. So you would only program the bootloader into the program section of the device itself. |
Sh*t. I will try however, in the name of science, and because I feel not skilled enough to diff AVR hex files. |
…vered by @slurdge and @exander77 in issue iceman1001#11.
@iceman1001 I created a page for the summed up info on bootloader. |
so what was the final solution here? |
For the sake of your own sanity, may I suggest you find your way in the discord server found here https://discord.com/invite/QfPvGFRQxH |
Bye bye, Enjoy your ban. |
Who promotes anything, you tard? This is Github and OpenSource project that targets these machines. But if you pay me 1000$, I will flash your machine myself. :D
Wtf, is wrong with you? |
@exander77 leave it be. This is closed. |
@iceman1001 Sorry, I had a lot of spam from this thread, so I at least reacted. |
Has anyone managed to flash the compiled eep/hex files successfully onto the Chameleon?
If I run the ChameleonFirmwareUpgrade.bat script, while being in bootloader mode, I keep getting the following:
If I try to add the --suppress-validation argument to dfu-programmer.exe the process seems to be finishing without errors, but the result is a dead Chameleon. And then, the only way to revive it is by running the supplied "BOOT_LOADER_EXE.exe" which displays the following:
The text was updated successfully, but these errors were encountered: