Need help with Midipal firmware build/upload

The manual tells me to run the bake_all target but that didn’t seem to work for me.
make: ***** No rule to make target `bake_all’. Stop.

I see a bake target in the makefile, but when I try this:
make -f midipal/makefile bake all

I get:

avrdude: reading input file "build/midipal/midipal.hex"
avrdude: can’t open input file build/midipal/midipal.hex: No such file or directory
avrdude: read from file ‘build/midipal/midipal.hex’ failed

When I run just:
make -f midipal/makefile
…it does build the hex

So then I run the “bake” target again an it starts uploading stuff, but it has a fail in the end. This is the last part:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "build/midipal/midipal.hex"
avrdude: writing flash (31962 bytes):

Writing | ################################################## | 100% 2.48s

avrdude: 31962 bytes of flash written
avrdude: reading input file "0x2f"
avrdude: writing lock (1 bytes):

Writing | | 0% 0.00s *****failed;
Writing | ################################################## | 100% 0.04s

avrdude: 1 bytes of lock written

avrdude: safemode: Fuses OK

The weird thing is that I now have a menu I can scroll through but once I unplug the AVR programmer cable, the thing is gone and I can’t get it back. Like the firmware didn’t stick.

What’s going on? :s

About the make bake_all target not working:

Strange… I can’t reproduce the problem here. There’s a makefile at the root directory which includes midipal/makefile. Maybe you are not running this from the right directory? Especially if you have got the thing from git, you’ll have two nested directories called “midipal”. The true makefile is in midipal/midipal/makefile. The “proxy” with bake_all is in midipal/makefile. You have to be in the midipal directory (not the root, not midipal/midipal).

About the failure when writing the lock:

Happens to me from time to time, but not a problem.

About the menu:

Are you unplugging the ISP connector (leaving the programmer hooked the ISB connector and unplugging it from the USB host causes the device to be held in a reset state)?

I assume the menu you refer to is the “app” selector. If you don’t see anything on the screen there’s a good chance you are just in the “monitor” app. Try a long press on the encoder to bring back the menu.

Ah I see now.

make -f midipal/makefile bake_all
So you’re not supposed to run that command from the repository root but below that. That’s confusing? If you checkout the git repo than you have a root midipal with a subfolder midipal, but at the root you should just execute:
make bake_all

right?

But if I do that it doesn’t build the hex files first:

avrdude: reading input file "build/midipal/midipal.hex"
avrdude: can’t open input file build/midipal/midipal.hex: No such file or directory
avrdude: read from file ‘build/midipal/midipal.hex’ failed

So I do
make -f midipal/makefile
make -f bootloader/makefile

And then:
make bake_all

Then everything seems to go well, but I still have this problem where I detach the AVR and the thing freezes. Upon reboot I get a blank screen and holding down the encoder doesn’t get me anywhere.

I’ve now managed to get it to work using the prebuild hex files.

The thing was the instructions used the system installed avrdude and mine was installed with homebrew and didn’t have the usb part installed. But I figured out how to point it to the Arduino included version based on what was printed to the stdout from the make scripts:

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -B 100 -V -p m328p -c avrispmkII -P usb -e -u -U efuse:w:0xfd:m -U hfuse:w:0xd4:m -U lfuse:w:0xff:m -U lock:w:0x2f:m

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -B 1 -V -p m328p -c avrispmkII -P usb -U flash:w:midipal_flash_golden.hex:i -U eeprom:w:midipal_eeprom_golden.hex:i -U lock:w:0x2f:m

Now it works! I unplug the AVR and it keeps responding.

It would still be nice to know what I was doing wrong with my own builds…

You’re supposed to run the command from the repository root (ie, when must cd into the directory created by the git clone command).

I have updated the makefile so that it builds the dependencies for the “bake_all” rule.

To summarize:

git clone git://github.com/pichenettes/midipal.git
cd midipal
git submodule init && git submodule update
make -f midipal/makefile && make -f bootloader/makefile && make bake_all

With the change:

git clone git://github.com/pichenettes/midipal.git
cd midipal
git submodule init && git submodule update
make bake_all

Crap. It’s this same size problem.

31962 bytes make it over the 31744 (32768 - 1024 for bootloader) limit. I don’t think it was a problem with avrdude - just that the version you built from source with your version of gcc was too large and did not fit fully on the chip.

I’ll see if I can give the same optimization treatment as I did for the Shruthi-1. There’s hope for that - I never really trimmed the Midipal code.

Ah it’s just my luck that I keep running into this size problem :slight_smile:

The trimmed Shruthi code seems to be running fine for me.