Problems with jp instruction
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-02-26 1:04 AM
Posted on February 26, 2016 at 10:04
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 }
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-02-26 2:12 AM
Posted on February 26, 2016 at 11:12 Hello, I would say that in the cases where the jp ''does not work'' the actual code execution does not get there, so the problem is not with the jump itself but is before it (maybe some interrupt coming and never returning, or stuck in the eeprom routines..) not very helpful I'm afraid, but I don't think the problem is in the jump.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-03-01 8:25 AM
Posted on March 01, 2016 at 17:25
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