Are you just converting the exsisting serial bootloader over to PBP? I had thought you were going to make a new bootloader from scratch in pure PBP.
Are you just converting the exsisting serial bootloader over to PBP? I had thought you were going to make a new bootloader from scratch in pure PBP.
The goal is a new one using pure PBP. To get me started, I am attempting to convert the existing Microchip serial one, AN851. For me this does 2 things, it has shown me just how the guts of the BL work, and I thought by starting there, we are able to test the GUI with it.
To that end, I do have a much better feel for how they work, at least this one. So we can make this work and build onto it, or start over with a completly new one. No matter to me![]()
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
If you want to get the code to compile, rem the first 2 @org's. change the last to to 800 and 808. These need to be changed anyway as I think they were not far enough in memory.
I have been digesting what Steve has pointed to. My understanding is this: I need to let PBP take care of memory!! The first @ORG is un-needed as PBP will place the code at 00 anyway. So that just needs to be deleted. I think the for the interrupt redirect, we just need a
then in our application code:Code:DEFINE INTHAND NewIntLocation
So if I am correct, the only thing left is context saving in the real interrupt vector before jumping.Code:DEFINE RESET_ORG 800 GOTO Start ' or whatever you favorite label is NewIntLocation: Do your Interrupt thing Start: Code till your hearts content, (or MEM is full)
Now as for the rest of the code, I need some help here. I have a crazy mix of PBP commands and direct register addressing. I want to get rid of the direct addressing. This is really bad in the comm part. Do we want to use HSERIN/OUT or SERIN/OUT. I think using SER would be nicer in the aspect we can then use any pins to do this, and have control over true vs inverted signals. It will also be a trivial matter to use I2C instead of SER using the bit-bang approach.
Let me just throw in my opinion here, speed is NOT the issue. This is a bootloader, It will not be used often once your app is done.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
I need to create bootloader for PIC18F that program flash from external I2C memory, eg 24lc512.
I'll probably write bootloader in pbp and asm.
If I understand correctly how bootloader works, there is 2 ways to implement bootloader.
-One is to make bootloader that sits on beginning of flash, then on address 4 and 8, need to be GOTO to new int vector. That will add one more GOTO before executing int, PBP already add one. I don't like that GOTO's.
-Other option is that first instruction in flash is GOTO Bootloader, and to put bootloader on end of flash. Then there is no need to remap interrupt. When bootloader finish job, then GOTO 1
In main program only need to remap reset vector to 1.
Am I understand how it works?
For now I'll create LED blink program, that use bootloader with reset vector at 1.
And then try to make bootloader that will program that hex to flash. For start hex will be in LOOKUP2, until I get flesh erase and write to work, then comunication...
Probably I should start with analyzing syntax of hex file.
Is there anyone interested and willing to help?
Edit timeout...
Address for int are 8 and 24, and GOTO takes 2 program word so, reset org should be 4.
Is there way to move RESET_ORG to other address, without moving interrupt vector?
DEFINE RESET_ORG 004h also move vectors. In .LST file interrupt vector are defined as RESET_ORG+8h or 18h.
DEFINE LOADER_USED 1 doesn't do anything. I'm looking in disassembled hex file...
This is test code:
Code:DEFINE NO_CLRWDT 1 DEFINE LOADER_USED 1 DEFINE INTHAND myint ' Define interrupt handler DEFINE INTLHAND myint ' Define interrupt handler Start: PORTD.6=1 PORTD.6=0 GOTO Start @myint bcf PORTB,1
Also I noticed that with or without NO_CLRWDT 1, there is no CLRWDT in hex file.
I have VERY limitted knowledge in this area, but can't you set config fuses from the programmer?
(NO_CLRWDT is a config fuse right?)
If input to the programmer is the hex file, wouldn't that mean that fuses are handled separately than the hex file?
Robert
Last edited by Demon; - 10th March 2014 at 23:20.
Bookmarks