cbatters
Reged: May 17 2004
Posts: 27
|
|
Quote:
Hello. Regarding the V3.01 bootloader.
I've implemented your bootloader on a PIC16F876.
How does the bootloader know where the downloaded programs "main" routine is? I'm a bit of a novice programmer, and I've spent the better part of the week trying to figure it out, without any avail. I've managed to get the bootloader itself working nicely, other than some comms issues with XON/XOFF flow control. However, I would like to know if and how the bootloader knows where to point PCL to the main routine of the downloaded firmware.
Thanks
Good idea to do a little more reading about bootloader and how it works...
Bootloader vector is always at 0000. The bootloader captures the users start vector code (0000-0003) during the download and transfers control if there is no pending download on the next reset.
Clint
|
Makya
Reged: May 16 2006
Posts: 1
Loc: Canada
|
|
Hello,
I am new to the bootloader "thing" I have read your readme files. looked over your .H & .C files
I changed the FOSC to 10 Mhz to match the crystal I am using.. After programming (MPLAB & PICSTART PLUS) With hyperterminal settings of Baude 9600 Data 8 Parity NONE Stop 1 XON/XOFF
I just get garbage on the screen.. I have another program that uses the serial.h file with the same settings (- XON/XOFF)
Any ideas on what is not correct..
Thanks
EDIT:
I managed to get it working and the sample program loaded :P
I was trying different things with the loader
Going from my larger program back to the small sample program...
From small program -> LARGE program it seems to work fine but
LARGE program -> small program it doesn't want to overwrite it??
Any ideas guys
Edited by Makya (Fri Mar 23 2007 07:46 PM)
|
betran
stranger
Reged: Jan 22 2009
Posts: 3
|
|
This thread is very informative and clear, I was looking at some sample implementation of a bootloader and this does half of my job.I have few questions.
1.) I will be using I2C protocol to transmit the updated program to the boot loader. whether a slave implementation will do or I need to have a master code as well. 2.) I hope the boot loader should wait for an I2C request till the countdown time expires, if not jump to the current program.
3.) I am using PIC16F886, whether the configuration settings with tiny-BL compatible for the same.
|
betran
stranger
Reged: Jan 22 2009
Posts: 3
|
|
hi,
Can you please tell me what modificaions has to be done on 3.11 to work on pic16F88x, I am using Pic16F886. I tried with 3.11 on my pic it didnt work.Downloading is happening properly through hyperterminal but after reset its still in the bootloader.
betran
|
Tomsic
stranger
Reged: Sep 01 2008
Posts: 11
|
|
There's nothing going out at the transmission line. What do I have to configure to have some output?
I discovered that there's anything wrong with the main function by using code folding. I am not able to use the folding for the main function. there seem to be some misplaced brackets.
Edited by Tomsic (Fri Mar 27 2009 07:12 AM)
|
Tomsic
stranger
Reged: Sep 01 2008
Posts: 11
|
|
Am I the only one with this issue?
|
Tomsic
stranger
Reged: Sep 01 2008
Posts: 11
|
|
Okay, now I figured it out what's concerning the brackets. There's no error, MPLAB isn't able to make correct code folding. The config bits were always set to RC. I manually added XT to the configs in line 23/25 of bootldr.c and now everything works.
Edited by Tomsic (Mon Mar 30 2009 08:25 AM)
|
Tomsic
stranger
Reged: Sep 01 2008
Posts: 11
|
|
I wanted to download a little test program now. What protocol do I have to chose in hyperterminal? When chosing xmodem and pressing send there's no transmission. It hangs at "0k from 1k". Is it in the test program or am I doing anything else wrong? --runtime=+download --rom=0-1EFF is added to the build options of the test program, XON/OFF ist switched on in hyperterminal.
|
Tenson
newbie
Reged: Jul 20 2008
Posts: 49
|
|
Quote:
Quote:
1) With reference to the above discussion, why can't a bootloader be in the first page, but above the interrupt vector, with the reset vector still jumping to the bootloader?
I tried to explain the problem above, but perhaps it's not clear. Try again:
The problem with putting the bootloader at the start of program memory is that you will have to insert some instructions at address 0x4 to redirect the interrupt to your downloaded program. This can be done, but the problem occurs when code of your application is executing in a page other than page 0, and an interrupt occurs. When the interrupt occurs, the hardware vectors to address 0x4 - but PCLATH is still pointing to where it vectored from. The instructions needed to jump to the applications interrupt code will need to modify PCLATH. When the inerrupt vector returns, it returns elsewhere because PCLATH was changed. The next logical step is to save the state of PCLATH before jumping. This can work, but means you'll need to add code to the application's interrupt vector so that it restores PCLATH prior to the return. This can all be done, but you end up with code that has special chunks of assembly in the bootloader and the downloaded application. It also adds to the latency of the interrupt vector because of this save and jump.
Quote:
2) Are there any likely difficulties in compiling the bootloader to high memory as a function other than main, and redirecting the reset vector to it, but also calling it from the main program under the appropriate circumstance?
That should work fine.
Hello,
I'm trying to do bootloader of my own for PIC18F2455 and I need interrupts in bootloader and firmware.
The bootloader code is positioned at 0x0000 and firmware at 0x4000. Before jump to firmware is made, interrupts are disabled and flag Code:
move_int_vector is changed to 1.
The code I'm using for interrupt handling in bootloader is as follows: Code:
static vuint8 move_int_vector @ 0x0; static vuint8 pclath_tmp1 @ 0x1;
void interrupt hi_priority_handler(void) { if(!move_int_vector) { timer_isr(); } else { pclath_tmp1 = PCLATH; GOTO(FW_INTERRUPT_VECTOR_HI); } }
Code used in firmware is as follows: Code:
static vuint8 move_int_vector @ 0x0; static vuint8 pclath_tmp1 @ 0x1;
void interrupt hi_priority_handler(void) { timer_isr(); PCLATH = pclath_tmp1; }
However firmware crashes as soon as started, although bootloader was working normally.
The firmware works normally if no interrupts are used (I ve done some tests and bootloader correctly writes / starts firmware).
I've gone several times trough code you've provided (bootloader v2) and read the upper text regarding PCLATH...
It's been trying to do this on my own but I just can't get through 
I'm not sure what I'm doing wrong here??
Best regards,
|
Neil_K
 
Reged: Mar 09 2005
Posts: 956
Loc: NY,USA
|
|
Look at the PIC18 sample bootloader that came with the compiler.
|