Re: Tiny Bootloader




JohnT wrote:
If I don't put a GOTO in first four instructions it does indeed warn me
that there isn't a GOTO instruction. I also understand how the program
is suppose to work in the PIC. What I don't know and the site doesn't
tell you is what the download program does to your original code.

Yes I have downloaded the example code as it that is is the program I'm
trying to get working.

Neil wrote:
CLIPPED
JohnT wrote:
How do I post my code, I can't see of a way to upload a file. The
start of my code is as follows though.

ORG 0x00 ; Start of the program
CLRF STATUS
MOVLW 0x00
MOVWF PCLATH
GOTO INIT


ORG 0x04 ; Interrupt address
GOTO INT_HAND

All I'm doing after it goes to the INIT routine is set all the outputs
on for PortA and B. I've simulated this and it works fine.

John

the instructions show:


org 0
;clrf STATUS
clrf PCLATH
goto Main

or

org 0
;clrf STATUS
pagesel Main
goto Main

The web site says the PC Side will give a warning if the GOTO is wrong.

Did you try to send his sample?

JohnT,

Strange... take a look at bootloader code on tinybld16F.asm:

ORG first_address
nop
nop
nop
nop
org first_address+4
IntrareBootloader

And if you look deeper:

way_to_exit ;exit in all other cases; must be BANK0/1
;BANK0_
bcf RCSTA, SPEN ; deactivate UART
goto first_address

first_address is:
#define first_address max_flash-100 ; 100 word in size

So, what it does is: Loop forever into first_address while not
receiving the 0xC1 char.
In this case, you will need to put something like this in the end of
your program:

org max_flash-100 ; You will need to get max_flash value from
boot loader includes.
clrf PCLATH
pagesel MyStart
goto MyStart

And in the start, don't use an org 0x00.
I think that you need only setup the interrupt vector and after it
continue with you program. ex:

org 0x04
goto INT_HAND

MyStart:

LALALALA

INT_HAND:

LALLALAA

org max_flash-100 ; You will need to get max_flash value from
boot loader includes.
clrf PCLATH
pagesel MyStart
goto MyStart

Maybe you can use some #ifdefs using a def like #define USE_LOADER or
something, in order to compile with or withou initialization...

#ifndef USE_LOADER

org 0x00
clrf STATUS
movlw 0
movwf PCLATH
goto MyStart

#endif

I don't why examples don't consider this, maybe some mismatch docs
release... :)

Hope it helps.

- Diogo.

.



Relevant Pages