1 Log调试¶
1.1 Hcpu没有log出来¶
1,menuconfig→ RTOS → RT-Thread Kernel → Kernel Device Object→uart1 is configured as uart1;
2,menuconfig → RTOS → RT-Thread Components → Utilities→Enable ulog is turned on;
TIPS: You can input “/” in menuconfig to search for “ulog”;
3,Whether the configuration of UART1 in pinmux.c is correctly set as UART1 configuration, commonly BSP_ENABLE_QSPI3 is enabled;,如下图:
1.2 Lcpu没有log出来¶
如下配置后, 依然没有打印,
1,menuconfig→ RTOS → RT-Thread Kernel → Kernel Device Object→uart3 is configured as uart3;
2,menuconfig → RTOS → RT-Thread Components → Utilities→Enable ulog is turned on;
3,Ensure that in hcpu, menuconfig→ RTOS → RT-Thread Kernel → Kernel Device Object→uart1 is not configured as uart3 here, otherwise there will be a conflict;.
4, Ensure that in pinmux.c, the mode configuration of PB45 and PB46 for UART3 is correct, default configuration is correct;,如下:
HAL_PIN_Set(PAD_PB45, USART3_TXD, PIN_NOPULL, 0); // USART3 TX/SPI3_INT
HAL_PIN_Set(PAD_PB46, USART3_RXD, PIN_PULLUP, 0); // USART3 RX
其他原因1:
The project V0.9.9\example\rt_driver\project\ec-lb551 is used, the ble thread is not started, resulting in Lcpu program not being loaded;,
解决方案:
Open the ble thread or call the function lcpu_power_on() separately; start the code of lcpu;.
其他原因2:
example\multicore\ipc_queue\
example\pm\coremark\
These projects require sending the command lcpu on
in the HCPU console to start LCPU, after successful startup, the startup log can be seen on the LCPU console;
解决方案:
Under the corresponding project, there is a readme.txt file, you can refer to its content to send commands to open Lcpu;
1.3 代码中Print register;方法¶
Direct address read operation;:
static uint32_t pinmode19;
pinmode19= *(volatile uint32_t *)0x4004304c; //Read the value of register 0x4004304c;
uint32_t reg_printf= *(volatile uint32_t *)0x50016000; //Print the value of register 0x50016000;
rt_kprintf("0x50016000:0x%x\n",reg_printf);
Direct address write operation;:
#define _WWORD(reg,value) \
{ \
volatile uint32_t * p_reg=(uint32_t *) reg; \
*p_reg=value; \
}
_WWORD(0x40003050,0x200); //Write the value 0x00000200 to PA01 pinmux register;
Register definition read operation;:
rt_kprintf("hwp_hpsys_rcc->CFGR:0x%x\n",hwp_hpsys_rcc->CFGR);
uint32_t reg_printf= hwp_hpsys_rcc->CFGR; //Print register;
rt_kprintf("hwp_hpsys_rcc->CFGR:0x%x\n",reg_printf);
Register definition write operation;:
hwp_hpsys_rcc->CFGR = 0x40003050;//直接写值
MODIFY_REG(hwp_pmuc->LPSYS_SWR, PMUC_LPSYS_SWR_PSW_RET_Msk,
MAKE_REG_VAL(1, PMUC_LPSYS_SWR_PSW_RET_Msk, PMUC_LPSYS_SWR_PSW_RET_Pos)); //Only modify the value of PMUC_LPSYS_SWR_PSW_RET_Msk to 1, other places remain unchanged;;