Maybe you could do all of us a big favor and shed some light into the bootloader topic.
I was looking for a bootloader that works as universal as possible and support 16F877 and 18F8720. Found it, it's the one you also use: Tiny Pic Bootloader at http://www.ac.ugal.ro/staff/ckiku/software/picbootloader.htm
Would you please walk me through the following steps:
1. I need to modify the file tinybld16f.asm.
LIST P=16F876A, F=INHX8M ; change also: Configure->SelectDevice from Mplab
xtal EQU 20000000 ; you may also want to change: _HS_OSC _XT_OSC
baud EQU 115200 ; standard TinyBld baud rates: 115200 or 19200
; The above 3 lines can be changed and buid a bootloader for the desired frequency and PIC type
my modified file:
LIST P=16F877A, F=INHX8M ; (do I need to adjust the INHX8M?)
xtal EQU 20000000 ; 20 MHz is what I have
baud EQU 115200 ; 115200 is OK for me
Are there any other changes necessary in the tinybld16f.asm file?
As far as I understand, I need to build this file for 16F877A, although I use a 16F877. (On the Website it says, Tiny PIC bootloader was reported to work with 16F877.)
2. Next step would be to open MPLAB, change the target to PIC16F877A, open my modified tinybld16f.asm and project/quickbuild tinybld16f.asm. Then I enable my Picstart plus programmer, stick the 16F877 in and press the build button.
3. Now the big step: Using C2C compiler, apparently, we need to add the 4 lines to our main file (let's call it MAIN) in order to keep the bootloader working:
#pragma RESERVE_ADDR_0 clrf 0x3
#pragma RESERVE_ADDR_1 movlw 0x00
#pragma RESERVE_ADDR_2 movwf 0xA
#pragma RESERVE_ADDR_3 goto start__code
Now where exactly does this code go? First lines after the initial remark lines?
Right before / after any of these lines (taken from Interface to CompactFlash for PIC16F877 sample on the Picant site)?
#pragma CLOCK_FREQ 20000000
4. Compile, debug using C2C compiler. Result: MAIN.asm
Then build MAIN.ASM in MPLAB, result will be MAIN.hex
5. I re-insert the PIC, connect the serial cable via Max323 level converter chip to my PC and the PIC, then start tinybldWin.exe on my PC.
6. Next, I connect power to the PIC or reset it. If the settings are OK (Baudrate, COM port), tinybldWin.exe should detect the PIC, right?
7. Then I browse for "MAIN.hex" and press the Writeflash button
8. That should be it, right? After the next change of MAIN, I can loop directly to 4, I suppose?
So much for 16F877 and C2C compiler.
What about 18F8720 and BoostC?
Apparently, as you posted, one will have to make some changes in the source code of Tiny PIC Bootloader, as Andrew (Asmallri) suggests:
"What you are describing is a bootloader bug. I have a roll your own bootloader which places the users reset vector contents into high memory. When the bootloader passes control to the application program it jumps to code immediately prior to the users remapped reset vector in high memory. This code resets the page select bits to their reset defaults and then flows into the reset vector code. The users code will then run unmodified which means you do not need to add the "bootloader fixup" you have described. "
What exactly would I have to do to implement these changes?
Hollie, I would appreciate your help very much.