1.概述 为实现RA进入Deep software standby mode 后能保持Jlink仿真连接,唤醒DS(Deep software standby mode)后芯片复位也能保持Jlink仿真。本文档是基于RA4M2芯片做测试实现。(理论上RA所有芯片都通用)
2.配置说明
根据芯片手册文档说明是支持Deep Software Standby mode仿真的,需要做一些配置,并且Jlink也需要配置打开Low Power Debug,Jlink仿真的Low Power Debug默认是关闭的,需要做一些配置。
下图为芯片手册说明(详细的配置寄存器请自行看手册):
下图为Jlink文档上边的Low Power Debugging说明(我们是属于文档中介绍的第4种模式):
由上总结需要通过IAR链接配置Jlink script file 跟Jlink setting file。
Jlink script file 内容如下图所示(需要自行新建.JLinkScript 文件放IAR工程目录下边):
void clear_DBIRQ( void ) { JLINK_CORESIGHT_WriteDP( 2, ( 1 << 24 ) | ( 0 << 4 ) ); // Select AP[1], bank 0 JLINK_CORESIGHT_WriteAP( 0, ( 0 ) | ( 2 << 0 ) | ( 1 << 31 ) ); // AP-access size. Fixed to 2: 32-bit // Enable software access to the Debug APB bus. JLINK_CORESIGHT_WriteAP(1, 0x80000410); //MCUCTRL register JLINK_CORESIGHT_WriteAP( 3, 0x00000000 ); //Clear DBIRQ bit JLINK_MEM_WriteU16( 0x4001E3FE, 0xA502 ); // PRCR register. Enable access to SYOCDCR register JLINK_MEM_WriteU8( 0x4001E40E, 0x80 ); // SYOCDR register, set DBGEN bit JLINK_MEM_WriteU8(0x4001E407, 0x00); // SYOCDR register, set DBGEN bit JLINK_MEM_WriteU16( 0x4001E3FE, 0xA500 ); // PRCR register. Disable access to SYOCDCR register } void InitTarget( void ) { clear_DBIRQ(); } Void SetupTarget( void ) { clear_DBIRQ(); } int InitEMU(void) { JLINK_ExecCommand("EnableLowPowerHandlingMode"); return 0; }
Jlink setting file文件配置如下图所示(文件所在目录为IAR工程下边的settings\工程名_Debug.jlink)
[BREAKPOINTS] ForceImpTypeAny = 0 ShowInfoWin = 1 EnableFlashBP = 2 BPDuringExecution = 0 [CFI] CFISize = 0x00 CFIAddr = 0x00 [CPU] MonModeVTableAddr = 0xFFFFFFFF MonModeDebug = 0 MaxNumAPs = 0 LowPowerHandlingMode = 1 OverrideMemMap = 0 AllowSimulation = 1 ScriptFile="" [FLASH] EraseType = 0x00 CacheExcludeSize = 0x00 CacheExcludeAddr = 0x00 MinNumBytesFlashDL = 0 SkipProgOnCRCMatch = 1 VerifyDownload = 1 AllowCaching = 1 EnableFlashDL = 2 Override = 0 Device="ARM7" [GENERAL] WorkRAMSize = 0x3000 WorkRAMAddr = 0x2000 D000RAMUsageLimit = 0x00 [SWO] SWOLogFile="" [MEM] RdOverrideOrMask = 0x00 RdOverrideAndMask = 0xFFFFFFFF RdOverrideAddr = 0xFFFFFFFF WrOverrideOrMask = 0x00 WrOverrideAndMask = 0xFFFFFFFF WrOverrideAddr = 0xFFFFFFFF
IAR 需要增加调用.JLinkScript文件命令,如下图所示(命令:--jlink_script_file=$PROJ_DIR$/DS_MODE_debug.JLinkScript):
配置好后就可以仿真低功耗了。注意:仿真状态下的功耗并无参考价值,如需实际需脱机测试。
|