(1)移植 ① 添加文件到工程中:将开源库中(cm_backtrace)目录拷贝复制到自己工程目录下。 ② 添加源码文件: ③ 添加头文件路径 ④ 添加所需宏定义(USE_FULL_ASSERT) (2)使用 ① 配置 ② 屏蔽函数重复定义(HardFault_Handler) 由于我们在移植时直接使用了汇编文件(cmb_fault.S),该文件在故障时会自动进行HardFau...
/* Uncomment the line below to expanse the "assert_param" macro in the Standard Peripheral Library drivers code */ /* #define USE_FULL_ASSERT 1 */ /* Exported macro ---*/ #ifdef USE_FULL_ASSERT /** * @brief The assert_param macro is used for function's parameters check. * @param...
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK) { Error_Handler(); } } void Error_Handler(void) { __disable_irq(); while (1); } #ifdef USE_FULL_ASSERT void assert_failed(uint8_t* file, uint32_t line) { while (1); } #endifmain...
#ifdef USE_FULL_ASSERT void assert_failed(uint8_t* file, uint32_t line) { /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* Infinite loop */ while (1) { } } ...
UART_HandleTypeDef huart1;static uint8_t uart_data;#ifdef USE_FULL_ASSERT void assert_failed(...
#ifdef USE_FULL_ASSERT void assert_failed(uint8_t* file, uint32_t line) { while (1) { } } #endif 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26.
=LL_RCC_SYS_CLKSOURCE_STATUS_HSISYS){}// 设置APB1时钟LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);LL_Init1msTick(8000000);// 设置系统时钟LL_SetSystemCoreClock(8000000);}voidError_Handler(void){while(1){}}#ifdef USE_FULL_ASSERTvoidassert_failed(uint8_t*file,uint32_tline){while(1){}...
#ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source ...
1.ARM映像文件 ARM映像文件是一个层次性结构的文件,其中包含了域(region)、输出段(output section)...
idorrnonentsFmjzt Co*p朋坤* |Foldri/ExteiBSRR = 0x00000005;/* Reset PD0 and PD2 */ GPI OD-BRR = 0x00000005; #ifdefUSE_FULL_ASSERT void assert_failed(ui nt8_t* file, ui nt32_t line while (1 #en dif 19.这次编译可以看出,已经成功了。这样一个工程模版建立完毕。下面还需要配置,让...