Hi,
I'm currently trying to get a serial bootloader running for the PIC24FJ1024GA606. The bootloader is based on AN1157 and has been running without issues on the PIC24FJ128GA204 we use in other projects for years.
I have modified linker scripts for both the bootloader and the app part. They are based on working examples of the PIC24FJ128GA204 but with PIC24FJ1024GA606 linker scripts.
I can successfully flash a combined hex onto the MCU and it runs through the bootloader and jumps to the app. The app runs as it should as long as I don't use interrupts. As soon as an ISR is triggered I get a reset, it then runs through the bootloader again, jumps to the app and then again resets when the ISR is called.
Project details:
- MCU runs in single partition mode
- no AIVT, no boot segment active
- App includes bootloader as loadable to create a combined hex
- XC16 v1.50
- MPLAB X v5.40
Some details for the bootloader part:
- Bootloader starts at 0x100 (original origin of the unmodified linker script) and ends at 0x1800-1 (length 0x1700)
- The app starts at 0x1800
- IVT is modified to point to a location in a jump table in app code (interrupt vector method 2 in AN1157)
- Compiler linker flag --no-ivt is set
Details for the app part:
- App program starts at 0x1800 which is the start of the jump table for the remapped IVT
- App itself starts at 0x1988 (just after table)
- I have a method that populates the jump table with gotos to the ISR handles (as suggested in AN1157)
- Compiler linker flag --no-ivt is set
I can't figure out why the MCU is reset when an ISR is called. The same principle for the linker scripts and IVT jump table is applied for the PIC24FJ128GA204 and there it works without issues.
I attached both linker scripts as well as the ISR handles file to this post. Any help is greatly appreciated.
Regards,
Jonas