mirror of
https://github.com/dougg3/mac-rom-simm-programmer.git
synced 2024-11-25 10:30:49 +00:00
Added extra commands for moving back and forth between the bootloader and the actual program.
Disabled the flash erase capability on the main program while I'm working on the bootloader...
This commit is contained in:
parent
035e7cce28
commit
258fb187ad
@ -1,4 +1,4 @@
|
||||
#Tue Dec 20 21:48:25 PST 2011
|
||||
#Sat Dec 24 19:28:57 PST 2011
|
||||
avrtarget/ClockFrequency=16000000
|
||||
avrtarget/ExtRAMSize=0
|
||||
avrtarget/ExtendedRAM=false
|
||||
@ -21,7 +21,7 @@ avrtarget/avrdude/Locks/FileName=
|
||||
avrtarget/avrdude/Locks/MCUid=at90usb646
|
||||
avrtarget/avrdude/Locks/UseFile=false
|
||||
avrtarget/avrdude/Locks/Write=false
|
||||
avrtarget/avrdude/NoChipErase=false
|
||||
avrtarget/avrdude/NoChipErase=true
|
||||
avrtarget/avrdude/NoSigCheck=false
|
||||
avrtarget/avrdude/NoVerify=false
|
||||
avrtarget/avrdude/NoWrite=false
|
||||
|
@ -63,25 +63,34 @@ typedef enum ProgrammerCommand
|
||||
ReadByte,
|
||||
ReadChips,
|
||||
EraseChips,
|
||||
WriteChips
|
||||
WriteChips,
|
||||
GetBootloaderState,
|
||||
EnterBootloader,
|
||||
EnterProgrammer
|
||||
} ProgrammerCommand;
|
||||
|
||||
typedef enum ProgrammerReply
|
||||
{
|
||||
CommandReplyOK,
|
||||
CommandReplyOK = 0,
|
||||
CommandReplyError,
|
||||
CommandReplyInvalid
|
||||
} ProgrammerReply;
|
||||
|
||||
typedef enum BootloaderStateReply
|
||||
{
|
||||
BootloaderStateInBootloader = 0,
|
||||
BootloaderStateInProgrammer
|
||||
} BootloaderStateReply;
|
||||
|
||||
typedef enum ComputerReadReply
|
||||
{
|
||||
ComputerReadOK,
|
||||
ComputerReadOK = 0,
|
||||
ComputerReadCancel
|
||||
} ComputerReadReply;
|
||||
|
||||
typedef enum ProgrammerReadReply
|
||||
{
|
||||
ProgrammerReadOK,
|
||||
ProgrammerReadOK = 0,
|
||||
ProgrammerReadError,
|
||||
ProgrammerReadMoreData,
|
||||
ProgrammerReadFinished,
|
||||
@ -90,26 +99,26 @@ typedef enum ProgrammerReadReply
|
||||
|
||||
typedef enum ComputerWriteReply
|
||||
{
|
||||
ComputerWriteMore,
|
||||
ComputerWriteMore = 0,
|
||||
ComputerWriteFinish,
|
||||
ComputerWriteCancel
|
||||
} ComputerWriteReply;
|
||||
|
||||
typedef enum ProgrammerWriteReply
|
||||
{
|
||||
ProgrammerWriteOK,
|
||||
ProgrammerWriteOK = 0,
|
||||
ProgrammerWriteError,
|
||||
ProgrammerWriteConfirmCancel
|
||||
} ProgrammerWriteReply;
|
||||
|
||||
typedef enum ProgrammerIdentifyReply
|
||||
{
|
||||
ProgrammerIdentifyDone
|
||||
ProgrammerIdentifyDone = 0
|
||||
} ProgrammerIdentifyReply;
|
||||
|
||||
typedef enum ProgrammerElectricalTestReply
|
||||
{
|
||||
ProgrammerElectricalTestFail,
|
||||
ProgrammerElectricalTestFail = 0,
|
||||
ProgrammerElectricalTestDone
|
||||
} ProgrammerElectricalTestReply;
|
||||
|
||||
@ -282,6 +291,27 @@ void USBSerial_HandleWaitingForCommandByte(uint8_t byte)
|
||||
writePosInChunk = -1;
|
||||
SendByte(CommandReplyOK);
|
||||
break;
|
||||
case GetBootloaderState:
|
||||
SendByte(CommandReplyOK);
|
||||
SendByte(BootloaderStateInProgrammer);
|
||||
break;
|
||||
case EnterBootloader:
|
||||
SendByte(CommandReplyOK);
|
||||
USB_Disable();
|
||||
|
||||
// Disable interrupts...
|
||||
cli();
|
||||
|
||||
// Wait a little bit to let everything settle and let the program close the port after the USB disconnect
|
||||
_delay_ms(2000);
|
||||
|
||||
// Now run the bootloader
|
||||
__asm__ __volatile__ ( "jmp 0xE000" );
|
||||
break;
|
||||
case EnterProgrammer:
|
||||
// Already in the programmer
|
||||
SendByte(CommandReplyOK);
|
||||
break;
|
||||
default:
|
||||
SendByte(CommandReplyInvalid);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user