Skip to content

Interrupts not working #1

Open
Open
@LeeCrowther

Description

@LeeCrowther

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions