You get something wrong, probably because my bad English
Constant BLOCK_SIZE is defined in microchip MPLAB, and doesn't have anything with PBP. So PBP compiler won't be aware of BLOCK_SIZE and will throw an error.
(And I can't remember where I found it, I think it was used in some PBP lib file)
[EDIT]BLOCK_SIZE is defined in includes that are located at PBP3\DEVICES. But this is ASM level include as far as I know. It is just added to .lst file after compiling. So compiler isn't aware of this file.[/EDIT]
But if you use it in ASM, compiler will just forward your ASM line to .LST file. And .LST file will be assembled into ASM and then in HEX file.
So to be clear(or try to be), BLOCK_SIZE is in assembler include, BlockSize is any variable in PBP preferably in BANKA.
There is two way, one I used is to move constant to variable in ASM, and other is similar to yours, but you must use EXT to tell PBP compiler that your constant is declared somewhere else, but assembler can reach it.
That should look like this
BLOCK_SIZE CON EXT
BlockSize VAR BYTE
BlockSize=BLOCK_SIZE
But then you don't need variable BlockSize, because you can use constant BLOCK_SIZE.
I didn't try this, I just know what I learned from Darrel's post about EXT.
To pass variable from main app to bootloader, variable doesn't have to be in any specific bank, it must be at specific address.
In main app:
VarAtAdr50 VAR BYTE 50 'This is variable declared at decimal address 50
....
VarAtAdr50=10
GOTO StartBootloader
In Bootloader:
VarAtAdr50 VAR BYTE 50
If VarAtAdr50=10 THEN ....
I hope that this clears things, if not can somebody else try to explain it better? Thanks, in advance.





Bookmarks