Re: Tiny Bootloader



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

.



Relevant Pages

  • Re: Fastcode - My Pascal Pos
    ... function PosShaPas(const SubStr: AnsiString; const Str: AnsiString): ... if ch=pthen goto Ret0; ...
    (borland.public.delphi.language.basm)
  • Re: Fastcode PosEx B&V 0.9
    ... if ch=pthen goto Ret0; ... if ch=pthen goto Ret1; ...
    (borland.public.delphi.language.basm)
  • Re: Fastcode - My Pascal Pos
    ... function PosShaPas(const SubStr: AnsiString; const Str: AnsiString): ... if ch=pthen goto Ret0; ...
    (borland.public.delphi.language.basm)
  • Fastcode - My Pascal Pos
    ... function PosShaPas(const SubStr: AnsiString; const Str: AnsiString): ... if ch=pthen goto Ret0; ...
    (borland.public.delphi.language.basm)
  • Re: dd command & reading in background
    ... ^ D,"UnixReview: Shell Corner: The dspl Korn Shell ... user input timeout, do a search on C.U.S. for the ... # 0<c<127 - job exited with this exit code ...
    (comp.unix.shell)