Tiny Bootloader

Hi All,

Has anyone manged to get the tiny bootloader from

formatting link
working?

I have a 16F877A with a 4MHz crystal. I modified the frequency in the software and downloaded it with no problem. Running the software it discovers the PIC with no problem.

However, I tried to create a simple program in assembler that would turn on all the outputs of Port B. I know my program works fine as I've downloaded it using a programmer. However, when I download it using the bootloader nothing happens. It appears that the PIC is 'stuck' in the bootloader section and not jumping to my code when it's done.

I suspect this is the case as the bootloader software detects the PIC straight away without the need for me to reset the PIC.

Any ideas anyone?

John

Reply to
JohnT
Loading thread data ...

Does the bootloader needs to know where the application is programmed? (at what address)

-------- Origineel bericht --------

Reply to
Pietje Bell

Greetings

First: You don't download _TO_ something. you upload _TO_ a device ! (I really couldn't help it :-) )

Second : Have you made sure that you application program starts at the same address as the booloader jumps to when it does not receive a char from the PC ?

/RaceMouse

Reply to
RaceMouse

You'd have no idea how many arguments I've had about this. I agree with what you just said, but I've never been able to convince anyone else of this. It is common parlance that programming a chip is "downloading to" that chip.

Reply to
larwe

My best quess is that your PIC progam should start with something like "ORG 0x100" or whatever the "jump-to-application-address" is.

/RaceMouse

Reply to
RaceMouse

As long as you agree with me you're doing fine :-)

The only way to change this "common parlance" is to use the correct terms. Agree ?

-maybe the discussion belongs in an other thread but ...

/RaceMouse

Reply to
RaceMouse

Thanks for the response.

Firstly, my background is in PLC's and the various pieces of software I use 'download to the PLC' or 'upload from the PLC'

Secondly, the bootloader I'm trying to should move the 'goto' instruction that you need to put in the first four lines of code to the start of the bootloader code. This leaves the start of memory as the bootloader set it, i.e. jump to the bootloader routine. After it has executed the bootloader routine, it jumps to just before the bootloader and should find the address of where to go next, i.e. the 'goto' instruction in my code. If you look at the web address of my initial query there is a nice picture showing what I've just tried to explain.

The download program that is on that website must modify the hex file, find the 'goto' instruction in the first four lines and overwrite that line of the bootloader.

I can't think how to test it though, has anyone else used a bootloader successfully?

John

RaceMouse wrote:

Reply to
JohnT

Hmmm...

Can you post the souce code of you application ?

/RaceMouse

Reply to
RaceMouse

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

RaceMouse wrote:

Reply to
JohnT

Ok. It seems to me that you have 5 instructions within the first four program counts. Your Interrupt vector starts at 0x04 but your startup code ends at 0x05.

My suggestion: ORG 0x00 ; Start of the program CLRF STATUS CLRF PCLATH GOTO INIT

Please report back.

/RaceMouse

Reply to
RaceMouse

I tried that already but with no success. The code I showed you is straight from an example that came with the bootloader.

RaceMouse wrote:

Reply to
JohnT

Are you linking your application code for the correct address? The memory map should comply with the bootloader requirements.

Reply to
Pietje Bell

I believe I am, I've started my program as it states in the documentation but it doesn't seem to get that far.

Pietje Bell wrote:

Reply to
JohnT

Can you merge the two hex files (the bootloader and you application) and run it in a simulator ?

/RaceMouse

Reply to
RaceMouse

And I just saw I was wrong 'cause "ORG" is a directive. Not an instruction :-)

/RaceMouse

Reply to
RaceMouse

No, you must start with a long jump !!

The Tiny bootloader is working perfectly, I used it for many PIC types, and it always worked perfect.

And how to program a long jump,... ... sorry I don't know, JAL is doing it for me ;-)

And if you also don't know how to program a long jump, you should really take a look at some High Level Language (JAL perhaps).

For the other discussion, I fully agree, that's why I called my program UPD (Uploader Programmer Debugger) ;-)

cheers, Stef

Reply to
Stef Mientki

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.