闪退问题可能和公司系统有关系,没有解决,后面自己写上位机了。但是还有其他问题,就是跳转到app后可以运行(串口有调试输出),但是中断用不了了,boot中有设置app的中断向量,不知道什么原因,楼主你知道这是什么问题吗?
boot中设置了中断向量:
// To be device independent, these are set by mcc in memory.h
#define LAST_WORD_MASK (WRITE_FLASH_BLOCKSIZE - 1)
#define NEW_RESET_VECTOR 0x1000
#define NEW_INTERRUPT_VECTOR 0x1004
#define APPLICATION_SIZE_WORDS (END_FLASH - NEW_RESET_VECTOR)
#define CRC_RESERVED_WORDS 1U
#define CRC_RESERVED_BYTES 2U
#define FLASH_CHECK_ADDR_CRC (END_FLASH - CRC_RESERVED_WORDS)
#define _str(x) #x
#define str(x) _str(x)
// *****************************************************************************
// The bootloader code does not use any interrupts.
// However, the application code may use interrupts.
// The interrupt vector on a PIC16F is located at
// address 0x0004.
// The following function will be located
// at the interrupt vector and will contain a jump to
// the new application interrupt vector
asm("psect intentry,global,class=CODE,delta=2");
asm("pagesel " str(NEW_INTERRUPT_VECTOR));
asm("GOTO " str(NEW_INTERRUPT_VECTOR));
application中一使能全局中断,就导致复位:
// Enable the Global Interrupts
INTERRUPT_GlobalInterruptEnable();
// Enable the Peripheral Interrupts
INTERRUPT_PeripheralInterruptEnable(); |