Re: Tiny Bootloader
- From: Stef Mientki <S.Mientki-nospam@xxxxxxxxxxxxxx>
- Date: Wed, 30 Aug 2006 19:23:36 +0200
JohnT wrote:
I've looked through the bootloader and my interpretation is as follows
:-
1. PIC Starts
2. Jumps to (Max_Memory - 100)
3. Waits a period of time for 'C1' to be received.
4a. If 'C1' is receieved then continue to rewrite the program that it
is being sent.
4b If no 'C1' is received then exit the bootloader.
5 Jump to the start of the bootloader where the four 'nop' commands
should have been replaced with the 'Goto' command that is at the start
of my program.
6 It should find my 'Goto' command and then execute my program.
I believe that the download program that you get off the site looks at
the start of the user program. Finds this 'Goto' command and relocates
it in memory to the start of the bootloader. I think this is where it
is failing but I don't have the source code for the download program to
verify this.
if you mean the UPLOAD program, here is the first part:
<Pascal>
const
//bootloader types
TINY =0;
TOLMIE =1;
TINY_IDENT = $C1;
TINY_IDACK = ord('K');
function TForm_bootloader.TINY_Identify:boolean;
(*******************************************************************************
*******************************************************************************)
begin
with Form_comm_usb do
begin
Flush_Communication(true,true); //great improvement for RS232 !!
Transmit_Buffer[0]:=TINY_IDENT;
Transmit_Count:=1;
result:=Send_Data;
//Error message if not ok
if not(result) then
memo_uploader.lines.add('Transmit Error = '+inttostr(Transmit_Result)+' / '+inttostr(Transmit_Count));
end;
end;
function TForm_bootloader.TINY_Acknowledge:boolean;
(*******************************************************************************
*******************************************************************************)
var
received_byte :byte;
starttime :cardinal;
begin
starttime:=gettickcount;
repeat
result:= Form_comm_usb.read_byte(TINY_PIC_type);
application.processmessages;
until result or (gettickcount-starttime>200);
if not(result) then exit;
starttime:=gettickcount;
repeat
result:= Form_comm_usb.read_byte(received_byte) and
(received_byte=TINY_IDACK);
application.processmessages;
until result or (gettickcount-starttime>200);
end;
//main program
reset_PIC;
//try to he ping the PIC
Ping_Count:=0;
Uploading_Canceled:=false;
repeat
if not(TINY_IDENTIFY) then exit;
Update_Ping_Count;
if Uploading_Canceled then exit;
application.ProcessMessages;
until TINY_ACKNOWLEDGE;
</Pascal>
.
Thanks
- References:
- Tiny Bootloader
- From: JohnT
- Re: Tiny Bootloader
- From: Pietje Bell
- Re: Tiny Bootloader
- From: RaceMouse
- Re: Tiny Bootloader
- From: JohnT
- Re: Tiny Bootloader
- From: RaceMouse
- Re: Tiny Bootloader
- From: JohnT
- Re: Tiny Bootloader
- From: Neil
- Re: Tiny Bootloader
- From: JohnT
- Re: Tiny Bootloader
- From: Diogo G. Casado (a.k.a dIIo)
- Re: Tiny Bootloader
- From: JohnT
- Tiny Bootloader
- Prev by Date: Re: Nice IDE for ARM?
- Next by Date: Re: 8 bit microcontroller market
- Previous by thread: Re: Tiny Bootloader
- Next by thread: Re: Tiny Bootloader
- Index(es):
Relevant Pages
|