This one compiles up to MPASM part, then PLENTY of overwrite errors.
BTW, is it odd we can't attach .PBP files?
This one compiles up to MPASM part, then PLENTY of overwrite errors.
BTW, is it odd we can't attach .PBP files?
-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!
Hint: ASM ORG & PBP (see mostcompilers) are poor bedfellows when you don't know why and how they interract.
Plausible solution, compile without ORG, use the HEX to get the ASM code, then add some ORG & GOTO, recompile the asm and try to make it work
Still Plausible: Hack a .LIB and or .INC to use Labels in your Bootloader code instead of ORG.
Lots of possibilities, my favourites being 100% pure ASM.
Last edited by mister_e; - 6th March 2011 at 22:17.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Well I must admit not knowing. I know it makes no sense to use it in this way, I know PBP won't be paying attention to it, therefore probable conflicts will arrise.
This sounds like a quick fix not in line with the intention of this project.Plausible solution, compile without ORG, use the HEX to get the ASM code, then add some ORG & GOTO, recompile the asm and try to make it work![]()
If we can have the hack as part of the "package" maybe. Right now it seems more then too much to ask folks to rem out config linesStill Plausible: Hack a .LIB and or .INC to use Labels in your Bootloader code instead of ORG.
we already have that. The purpose here is to try and make a PBP bootloader, for all to use and abuse.Lots of possibilities, my favourites being 100% pure ASM.
Thanks for pointing in the direction of the first of many (maybe) problems. I feel like I saw something in the PBP bible about defining code locations, but it is at work![]()
-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!
Well, there's an easy alternative. Compile your bootloader without ORG, see how much code space it needs. Once you know it, add an ORG at the END of your bootloader + Label. Your bootloader must jump to this Label when it exit.
Now when you want to use the bootloader, in your application code you need to use DEFINE RESET_ORG... and Period.Code:'bootloader code here Goto GetOutOfHere @ ORG WhateverYouDecide GetOutOfHere:
Now go figure how interrupt will work and how to integrate it, have fun!Code:DEFINE RESET_ORG WhateverYouDecide ' and your application code goes there
http://www.picbasic.co.uk/forum/show...1662#post31662
Readme.txt:
ORG Define
It may sometimes be useful to move the start of the generated code to a
location other than 0. This can be used to move the program code beyond
a boot loader, for example. A Define has been added to the compiler to
allow a different reset address to be specified for the 14-bit core PIC
MCUs and the PIC18 parts.
Define RESET_ORG 100h
This Define moves the starting location of the program, the reset vector,
to the specified address. The interrupt vector(s) follow at their usual
offset, followed by the library and program code.
For 14-bit core devices with more than 2K of code space, only interrupts
in assembler may be used. On Interrupt will not work properly if the
device has more than 2K of code space and RESET_ORG is not 0. For
assembler interrupts in a device with more than 2K of code space and
RESET_ORG something other than 0, the values of W, STATUS and PCLATH must
be saved by whatever program now resides at the PIC MCU's fixed vector
locations before the jump to the new vector location. In general, the
save locations are named wsave, ssave and psave. The information on these
save locations should be provided with the boot loader or whatever program
requires the altered origination so that the register values may be restored
at the end of interrupt processing.
For 14-bit enhanced core devices with more than 2K of code space,
On Interrupt may be used but the values of W, STATUS and PCLATH must not be
changed to get to the interrupt vector as they will not be restored upon
return from the interrupt. This usually means bra will be used to jump to
the new interrupt vector location. Interrupts in assembler do not require
any special treatment.
Either 14-bit core PBP library must fit into the first 2K of code space.
The PIC18 PBP library must fit into the first 32K of code space. It is best
for RESET_ORG to start on an even 256 word boundary.
Last edited by mister_e; - 7th March 2011 at 05:05. Reason: link
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
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!
Bookmarks