From: CBFalconer on
*** Horrible confusing topposting fixed as a public service ***
JohnT wrote:
> RaceMouse wrote:
>> JohnT wrote:
>>> RaceMouse wrote:
>>>> JohnT wrote:
>>>>> RaceMouse wrote:
>>>>>> Pietje Bell wrote:
>>>>>>>
>>>>>>>> Has anyone manged to get the tiny bootloader from
>>>>>>>> http://www.etc.ugal.ro/cchiculita/software/picbootloader.htm
>>>>>>>> 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'sdone.
>>>>>>>>
>>>>>>>> I suspect this is the case as the bootloader software
>>>>>>>> detects the PIC straight away without the need for me to
>>>>>>>> reset the PIC.
>>>>>>>
>>>>>>> Does the bootloader needs to know where the application is
>>>>>>> programmed? (at what address)
>>>>>>
>>>>>> My best quess is that your PIC progam should start with
>>>>>> something like "ORG 0x100" or whatever the
>>>>>> "jump-to-application-address" is.
>>>>>
>>>>> 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?
>>>>
>>>> Can you post the souce code of you application ?
>>>
>>> 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.
>>
>> 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.
>
> I tried that already but with no success. The code I showed you
> is straight from an example that came with the bootloader.

Now it may be possible to read this and make some sense out of it.
You should never top-post; your answer belongs after (or intermixed
with) the material to which you reply, after snipping the portion
that is not germane to your reply. It takes only a moment (usually
just hit a page down key a few times) to arrive at the end.

See the links in my sig below.

In general a bootloader will load some sort of code into a fixed
beginning location, and then transfer control to that same fixed
location. The bootloader has to be very simple as it will usually
be resident in some sort of ROM. Once the control transfer is made
any further action is up to the loaded code, which may in turn do a
more complex load operation.

--
Some informative links:
news:news.announce.newusers
http://www.geocities.com/nnqweb/
http://www.catb.org/~esr/faqs/smart-questions.html
http://www.caliburn.nl/topposting.html
http://www.netmeister.org/news/learn2quote.html


From: Donald on
CBFalconer wrote:
>
> Now it may be possible to read this and make some sense out of it.
> You should never top-post; your answer belongs after (or intermixed

Thank You again Mother Falconer.

> with) the material to which you reply, after snipping the portion
> that is not germane to your reply. It takes only a moment (usually
> just hit a page down key a few times) to arrive at the end.
>
> See the links in my sig below.
>
> In general a bootloader will load some sort of code into a fixed
> beginning location, and then transfer control to that same fixed
> location. The bootloader has to be very simple as it will usually
> be resident in some sort of ROM. Once the control transfer is made
> any further action is up to the loaded code, which may in turn do a
> more complex load operation.
>
From: Stef Mientki on
JohnT wrote:
> I believe I am, I've started my program as it states in the
> documentation but it doesn't seem to get that far.
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
From: Neil on
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?
From: JohnT on
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?