日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

STM32中使用静态“字符串的方式”

發布時間:2025/3/15 编程问答 16 豆豆
生活随笔 收集整理的這篇文章主要介紹了 STM32中使用静态“字符串的方式” 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
enum { //用于指定數據的位數PRINT_FIRMWARE_INFO,PRINT_ASSERT_ON_THREAD,PRINT_ASSERT_ON_HANDLER,PRINT_THREAD_STACK_INFO,PRINT_MAIN_STACK_INFO,PRINT_THREAD_STACK_OVERFLOW,PRINT_MAIN_STACK_OVERFLOW,PRINT_CALL_STACK_INFO,PRINT_CALL_STACK_ERR,PRINT_FAULT_ON_THREAD,PRINT_FAULT_ON_HANDLER,PRINT_REGS_TITLE,PRINT_HFSR_VECTBL,PRINT_MFSR_IACCVIOL,PRINT_MFSR_DACCVIOL,PRINT_MFSR_MUNSTKERR,PRINT_MFSR_MSTKERR,PRINT_MFSR_MLSPERR,PRINT_BFSR_IBUSERR,PRINT_BFSR_PRECISERR,PRINT_BFSR_IMPREISERR,PRINT_BFSR_UNSTKERR,PRINT_BFSR_STKERR,PRINT_BFSR_LSPERR,PRINT_UFSR_UNDEFINSTR,PRINT_UFSR_INVSTATE,PRINT_UFSR_INVPC,PRINT_UFSR_NOCP,PRINT_UFSR_UNALIGNED,PRINT_UFSR_DIVBYZERO0,PRINT_DFSR_HALTED,PRINT_DFSR_BKPT,PRINT_DFSR_DWTTRAP,PRINT_DFSR_VCATCH,PRINT_DFSR_EXTERNAL,PRINT_MMAR,PRINT_BFAR, };----------static const char *print_info[] = {[PRINT_FIRMWARE_INFO] /* 指定改行的字符串是第一位防止出錯 */ = "Firmware name: %s, hardware version: %s, software version: %s",[PRINT_ASSERT_ON_THREAD] = "Assert on thread %s",[PRINT_ASSERT_ON_HANDLER] = "Assert on interrupt or bare metal(no OS) environment",[PRINT_THREAD_STACK_INFO] = "===== Thread stack information =====",[PRINT_MAIN_STACK_INFO] = "====== Main stack information ======",[PRINT_THREAD_STACK_OVERFLOW] = "Error: Thread stack(%08x) was overflow",[PRINT_MAIN_STACK_OVERFLOW] = "Error: Main stack(%08x) was overflow",[PRINT_CALL_STACK_INFO] = "Show more call stack info by run: addr2line -e %s%s -a -f %.*s",[PRINT_CALL_STACK_ERR] = "Dump call stack has an error",[PRINT_FAULT_ON_THREAD] = "Fault on thread %s",[PRINT_FAULT_ON_HANDLER] = "Fault on interrupt or bare metal(no OS) environment",[PRINT_REGS_TITLE] = "=================== Registers information ====================",[PRINT_HFSR_VECTBL] = "Hard fault is caused by failed vector fetch",[PRINT_MFSR_IACCVIOL] = "Memory management fault is caused by instruction access violation",[PRINT_MFSR_DACCVIOL] = "Memory management fault is caused by data access violation",[PRINT_MFSR_MUNSTKERR] = "Memory management fault is caused by unstacking error",[PRINT_MFSR_MSTKERR] = "Memory management fault is caused by stacking error",[PRINT_MFSR_MLSPERR] = "Memory management fault is caused by floating-point lazy state preservation",[PRINT_BFSR_IBUSERR] = "Bus fault is caused by instruction access violation",[PRINT_BFSR_PRECISERR] = "Bus fault is caused by precise data access violation",[PRINT_BFSR_IMPREISERR] = "Bus fault is caused by imprecise data access violation",[PRINT_BFSR_UNSTKERR] = "Bus fault is caused by unstacking error",[PRINT_BFSR_STKERR] = "Bus fault is caused by stacking error",[PRINT_BFSR_LSPERR] = "Bus fault is caused by floating-point lazy state preservation",[PRINT_UFSR_UNDEFINSTR] = "Usage fault is caused by attempts to execute an undefined instruction",[PRINT_UFSR_INVSTATE] = "Usage fault is caused by attempts to switch to an invalid state (e.g., ARM)",[PRINT_UFSR_INVPC] = "Usage fault is caused by attempts to do an exception with a bad value in the EXC_RETURN number",[PRINT_UFSR_NOCP] = "Usage fault is caused by attempts to execute a coprocessor instruction",[PRINT_UFSR_UNALIGNED] = "Usage fault is caused by indicates that an unaligned access fault has taken place",[PRINT_UFSR_DIVBYZERO0] = "Usage fault is caused by Indicates a divide by zero has taken place (can be set only if DIV_0_TRP is set)",[PRINT_DFSR_HALTED] = "Debug fault is caused by halt requested in NVIC",[PRINT_DFSR_BKPT] = "Debug fault is caused by BKPT instruction executed",[PRINT_DFSR_DWTTRAP] = "Debug fault is caused by DWT match occurred",[PRINT_DFSR_VCATCH] = "Debug fault is caused by Vector fetch occurred",[PRINT_DFSR_EXTERNAL] = "Debug fault is caused by EDBGRQ signal asserted",[PRINT_MMAR] = "The memory management fault occurred address is %08x",[PRINT_BFAR] = "The bus fault occurred address is %08x",}; //使用union 和struct 以及位域來實現數據的按位處理 union {unsigned int value; //該數據的所有的位數可以由下面的數據按位處理struct {unsigned int MEMFAULTACT : 1; // Read as 1 if memory management fault is activeunsigned int BUSFAULTACT : 1; // Read as 1 if bus fault exception is activeunsigned int UnusedBits1 : 1;unsigned int USGFAULTACT : 1; // Read as 1 if usage fault exception is activeunsigned int UnusedBits2 : 3;unsigned int SVCALLACT : 1; // Read as 1 if SVC exception is activeunsigned int MONITORACT : 1; // Read as 1 if debug monitor exception is activeunsigned int UnusedBits3 : 1;unsigned int PENDSVACT : 1; // Read as 1 if PendSV exception is activeunsigned int SYSTICKACT : 1; // Read as 1 if SYSTICK exception is activeunsigned int USGFAULTPENDED : 1; // Usage fault pended; usage fault started but was replaced by a higher-priority exceptionunsigned int MEMFAULTPENDED : 1; // Memory management fault pended; memory management fault started but was replaced by a higher-priority exceptionunsigned int BUSFAULTPENDED : 1; // Bus fault pended; bus fault handler was started but was replaced by a higher-priority exceptionunsigned int SVCALLPENDED : 1; // SVC pended; SVC was started but was replaced by a higher-priority exceptionunsigned int MEMFAULTENA : 1; // Memory management fault handler enableunsigned int BUSFAULTENA : 1; // Bus fault handler enableunsigned int USGFAULTENA : 1; // Usage fault handler enable} bits;} syshndctrl; // System Handler Control and State Register (0xE000ED24)

總結

以上是生活随笔為你收集整理的STM32中使用静态“字符串的方式”的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。