Updating firmware with protected bootloader.

Discussions related to MegaDrum Hardware

Re: Updating firmware with protected bootloader.

Postby einkahumor » Sun Jun 20, 2010 6:23 pm

dmitri wrote:On Mac OS X can be compiled as:
Code: Select all
g++ -D__MACOSX_CORE__ -Wall -o mdfwupdate update.cpp RtMidi.cpp -framework CoreMidi -framework CoreAudio -framework CoreFoundation
This doesn't seem to work for me. I get:
Code: Select all
update.cpp:8: warning: deprecated conversion from string constant to ‘char*’
update.cpp:11: warning: deprecated conversion from string constant to ‘char*’
update.cpp: In function ‘int main(int, char**)’:
update.cpp:43: warning: format not a string literal and no format arguments
update.cpp:150: warning: format ‘%2X’ expects type ‘unsigned int*’, but argument 3 has type ‘unsigned char*’
update.cpp:211: error: ‘Sleep’ was not declared in this scope
RtMidi.cpp: In member function ‘virtual void RtMidiIn::openPort(unsigned int, std::string)’:
RtMidi.cpp:371: warning: NULL used in arithmetic
RtMidi.cpp: In function ‘const __CFString* EndpointName(MIDIEndpointRef, bool)’:
RtMidi.cpp:454: warning: NULL used in arithmetic
RtMidi.cpp:470: warning: NULL used in arithmetic
RtMidi.cpp: In function ‘const __CFString* ConnectedEndpointName(MIDIEndpointRef)’:
RtMidi.cpp:528: error: ‘EndianS32_BtoN’ was not declared in this scope
RtMidi.cpp: In member function ‘virtual void RtMidiOut::openPort(unsigned int, std::string)’:
RtMidi.cpp:668: warning: NULL used in arithmetic

...and nothing seems to happen. I'm supposed to see a mdfwupdate binary after compiling, right? I'm no code expert (obviously) so if I'm missing something obvious, please tell me. Any ideas?

I'm running Mac OS X 10.6.3.
einkahumor
 
Posts: 35
Joined: Sat Jan 23, 2010 3:02 pm

Re: Updating firmware with protected bootloader.

Postby dmitri » Sun Jun 20, 2010 9:15 pm

Code: Select all
$ g++ -D__MACOSX_CORE__ -Wall -o mdfwupdate update.cpp RtMidi.cpp -framework CoreMidi -framework CoreAudio -framework CoreFoundation
update.cpp: In function 'int main(int, char**)':
update.cpp:190: warning: format '%2X' expects type 'unsigned int*', but argument 3 has type 'unsigned char*'
$ ls -l mdfwupdate
-rwxr-xr-x  1 dmitri  staff  77144 Jun 20 22:11 mdfwupdate
$ file mdfwupdate
mdfwupdate: Mach-O executable i386


You may not have Apple SDK (Xcode?) installed.
dmitri
Site Admin
 
Posts: 8706
Joined: Fri Aug 03, 2007 8:05 pm

Re: Updating firmware with protected bootloader.

Postby einkahumor » Sun Jun 20, 2010 10:35 pm

Yup, I installed Xcode just for compiling this. Before I installed Xcode the line in your post just returned a "command not found" message. I'm downloading an update to 10.6.4 and an Xcode update and I guess I'll find out if that will change anything. Would it work if someone would just post the binary?
einkahumor
 
Posts: 35
Joined: Sat Jan 23, 2010 3:02 pm

Re: Updating firmware with protected bootloader.

Postby Firelord » Sun Jun 20, 2010 11:19 pm

With the provided source code I was able to put together a wxWidgets application:

mdupdate.PNG

Download: MDUpdate.zip (~ 800 KB)

Currently it only works on Windows, however because it is wxWidgets powered it can be ported to other platforms as well. I have plans for a Linux port. Unfortunately, I cannot compile/test it for Mac, maybe someone else can help out with that. I will provide the source code later.

Here's a quick run-down of how it works in XP:

http://www.youtube.com/watch?v=-N5YrSE4nxo
You do not have the required permissions to view the files attached to this post.
Firelord
 
Posts: 666
Joined: Wed Jun 10, 2009 7:50 pm
Location: Estonia

Re: Updating firmware with protected bootloader.

Postby davem » Mon Jun 21, 2010 8:08 pm

einkahumor wrote:Yup, I installed Xcode just for compiling this. Before I installed Xcode the line in your post just returned a "command not found" message. I'm downloading an update to 10.6.4 and an Xcode update and I guess I'll find out if that will change anything. Would it work if someone would just post the binary?


I would if I could, but I get the same build error as you. Looks like the RtMidi library doesn't like Snow Leopard for some reason.

edit: Courtesy of this page I have found a solution that will, at least, allow the thing to compile. In RtMidi.cpp, after line 168 add the line

Code: Select all
#include <Endian.h>


and then compile with

Code: Select all
g++ -D__MACOSX_CORE__ -Wall -o mdfwupdate update.cpp RtMidi.cpp -I/Developer/Headers/FlatCarbon -framework CoreMidi -framework CoreAudio -framework CoreFoundation


In the meantime I will write a native Cocoa version. However I need to get my chip programmed by Dmitri first!
davem
 
Posts: 71
Joined: Sun Jun 14, 2009 9:51 pm

Re: Updating firmware with protected bootloader.

Postby davem » Mon Jun 21, 2010 8:27 pm

Firelord wrote:Currently it only works on Windows, however because it is wxWidgets powered it can be ported to other platforms as well. I have plans for a Linux port. Unfortunately, I cannot compile/test it for Mac, maybe someone else can help out with that. I will provide the source code later.


I'm willing to test on my Mac, once I get my firmware flashed by Dmitri. In the long run I guess it should probably be included in MCT, if/when the redesign happens. It would be nice to get firmware updates working properly.
davem
 
Posts: 71
Joined: Sun Jun 14, 2009 9:51 pm

Re: Updating firmware with protected bootloader.

Postby dmitri » Mon Jun 21, 2010 8:32 pm

Mac users, you can try this version I compiled under Mac OS X 10.5.8:
mdfwupdate_mac.zip


I have not tested it with a real MegaDrum myself.
You do not have the required permissions to view the files attached to this post.
dmitri
Site Admin
 
Posts: 8706
Joined: Fri Aug 03, 2007 8:05 pm

Re: Updating firmware with protected bootloader.

Postby Firelord » Mon Jun 21, 2010 9:07 pm

Some updates regarding MDUpdate.

Here is the Windows version source code (built using wxDevC++, project included):
MDUpdate_src.zip

Here is the Linux version and source code (built using Code::Blocks, project file included):
Binary: wxMDUpdate.tar.gz
Source: wxMDUpdate_src.tar.gz

The Linux version doesn't work on my virtual machine running OpenSUSE 11.1: the update starts, the first data packet is sent (symbols "1>" appear on the LCD) and then MegaDrum restarts and the update process fails on the PC. The same happens with the Windows version (MDUpdate.exe) running under Wine (same goes for Dmitri's utility compiled under Linux, with added #include <stdlib.h> and changed Sleep() to usleep()). Can someone test this on a real OS? The application needs GTK+2.

I had to rewrite some of the code for the Linux port. Should someone decide to make a MAC port I suggest taking the Linux source code as the starting point. Also wxWidgets and C++ knowledge is a necessity for the port to be successful.

UPD: forgot to mention a couple of important things

    * The Linux version is based on wxGTK;
    * You can take the source for Linux and use the provided project file directly on the MAC version of Code::Blocks, see if that works. Of course, you'll need to tweak the compiler settings.
Firelord
 
Posts: 666
Joined: Wed Jun 10, 2009 7:50 pm
Location: Estonia

Re: Updating firmware with protected bootloader.

Postby Firelord » Sun Jul 04, 2010 12:55 pm

Firelord wrote:Here is the Linux version and source code (built using Code::Blocks, project file included):
Binary: wxMDUpdate.tar.gz
Source: wxMDUpdate_src.tar.gz

The provided binary will only work when both GTK2 and wxGTK are installed. I will probably make a universal binary at a later time.

However, it seems that I've little need to do so, because the Windows version of MDUpdate works great under Wine. I've managed to test it with a recent distro of OpenSUSE by means of a Live CD and it worked without any problems.

The moral of this story is: ALSA doesn't work as expected under VMWare 6.5. However, I believe they fixed this in version 7.
Firelord
 
Posts: 666
Joined: Wed Jun 10, 2009 7:50 pm
Location: Estonia

Re: Updating firmware with protected bootloader.

Postby Firelord » Sun Jul 25, 2010 11:41 pm

All right, guys, one more update. This time I've updated MCT to work with MegaDrum's new encrypted firmware (once again using Dmitri's source code provided above). The updated version is available from the usual place:

http://www.megadrum.info/configtool/

Be sure to uninstall your earlier version first, because it will not work properly with the new configuration file.

To update, first download and unpack the firmware files. Connect MegaDrum via USB or MIDI I/O and launch MCT. Now go to the options screen and select bootloader v5 and correct MIDI I/O ports. Then select "Firmware -> UPDATE FIRMWARE" from the main application menu and follow further on-screen instructions.

Please write back whether this worked for you. I've only tested this in Windows XP.
Last edited by Firelord on Mon Aug 16, 2010 8:15 pm, edited 1 time in total.
Firelord
 
Posts: 666
Joined: Wed Jun 10, 2009 7:50 pm
Location: Estonia

PreviousNext

Return to MegaDrum Hardware

Who is online

Users browsing this forum: Majestic-12 [Bot] and 78 guests