How To Set Up The Midifighter Development Environment - WIN32

Home :: MIDIfighter Resources and Discussion :: How To Set Up The Midifighter Development Environment - WIN32Reply
How To Set Up The Midifighter Development Environment - WIN32
Posted on: 24.02.2010 by robert chanda
How To set up the Midifighter Development Environment

20100224: created by Fatlimey

Developing under Windows

Create a project directory that will hold the libraries and tools, say,
"Midifighter" in an easy to find location. As many of the tools we will be
using are command-line based, keeping the path to this directory short will
help keep typing to a minimum. I keep my workspace at "C:\midifighter"

The source code for the Midifighter firmware can be downloaded from
Sourceforge at:


Unzip the source tree into your project directory and you should find the
source code (.c and .h files) as well as the project Makefile. The source
code is heavily documented and is broken into logical systems with the main
program loop residing in "midifighter.c".

The Midifighter zip archive contains the source code only, and so you will
need to download two additional sets of libraries that are required to
produce working binaries. WinAVR is a set of libraries, compilers, debuggers
and command line tools for the AVR series of processors that can be found
at:


WinAVR comes with an installer that installs all the tools and adds the
install path to the PATH environment variable. This means that all the
command line tools are instantly available at the command prompt. Part of
the WinAVR package is a set of Gnu Tools compiled for Win32 that provide
the Unix command line tools "make", "grep", "find" etc.

Next you will need to download the LUFA libraries for USB on AVR chips. This
library, written by he indispensable Dean Camera, can be found at:


Create a "LUFA" subdirectory inside the project directory and Unzip the LUFA
project into that place. The resulting layout after installing these tools
should be:
Code:
    drive (c:)
     |_ Program Files
     | |_ Atmel
     |    |_ Flip 3.4.1
     |      |_ bin
     |_ ...
     |_ WinAVR
     |  |_ bin
     |  |_ utils
     |_ ...
     |_ midifighter
        |_ LUFA
        | |_ ..
        |_ COPYING.txt
        |_ Makefile
        |_ README.txt
        |_ adc.c
        |_ adc.h
        |_ constants.h
        |_ eeprom.c
        |_ eeprom.h
        |_ expansion.c
        |_ expansion.h
        |_ fourbanks.c
        |_ fourbanks.h
        |_ key.c
        |_ key.h
        |_ led.c
        |_ led.h
        |_ menu.c
        |_ menu.h
        |_ midi.c
        |_ midi.h
        |_ midifighter.c
        |_ selftest.c
        |_ selftest.h
        |_ spi.c
        |_ spi.h
        |_ usb_descriptors.c
        |_ usb_descriptors.h
To build the firmware, open a command line (from the Start button you can use "All
Programs/Accessories/Command Prompt", or use the "Run..." option and execute
"cmd"). Change the directory to your project dir and build the project using
the make command:
Code:
    > cd C:\midifighter
    > make -s
The "-s" on the make command silences printout of the actual commands
executed (which is optional), but the output should resemble:
Code:
    -------- begin --------
    avr-gcc (WinAVR 20100110) 4.3.3
    Copyright (C) 2008 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     
    Compiling C: midifighter.c
    Compiling C: eeprom.c
    Compiling C: spi.c
    Compiling C: adc.c
    Compiling C: led.c
    Compiling C: key.c
    Compiling C: midi.c
    Compiling C: menu.c
    Compiling C: selftest.c
    Compiling C: expansion.c
    Compiling C: fourbanks.c
    Compiling C: usb_descriptors.c
    Compiling C: LUFA/LUFA/Drivers/USB/LowLevel/DevChapter9.c
    Compiling C: LUFA/LUFA/Drivers/USB/LowLevel/Endpoint.c
    Compiling C: LUFA/LUFA/Drivers/USB/LowLevel/Host.c
    Compiling C: LUFA/LUFA/Drivers/USB/LowLevel/HostChapter9.c
    Compiling C: LUFA/LUFA/Drivers/USB/LowLevel/LowLevel.c
    Compiling C: LUFA/LUFA/Drivers/USB/LowLevel/Pipe.c
    Compiling C: LUFA/LUFA/Drivers/USB/HighLevel/Events.c
    Compiling C: LUFA/LUFA/Drivers/USB/HighLevel/USBInterrupt.c
    Compiling C: LUFA/LUFA/Drivers/USB/HighLevel/USBTask.c
    Compiling C: LUFA/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c
    Linking: midifighter.elf
    Creating load file for Flash: midifighter.hex
    Creating load file for EEPROM: midifighter.eep
    Creating Extended Listing: midifighter.lss
    Creating Symbol Table: midifighter.sym
    Checking for invalid events...
     
    ---- Compile Time Library Options ----
    NO_STREAM_CALLBACKS
    USB_DEVICE_ONLY
    FIXED_CONTROL_ENDPOINT_SIZE=8
    FIXED_NUM_CONFIGURATIONS=1
    USE_FLASH_DESCRIPTORS
    USE_STATIC_OPTIONS=(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)
    --------------------------------------
     
    --------- Target Information ---------
    AVR Model: at90usb162
    Board:
    Clock: 16000000Hz CPU, 16000000Hz Master
    --------------------------------------
     
    Size after:
    AVR Memory Usage
    ----------------
    Device: at90usb162
     
    Program:    6160 bytes (37.6% Full)
    (.text + .data + .bootloader)
     
    Data:         96 bytes (18.8% Full)
    (.data + .bss + .noinit)
     
    -------- end --------
At the end of this you will find a firmware image called "midifighter.hex"
in the project directory.



Flashing from the Makefile

The Makefile that comes with the project contains a build target that will
reflash the Midifighter from the command line.

If you have already installed the Atmel Flip tool and added the "bin"
directory from that tool to your PATH environment variable:
Code:
    > set PATH= %PATH%;C:\Program Files\Atmel\Flip 3.4.1\bin
we can use the "batchisp" command to do the work. Make sure the Midifighter
is in Bootloader Mode and execute "make flip". This will execute a script
that will upload the firmware and reset the Midifighter to start the program
executing:

Code:
    > make flip

    batchisp -hardware usb -device at90usb162 -operation erase f
    Running batchisp 1.2.4 on Wed Feb 24 01:19:15 2010
     
    AT90USB162 - USB - USB/DFU
     
    Device selection....................... PASS 
    Hardware selection..................... PASS 
    Opening port........................... PASS 
    Reading Bootloader version............. PASS	1.0.5
    Erasing................................ PASS 
     
    Summary:  Total 5   Passed 5   Failed 0

    batchisp -hardware usb -device at90usb162 -operation loadbuffer midifighter.hex program
    Running batchisp 1.2.4 on Wed Feb 24 01:19:16 2010
     
    AT90USB162 - USB - USB/DFU
     
    Device selection....................... PASS 
    Hardware selection..................... PASS 
    Opening port........................... PASS 
    Reading Bootloader version............. PASS	1.0.5
    Parsing HEX file....................... PASS	midifighter.hex
    Programming memory..................... PASS	0x00000	0x0180f
     
    Summary:  Total 6   Passed 6   Failed 0

    batchisp -hardware usb -device at90usb162 -operation start reset 0
    Running batchisp 1.2.4 on Wed Feb 24 01:19:18 2010
     
    AT90USB162 - USB - USB/DFU
     
    Device selection....................... PASS 
    Hardware selection..................... PASS 
    Opening port........................... PASS 
    Reading Bootloader version............. PASS	1.0.5
    Starting Application................... PASS	RESET	0
     
    Summary:  Total 5   Passed 5   Failed 0
There are similar targets for programming using the "dfu-programmer" tool or
hardware programming debugging using Avrdude and a JTAG programmer. If you are familiar with those tools, read the Makefile for more information.
robert chanda
24.02.2010
How To set up the Midifighter Development Environment

20100224: created by Fatlimey

Developing under Windows

Create a project directory that will hold the libraries and tools, say,
"Midifighter" in an easy to find location. As many of the tools we will be
using are command-line based, keeping the path to this directory short will
help keep typing to a minimum. I keep my workspace at "C:\midifighter"

The source code for the Midifighter firmware can be downloaded from
Sourceforge at:


Unzip the source tree into your project directory and you should find the
source code (.c and .h files) as well as the project Makefile. The source
code is heavily documented and is broken into logical systems with the main
program loop residing in "midifighter.c".

The Midifighter zip archive contains the source code only, and so you will
need to download two additional sets of libraries that are required to
produce working binaries. WinAVR is a set of libraries, compilers, debuggers
and command line tools for the AVR series of processors that can be found
at:


WinAVR comes with an installer that installs all the tools and adds the
install path to the PATH environment variable. This means that all the
command line tools are instantly available at the command prompt. Part of
the WinAVR package is a set of Gnu Tools compiled for Win32 that provide
the Unix command line tools "make", "grep", "find" etc.

Next you will need to download the LUFA libraries for USB on AVR chips. This
library, written by he indispensable Dean Camera, can be found at:


Create a "LUFA" subdirectory inside the project directory and Unzip the LUFA
project into that place. The resulting layout after installing these tools
should be:
Code:
    drive (c:)
     |_ Program Files
     | |_ Atmel
     |    |_ Flip 3.4.1
     |      |_ bin
     |_ ...
     |_ WinAVR
     |  |_ bin
     |  |_ utils
     |_ ...
     |_ midifighter
        |_ LUFA
        | |_ ..
        |_ COPYING.txt
        |_ Makefile
        |_ README.txt
        |_ adc.c
        |_ adc.h
        |_ constants.h
        |_ eeprom.c
        |_ eeprom.h
        |_ expansion.c
        |_ expansion.h
        |_ fourbanks.c
        |_ fourbanks.h
        |_ key.c
        |_ key.h
        |_ led.c
        |_ led.h
        |_ menu.c
        |_ menu.h
        |_ midi.c
        |_ midi.h
        |_ midifighter.c
        |_ selftest.c
        |_ selftest.h
        |_ spi.c
        |_ spi.h
        |_ usb_descriptors.c
        |_ usb_descriptors.h
To build the firmware, open a command line (from the Start button you can use "All
Programs/Accessories/Command Prompt", or use the "Run..." option and execute
"cmd"). Change the directory to your project dir and build the project using
the make command:
Code:
    > cd C:\midifighter
    > make -s
The "-s" on the make command silences printout of the actual commands
executed (which is optional), but the output should resemble:
Code:
    -------- begin --------
    avr-gcc (WinAVR 20100110) 4.3.3
    Copyright (C) 2008 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     
    Compiling C: midifighter.c
    Compiling C: eeprom.c
    Compiling C: spi.c
    Compiling C: adc.c
    Compiling C: led.c
    Compiling C: key.c
    Compiling C: midi.c
    Compiling C: menu.c
    Compiling C: selftest.c
    Compiling C: expansion.c
    Compiling C: fourbanks.c
    Compiling C: usb_descriptors.c
    Compiling C: LUFA/LUFA/Drivers/USB/LowLevel/DevChapter9.c
    Compiling C: LUFA/LUFA/Drivers/USB/LowLevel/Endpoint.c
    Compiling C: LUFA/LUFA/Drivers/USB/LowLevel/Host.c
    Compiling C: LUFA/LUFA/Drivers/USB/LowLevel/HostChapter9.c
    Compiling C: LUFA/LUFA/Drivers/USB/LowLevel/LowLevel.c
    Compiling C: LUFA/LUFA/Drivers/USB/LowLevel/Pipe.c
    Compiling C: LUFA/LUFA/Drivers/USB/HighLevel/Events.c
    Compiling C: LUFA/LUFA/Drivers/USB/HighLevel/USBInterrupt.c
    Compiling C: LUFA/LUFA/Drivers/USB/HighLevel/USBTask.c
    Compiling C: LUFA/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c
    Linking: midifighter.elf
    Creating load file for Flash: midifighter.hex
    Creating load file for EEPROM: midifighter.eep
    Creating Extended Listing: midifighter.lss
    Creating Symbol Table: midifighter.sym
    Checking for invalid events...
     
    ---- Compile Time Library Options ----
    NO_STREAM_CALLBACKS
    USB_DEVICE_ONLY
    FIXED_CONTROL_ENDPOINT_SIZE=8
    FIXED_NUM_CONFIGURATIONS=1
    USE_FLASH_DESCRIPTORS
    USE_STATIC_OPTIONS=(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)
    --------------------------------------
     
    --------- Target Information ---------
    AVR Model: at90usb162
    Board:
    Clock: 16000000Hz CPU, 16000000Hz Master
    --------------------------------------
     
    Size after:
    AVR Memory Usage
    ----------------
    Device: at90usb162
     
    Program:    6160 bytes (37.6% Full)
    (.text + .data + .bootloader)
     
    Data:         96 bytes (18.8% Full)
    (.data + .bss + .noinit)
     
    -------- end --------
At the end of this you will find a firmware image called "midifighter.hex"
in the project directory.



Flashing from the Makefile

The Makefile that comes with the project contains a build target that will
reflash the Midifighter from the command line.

If you have already installed the Atmel Flip tool and added the "bin"
directory from that tool to your PATH environment variable:
Code:
    > set PATH= %PATH%;C:\Program Files\Atmel\Flip 3.4.1\bin
we can use the "batchisp" command to do the work. Make sure the Midifighter
is in Bootloader Mode and execute "make flip". This will execute a script
that will upload the firmware and reset the Midifighter to start the program
executing:

Code:
    > make flip

    batchisp -hardware usb -device at90usb162 -operation erase f
    Running batchisp 1.2.4 on Wed Feb 24 01:19:15 2010
     
    AT90USB162 - USB - USB/DFU
     
    Device selection....................... PASS 
    Hardware selection..................... PASS 
    Opening port........................... PASS 
    Reading Bootloader version............. PASS	1.0.5
    Erasing................................ PASS 
     
    Summary:  Total 5   Passed 5   Failed 0

    batchisp -hardware usb -device at90usb162 -operation loadbuffer midifighter.hex program
    Running batchisp 1.2.4 on Wed Feb 24 01:19:16 2010
     
    AT90USB162 - USB - USB/DFU
     
    Device selection....................... PASS 
    Hardware selection..................... PASS 
    Opening port........................... PASS 
    Reading Bootloader version............. PASS	1.0.5
    Parsing HEX file....................... PASS	midifighter.hex
    Programming memory..................... PASS	0x00000	0x0180f
     
    Summary:  Total 6   Passed 6   Failed 0

    batchisp -hardware usb -device at90usb162 -operation start reset 0
    Running batchisp 1.2.4 on Wed Feb 24 01:19:18 2010
     
    AT90USB162 - USB - USB/DFU
     
    Device selection....................... PASS 
    Hardware selection..................... PASS 
    Opening port........................... PASS 
    Reading Bootloader version............. PASS	1.0.5
    Starting Application................... PASS	RESET	0
     
    Summary:  Total 5   Passed 5   Failed 0
There are similar targets for programming using the "dfu-programmer" tool or
hardware programming debugging using Avrdude and a JTAG programmer. If you are familiar with those tools, read the Makefile for more information.
Olimpia Briden
13.09.2013
Hi All, I just popped on to say that there is an issue with using the code with WinAVR-20100110, it appears that the included avr-gcc has changed the way progmem is addressed, any variables declared with PROGMEM need to be preceded with const at the front.

The first error occurred in midi.c line 62:
uint8_t kNoteMap[16] PROGMEM = {
12, 13, 14, 15,
8, 9, 10, 11,
4, 5, 6, 7,
0, 1, 2, 3,
};

changing it to:
const uint8_t kNoteMap[16] PROGMEM = {
12, 13, 14, 15,
8, 9, 10, 11,
4, 5, 6, 7,
0, 1, 2, 3,
};

And usb_descriptors.c also has a bunch of defines using PROGMEM

Lastly, I'm using vista 64bit and I got sync with child errors, it appears I had a bug in WinAVR-20100110\utils\msys.dll, I used the fix from here:
http://www.madwizard.org/electronics...es/winavrvista

Just download the msys-1.0-vista64.zip, backup your WinAVR-20100110\utils\msys.dll and unzip the copy replacing the original.


I had no idea that there was source code for the midifighter, I was actually looking for a midi-usb solution for an atmega32u2 board and found this thread via google:
http://community .djranking s.com/showthread.php?t=15442

I'd like to say thank you to Ean and the dj tech tools team for making the files opensource, kudos for giving back to the dj/controllerist/electronics communities :-)
Marva Cupid
23.06.2011
No its not, its to edit how the midifighter interacts with the computer
Joella Stottsberry
23.06.2011
i dont really get the point of this... is this for making your own mappings???

<< Back to MIDIfighter Resources and DiscussionReply

Copyright 2012-2023
DJRANKINGS.ORG n.g.o.
Chuo-ku, Osaka, Japan

Created by Ajaxel CMS

Terms & Privacy