Your software would have to run using the MIOS code that also includes the boot loader software, functions for Din & Dout and LCD functions. The Midi code that decodes the Midi commands is also part of this MIOS code. There is a skeleton code example that can be modified by you and compiled for your application needs. It is located at http://svnmios.midibox.org/listing.php?repname=svn.mios&path=%2Ftrunk%2Fapps%2Ftemplates%2Fasm_skeleton%2F
Your code would have to work around all the code and variables used by MIOS. This skeleton code does this for you. I’ve used it for my Midi projects.
in order to use the bootloader, you’ve to locate the reset vector of your code to 0x0400, and the interrupt vector to 0x0408
At 0x0404 the value “0x4711” is expected.
Summary:
org 0x0400
goto Start
dw 0x4711 ; magic number - if != 0x4711, the bootloader won’t branch to 0x0400!
org 0x0408
goto Irq
I’m not sure how this can be done in C, but I’m sure that you will find a way (google might help)
The bootloader itself doesn’t use the EEPROM
The device ID is stored in the ID header instead, which is normally not used by an application.
The ID header should be all-zero (by default it’s all-one)
If your PIC programmer doesn’t allow to program the ID directly, you could use the program linked in “TEST SW2” from this page: http://www.ucapps.de/howto_debug_midi.html
In MIOS Studio you can upload new code the following way:
open the .hex file
push the “start” button
reset (or power-cycle) your core
The query button won’t work while your application is running because it expects a SysEx based communication with the PIC which is only implemented in MIOS.
However, the upload via power-cycling is already more comfortable than using a PIC programmer…