Microchip
直播中

胡少莹

8年用户 226经验值
私信 关注
[问答]

在crt0.s中应该放置代码以便从睡眠中唤醒

您好,在crt0.S中,我应该放置//以下代码片段在“C”启动代码//的开头,以查找来自睡眠的唤醒是否是由于WDtif(RCON&0x18)//WDT导致来自睡眠的唤醒{asm volatile(“eret”);//根据数据从中断返回}当我醒来的时候,我的WDT超时?善待本

以上来自于百度翻译


      以下为原文

    Hi All
where in the crt0.S should I put
// The following code fragment is at the beginning of the ‘C’ start-up code
// to find whether the wake from Sleep is due to the WDT
if ( RCON & 0x18 ) // The WDT caused a wake from Sleep
{
asm volatile( “eret” ); // return from interrupt
}

as per the datasheet when I wake up from sleep when my WDT timeout?
Kind regards
Ben

回帖(1)

吕聪

2019-5-24 15:09:14
我认为,在文档中,省电模式只是让您知道如何处理看门狗超时NMI。如果有NMI,根据CRT0S,进程将被重定向到JNMIHAL处理程序,它已经通过XC32以弱版本实现。源是ATPIC32 LIBS/LIBPIC32/存根/默认NMI处理程序.S。所以基本上不需要做任何事情,除非您想处理WDT信息或清除RCON。如果您想拥有自己的版本的NMIIHANTHER,您可以只写一个C函数,比如“Valuy NmithHuffer-[Value]”来处理。S的信息,你也可以把原来的弱版本的nmil处理程序的ASM代码放在你的函数中。XC32 C/C++编译器的用户指南也有一些关于NMI和JNMIH-HANDLE的信息。

以上来自于百度翻译


      以下为原文

    I think in the document, Power-Saving Modes, just gives you an idea of how to handle a Watchdog Timeout NMI.
 
If there is an NMI, according to crt0.S, the process will be redirected to the _nmi_handler, it's already implemented in a weak version by XC32.  The source is at pic32-libs/libpic32/stubs/default-nmi-handler.S.  So basically you don't need to do anything unless you want to process the WDT information or clear the RCON.
 
If you want to have your own version of _nmi_handler, you can just write a C function like "void _nmi_handler(void)" to process the information, you may also put the original weak version _nmi_handler asm code within your function.
 
the XC32 C/C++ Compiler User's Guide also has some information about NMI and _nmi_handler.
举报

更多回帖

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