I have a need to redirect the standard interrupt vector at location 0x0008 to another memory location (0x1008) where a separately compiled interrupt routine lives.
I have tried to use an inline assembly patch
asm org 0x0008
goto 0x1008
This results in the GCB assembler complaining about location 0x0008 being redefined.
I do not want to hand patch the assembly file each time and assemble separately.
Is there another way to achieve this goal?
Peter.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Some code like this should work in the bootloader:
SubInterruptgoto0x1008EndSub
Any code placed in a subroutine called Interrupt will be placed at the interrupt vector, or at least jumped to directly from it. GCBASIC will add any On Interrupt handlers to the start of the sub, and will also add context saving and restoring code. The context saving and restoring would be a problem with what you're aiming for, because both the bootloader and the application code would save and restore. That would end up corrupting W, STATUS, and maybe other stuff.
To avoid that, I've added a new option to the compiler:
#option NoContextSave
This will prevent any context save/restore code being added. With the new build of the compiler, you can add that to the bootloader code and it will prevent anything being done except for jumping straight to the application code. Note that this means you need to be very careful in the bootloader interrupt routine - don't copy any values anywhere because that will probably corrupt the W register.
Peter, you should have an email with the updated compiler. Others, I've also checked the source into SVN, and will put a new exe out soon. The new compiler will also require tweaked chip data files to work properly with some AVR chips, these are coming but aren't quite ready yet. It will be in the next Hot Release.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After my first quick compile of my test code, I get an error SYSINTOFFCOUNT not defined.
Early in my code I disable interrupts (a force of habit just to be sure they are off). I think this might result in the requirement to use SYSINTOFFCOUNT which I can only assume has been deleted by the new option switch.
Peter.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a need to redirect the standard interrupt vector at location 0x0008 to another memory location (0x1008) where a separately compiled interrupt routine lives.
I have tried to use an inline assembly patch
asm org 0x0008
goto 0x1008
This results in the GCB assembler complaining about location 0x0008 being redefined.
I do not want to hand patch the assembly file each time and assemble separately.
Is there another way to achieve this goal?
Peter.
Which chipset?
Sorry. PIC18F26k22.
I had a workaround for the 16f.
@Hugh... Help us Obe-One.
Hugh, Any brilliant revelations?
Some code like this should work in the bootloader:
Any code placed in a subroutine called Interrupt will be placed at the interrupt vector, or at least jumped to directly from it. GCBASIC will add any On Interrupt handlers to the start of the sub, and will also add context saving and restoring code. The context saving and restoring would be a problem with what you're aiming for, because both the bootloader and the application code would save and restore. That would end up corrupting W, STATUS, and maybe other stuff.
To avoid that, I've added a new option to the compiler:
This will prevent any context save/restore code being added. With the new build of the compiler, you can add that to the bootloader code and it will prevent anything being done except for jumping straight to the application code. Note that this means you need to be very careful in the bootloader interrupt routine - don't copy any values anywhere because that will probably corrupt the W register.
Peter, you should have an email with the updated compiler. Others, I've also checked the source into SVN, and will put a new exe out soon. The new compiler will also require tweaked chip data files to work properly with some AVR chips, these are coming but aren't quite ready yet. It will be in the next Hot Release.
After my first quick compile of my test code, I get an error SYSINTOFFCOUNT not defined.
Early in my code I disable interrupts (a force of habit just to be sure they are off). I think this might result in the requirement to use SYSINTOFFCOUNT which I can only assume has been deleted by the new option switch.
Peter.
Post code, dat file as a zip. Please.