ST意法半导体
直播中

李泽明

7年用户 1186经验值
私信 关注
[问答]

jp指令不起作用

我们在C代码中使用汇编代码。 jp指令用于跳转

booloader。但零星的jp指令不起作用。我们还使用了jpf指令。没有成功。可能是什么原因?

if(RequestJumpToBoot)
{
u8 option_byte = 0;
uart1SendTxData('' - >跳转到BOOTLOADER'');

//为引导加载模式设置选项位
eepromReadAccess(EEPROM_BOOTLOADER_OPTION,1,&安培; option_byte);
option_byte | = BOOTLOAD_MODE;
eepromWriteAccess(EEPROM_BOOTLOADER_OPTION,1,&安培; option_byte);

//禁用所有计时器
TIM1_DeInit();
TIM2_DeInit();
TIM4_DeInit();

_asm(''jp 0x8000  n''); //跳转到bootloader
}

以上来自于谷歌翻译


以下为原文




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 0x8000n'');        // jump to bootloader
   }

回帖(1)

王雷

2019-3-28 11:07:18
你好
 
 
看起来你试图通过直接跳转复位向量来重置处理器。这可能会导致问题,具体取决于您仍然启用的任何中断,并且不会重新初始化硬件。在我的应用程序中,我通过执行非法操作码来实现类似的效果,这保证会导致真正的硬件重置。我不记得我发现它记录在哪里,但我使用_asm(''dc.b 0x75  n'')
 。请注意,优化器有时会删除它,因此您可能需要通过nop()来关注它
 
 
希望这可以帮助
 
最好的祝福
 
乔纳森

以上来自于谷歌翻译


以下为原文





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 0x75n'')
. Note that the optimiser sometimes removes this, so you may need to follow it by a nop()
  

Hope this helps

Best regards

Jonathan
举报

更多回帖

发帖
×
20
完善资料,
赚取积分