2016-02-26 01:04 AM
We are using assembler code in our C-code. The jp instruction is used to jump into
the booloader. But sporadic the jp instruction is not working. We have also used jpf instruction. Without success. What can be the reason? if ( RequestJumpToBoot ) { u8 option_byte = 0; uart1SendTxData (''-> jump to BOOTLOADER'' ); // set option bit for bootload mode eepromReadAccess(EEPROM_BOOTLOADER_OPTION,1,&option_byte); option_byte |= BOOTLOAD_MODE; eepromWriteAccess(EEPROM_BOOTLOADER_OPTION,1,&option_byte); // disable all timers TIM1_DeInit(); TIM2_DeInit(); TIM4_DeInit(); _asm(''jp 0x8000\n''); // jump to bootloader }2016-02-26 02:12 AM
2016-03-01 08:25 AM
Hi there
Looks like you're trying to reset the processor by jumping directly the the reset vector. This could cause problems depending on any interrupts you still have enabled, and won't re-initialise the hardware. In my application I achieve a similar effect by executing an illegal opcode, which is guaranteed to cause a true hardware reset. I don't recall where I found it documented, but I use_asm(''dc.b 0x75\n'')
. Note that the optimiser sometimes removes this, so you may need to follow it by anop()
Hope this helpsBest regardsJonathan