Open
Description
Hi,
I've been using your linker bootloader linker file (Thank you :) )but I found that the interrupts didn't working. I eventually found that it was the generation of the app interrupt map where the address of the interrupt handler was not masked, such that if the address was over 0xFFFF it would change the GOTO opcode.
Original code (pic24fj256da210-bootloader.gld): -
define INTERRUPT(X) LONG(DEFINED(##X)? (0x040000 | ABSOLUTE(##X)) : 0x040000 | ABSOLUTE(__DefaultInterrupt)); \
LONG(DEFINED(__##X)? (ABSOLUTE(__##X) >> 16) & 0x7f : (ABSOLUTE(__DefaultInterrupt) >> 16) & 0x7f);
Adjust code with bit mask: -
define INTERRUPT(X) LONG(DEFINED(##X)? (0x040000 | (ABSOLUTE(##X) & 0xFFFF)) : 0x040000 | (ABSOLUTE(__DefaultInterrupt) & 0xFFFF)); \
LONG(DEFINED(__##X)? (ABSOLUTE(__##X) >> 16) & 0x7f : (ABSOLUTE(__DefaultInterrupt) >> 16) & 0x7f);
Metadata
Metadata
Assignees
Labels
No labels