嵌入式开发笔记——调试组件SEGGER_HardFaultHandle

2023-05-16

  • 作者:zzssdd2
  • E-mail:zzssdd2@foxmail.com

一、前言

在使用Cortex-M内核的MCU进行开发时,有时候会因为对内存错误访问等原因造成程序产生异常从而进入HardFaultHandler错误中断。如果程序结构比较复杂,尤其是运行了RTOS时可能短时间内不易定位异常产生的原因。Segger提供了一种分析CortexM内核芯片HardFault的方法,我在项目中使用后感觉该方法比较实用,本文用来记录该异常分析组件的使用。

二、组件添加

在SEGGER官网的Application Notes页面下提供了该组件的源码和文档

在这里插入图片描述

下载下来后将源文件添加到工程中,然后将中断处理文件中的void HardFault_Handler(void)函数屏蔽掉(和添加的文件中的函数有冲突)就完成添加了。

在这里插入图片描述

三、组件应用

执行以下代码使程序进入HardFault_Handler

volatile unsigned int* p;

p = (unsigned int*)0x007FFFFF;	// 小于0x8000000的地址在STM32中无效
*p = 0x123456;
SEGGER_RTT_printf(0, "p = %d\r\n", *p);

在调试模式下运行程序会停在SEGGER_HardFaultHandler.c文件中的void HardFaultHandler(unsigned int* pStack)函数中。

/*********************************************************************
*
*       HardFaultHandler()
*
*  Function description
*    C part of the hard fault handler which is called by the assembler
*    function HardFault_Handler
*/
void HardFaultHandler(unsigned int* pStack) {
	
	SEGGER_RTT_printf(0, "system enter hard-fault\r\n");
	
  //
  // In case we received a hard fault because of a breakpoint instruction, we return.
  // This may happen when using semihosting for printf outputs and no debugger is connected,
  // i.e. when running a "Debug" configuration in release mode.
  //
  if (NVIC_HFSR & (1u << 31)) {
    NVIC_HFSR |=  (1u << 31);     // Reset Hard Fault status
    *(pStack + 6u) += 2u;         // PC is located on stack at SP + 24 bytes. Increment PC by 2 to skip break instruction.
    return;                       // Return to interrupted application
  }
#if DEBUG
  //
  // Read NVIC registers
  //
  HardFaultRegs.syshndctrl.byte = SYSHND_CTRL;  // System Handler Control and State Register
  HardFaultRegs.mfsr.byte       = NVIC_MFSR;    // Memory Fault Status Register
  HardFaultRegs.bfsr.byte       = NVIC_BFSR;    // Bus Fault Status Register
  HardFaultRegs.bfar            = NVIC_BFAR;    // Bus Fault Manage Address Register
  HardFaultRegs.ufsr.byte       = NVIC_UFSR;    // Usage Fault Status Register
  HardFaultRegs.hfsr.byte       = NVIC_HFSR;    // Hard Fault Status Register
  HardFaultRegs.dfsr.byte       = NVIC_DFSR;    // Debug Fault Status Register
  HardFaultRegs.afsr            = NVIC_AFSR;    // Auxiliary Fault Status Register
  //
  // Halt execution
  // If NVIC registers indicate readable memory, change the variable value to != 0 to continue execution.
  //
  _Continue = 0u;
  while (_Continue == 0u) {
  }
  //
  // Read saved registers from the stack.
  //
  HardFaultRegs.SavedRegs.r0       = pStack[0];  // Register R0
  HardFaultRegs.SavedRegs.r1       = pStack[1];  // Register R1
  HardFaultRegs.SavedRegs.r2       = pStack[2];  // Register R2
  HardFaultRegs.SavedRegs.r3       = pStack[3];  // Register R3
  HardFaultRegs.SavedRegs.r12      = pStack[4];  // Register R12
  HardFaultRegs.SavedRegs.lr       = pStack[5];  // Link register LR
  HardFaultRegs.SavedRegs.pc       = pStack[6];  // Program counter PC
  HardFaultRegs.SavedRegs.psr.byte = pStack[7];  // Program status word PSR
  //
  // Halt execution
  // To step out of the HardFaultHandler, change the variable value to != 0.
  //
  _Continue = 0u;
  while (_Continue == 0u) {
  }
#else
  //
  // If this module is included in a release configuration, simply stay in the HardFault handler
  //
  (void)pStack;
  do {
  } while (1);
#endif
}

HardFaultRegs结构体中包含了用来分析异常原因的寄存器

static struct {
  struct {
    volatile unsigned int r0;            // Register R0
    volatile unsigned int r1;            // Register R1
    volatile unsigned int r2;            // Register R2
    volatile unsigned int r3;            // Register R3
    volatile unsigned int r12;           // Register R12
    volatile unsigned int lr;            // Link register
    volatile unsigned int pc;            // Program counter
    union {
      volatile unsigned int byte;
      struct {
        unsigned int IPSR : 8;           // Interrupt Program Status register (IPSR)
        unsigned int EPSR : 19;          // Execution Program Status register (EPSR)
        unsigned int APSR : 5;           // Application Program Status register (APSR)
      } bits;
    } psr;                               // Program status register.
  } SavedRegs;

  union {
    volatile unsigned int byte;
    struct {
      unsigned int MEMFAULTACT    : 1;   // Read as 1 if memory management fault is active
      unsigned int BUSFAULTACT    : 1;   // Read as 1 if bus fault exception is active
      unsigned int UnusedBits1    : 1;
      unsigned int USGFAULTACT    : 1;   // Read as 1 if usage fault exception is active
      unsigned int UnusedBits2    : 3;
      unsigned int SVCALLACT      : 1;   // Read as 1 if SVC exception is active
      unsigned int MONITORACT     : 1;   // Read as 1 if debug monitor exception is active
      unsigned int UnusedBits3    : 1;
      unsigned int PENDSVACT      : 1;   // Read as 1 if PendSV exception is active
      unsigned int SYSTICKACT     : 1;   // Read as 1 if SYSTICK exception is active
      unsigned int USGFAULTPENDED : 1;   // Usage fault pended; usage fault started but was replaced by a higher-priority exception
      unsigned int MEMFAULTPENDED : 1;   // Memory management fault pended; memory management fault started but was replaced by a higher-priority exception
      unsigned int BUSFAULTPENDED : 1;   // Bus fault pended; bus fault handler was started but was replaced by a higher-priority exception
      unsigned int SVCALLPENDED   : 1;   // SVC pended; SVC was started but was replaced by a higher-priority exception
      unsigned int MEMFAULTENA    : 1;   // Memory management fault handler enable
      unsigned int BUSFAULTENA    : 1;   // Bus fault handler enable
      unsigned int USGFAULTENA    : 1;   // Usage fault handler enable
    } bits;
  } syshndctrl;                          // System Handler Control and State Register (0xE000ED24)

  union {
    volatile unsigned char byte;
    struct {
      unsigned char IACCVIOL    : 1;     // Instruction access violation
      unsigned char DACCVIOL    : 1;     // Data access violation
      unsigned char UnusedBits  : 1;
      unsigned char MUNSTKERR   : 1;     // Unstacking error
      unsigned char MSTKERR     : 1;     // Stacking error
      unsigned char UnusedBits2 : 2;
      unsigned char MMARVALID   : 1;     // Indicates the MMAR is valid
    } bits;
  } mfsr;                                // Memory Management Fault Status Register (0xE000ED28)

  union {
    volatile unsigned int byte;
    struct {
      unsigned int IBUSERR    : 1;       // Instruction access violation
      unsigned int PRECISERR  : 1;       // Precise data access violation
      unsigned int IMPREISERR : 1;       // Imprecise data access violation
      unsigned int UNSTKERR   : 1;       // Unstacking error
      unsigned int STKERR     : 1;       // Stacking error
      unsigned int UnusedBits : 2;
      unsigned int BFARVALID  : 1;       // Indicates BFAR is valid
    } bits;
  } bfsr;                                // Bus Fault Status Register (0xE000ED29)
  volatile unsigned int bfar;            // Bus Fault Manage Address Register (0xE000ED38)

  union {
    volatile unsigned short byte;
    struct {
      unsigned short UNDEFINSTR : 1;     // Attempts to execute an undefined instruction
      unsigned short INVSTATE   : 1;     // Attempts to switch to an invalid state (e.g., ARM)
      unsigned short INVPC      : 1;     // Attempts to do an exception with a bad value in the EXC_RETURN number
      unsigned short NOCP       : 1;     // Attempts to execute a coprocessor instruction
      unsigned short UnusedBits : 4;
      unsigned short UNALIGNED  : 1;     // Indicates that an unaligned access fault has taken place
      unsigned short DIVBYZERO  : 1;     // Indicates a divide by zero has taken place (can be set only if DIV_0_TRP is set)
    } bits;
  } ufsr;                                // Usage Fault Status Register (0xE000ED2A)

  union {
    volatile unsigned int byte;
    struct {
      unsigned int UnusedBits  : 1;
      unsigned int VECTBL      : 1;      // Indicates hard fault is caused by failed vector fetch
      unsigned int UnusedBits2 : 28;
      unsigned int FORCED      : 1;      // Indicates hard fault is taken because of bus fault/memory management fault/usage fault
      unsigned int DEBUGEVT    : 1;      // Indicates hard fault is triggered by debug event
    } bits;
  } hfsr;                                // Hard Fault Status Register (0xE000ED2C)

  union {
    volatile unsigned int byte;
    struct {
      unsigned int HALTED   : 1;         // Halt requested in NVIC
      unsigned int BKPT     : 1;         // BKPT instruction executed
      unsigned int DWTTRAP  : 1;         // DWT match occurred
      unsigned int VCATCH   : 1;         // Vector fetch occurred
      unsigned int EXTERNAL : 1;         // EDBGRQ signal asserted
    } bits;
  } dfsr;                                // Debug Fault Status Register (0xE000ED30)

  volatile unsigned int afsr;            // Auxiliary Fault Status Register (0xE000ED3C), Vendor controlled (optional)
} HardFaultRegs;

HardFaultRegs结构体添加到Watch窗口中,通过一步步向下执行程序可以看到结构体中各参数状态,每个寄存器及寄存器bit位表示什么含义在结构体定义中均有说明。

在这里插入图片描述

_Continue变量也添加到Watch窗口,当执行到以下代码处时在Watch窗口中改变变量值就可以继续向下执行。

//
// Halt execution
// If NVIC registers indicate readable memory, change the variable value to != 0 to continue execution.
//
_Continue = 0u;
while (_Continue == 0u) {
}

在这里插入图片描述

通过对寄存器分析可得出产生异常的原因。

四、扩展

Cortex-M故障异常

Cortex-M processors implement different fault exceptions.

HardFault Exception

The HardFault is the default exception, raised on any error which is not associated with another (enabled) exception.

The HardFault has a fixed priority of -1, i.e. it has a higher priority than all other interrupts and exceptions except for NMI. Therefore a HardFault exception handler can always be entered when an error happens in application code, an interrupt, or another exception. The HardFault is exception number 3 in the vector table with IRQ number -13.

MemManage Exception

The MemManage exception is available with the use of a Memory Protection Unit (MPU) to raise an exception on memory access violations.

The MemManage is exception number 4 in the vector table, IRQ Number -12, and has a configurable priority.

BusFault Exception

The BusFault exception is raised on any memory access error. E.g. by illegal read, write, or vector catch.

The BusFault is exception number 5 in the vector table, IRQ number -11, and has configurable priority. BusFaults can explicitly be enabled in the system control block (SCB). When BusFault is not enabled, a HardFault is raised.

UsageFault Exception

The UsageFault exception is raised on execution errors. Unaligned access on load/store multiple instructions are always caught. Exceptions on other unaligned access, as well as division by zero can be additionally enabled in the SCB.

The UsageFault is exception number 6 in the vector table, IRQ number -10, and has configurable priority. When UsageFault is not enabled, a HardFault is raised instead.

故障状态寄存器

The Cortex-M System Control Block (SCB) contains some registers which enable configuration of exceptions and provide information about faults.

HardFault Status Register (HFSR)

The HFSR is in the SCB at address 0xE000ED2C. It is a 32-bit register.

Bitfields:

[31] DEBUGEVT - Reserved for use by debugger/debug probe. Always write 0.
[30] FORCED   - If 1, HardFault has been caused by escalation of another exception, because it is disabled or because of priority.
[1]  VECTTBL  - If 1, a BusFault occurred by reading the vector table for exception processing.

UsageFault Status Register (UFSR)

The UFSR is a 16-bit pseudo-register, part of the Configurable Fault Status Register (CFSR) at address 0xE000ED28. It can also be directly accessed with halfword access to 0xE000ED2A.

Bitfields:

[9] DIVBYZERO  - If 1, SDIV or UDIV instruction executed with divisor 0.
[8] UNALIGNED  - If 1, LDM, STM, LDRD, STRD on unaligned address executed, or single load or store executed when enabled to trap.
[3] NOCP       - If 1, access to unsupported (e.g. not available or not enabled) coprocessor.
[2] INVPC      - If 1, illegal or invalid EXC_RETURN value load to PC.
[1] INVSTATE   - If 1, execution in invalid state. E.g. Thumb bit not set in EPSR, or invalid IT state in EPSR.
[0] UNDEFINSTR - If 1, execution of undefined instruction.

BusFault Status Register (BFSR) and BusFault Address Register (BFAR)

The BFSR is a 8-bit pseudo-register in the CFSR. It can be directly accessed with byte access ad 0xE000ED29. The BFAR is a 32-bit register at 0xE000ED38.

Bitfields:

[7] BFARVALID   - If 1, the BFAR contains the address which caused the BusFault.
[5] LSPERR      - 1f 1, fault during floating-point lazy stack preservation.
[4] STKERR      - If 1, fault on stacking for exception entry.
[3] UNSTKERR    - If 1, fault on unstacking on exception return.
[2] IMPRECISERR - If 1, return address is not related to fault, e.g. fault caused before.
[1] PRECISERR   - If 1, return address instruction caused the fault.
[0] IBUSERR     - If 1, fault on instruction fetch.

MemManage Fault Status Register (MMFSR) and MemManage fault Address Register (MMFAR)

The MMFSR is a 8-bit pseudo-register in the CFSR. It can be directly accessed with byte access ad 0xE000ED28. The MMFAR is a 32-bit register at 0xE000ED34.

Bitfields:

[7] MMARVALID - If 1, the MMFAR contains the address which caused the MemManageFault.
[5] MLSPERR   - 1f 1, fault during floating-point lazy stack preservation.
[4] MSTKERR   - If 1, fault on stacking for exception entry.
[3] MUNSTKERR - If 1, fault on unstacking on exception return.
[1] DACCVIOL  - If 1, data access violation.
[0] IACCVIOL  - If 1, instruction access violation.

Stack Recovery

On exception entry, the exception handler can check which stack has been used when the fault happened. When bit EXC_RETURN[2] is set, MSP has been used, otherwise PSP has been used.

The stack can be used to recover the CPU register values.

CPU Register Recovery

On exception entry, some CPU registers are stored on the stack and can be read from there for error analysis. the following registers are recoverable:

 r0       = pStack[0];  // Register R0
 r1       = pStack[1];  // Register R1
 r2       = pStack[2];  // Register R2
 r3       = pStack[3];  // Register R3
 r12      = pStack[4];  // Register R12
 lr       = pStack[5];  // Link register LR
 pc       = pStack[6];  // Program counter PC
 psr.byte = pStack[7];  // Program status word PSR

故障分析示例

The following examples show how/why some faults can be caused, and how to analyze them. A project to test the faults is available here.

BusFault Examples

Illegal Memory Write

/*********************************************************************
*
*       _IllegalWrite()
*
*  Function description
*   Trigger a BusFault or HardFault by writing to a reserved address.
*
*  Additional Information
*    BusFault is raised some instructions after the write instruction.
*    Related registers on fault:
*      HFSR = 0x40000000
*        FORCED = 1           - BusFault escalated to HardFault (when BusFault is not activated)
*      BFSR = 0x00000004
*        IMPREISERR = 1       - Imprecise data access violation. Return address not related to fault
*        BFARVALID = 0        - BFAR not valid
*/
static int _IllegalWrite(void) {
  int r;
  volatile unsigned int* p;

  r = 0;
  p = (unsigned int*)0x00100000;       // 0x00100000-0x07FFFFFF is reserved on STM32F4
  //  F44F1380    mov.w r3, #0x00100000
  *p = 0x00BADA55;
  //  4A03        ldr r2, =0x00BADA55
  //  601A        str r2, [r3]         <- Illegal write is done here
  return r;
  //  9B00        ldr r3, [sp]
  //  4618        mov r0, r3
  //  B002        add sp, sp, #8       <- Fault might be raised here 
  //  4770        bx lr
}

Illegal Memory Read

/*********************************************************************
*
*       _IllegalRead()
*
*  Function description
*   Trigger a BusFault or HardFault by reading from a reserved address.
*
*  Additional Information
*    BusFault is immediately triggered on the read instruction.
*    Related registers on fault:
*      HFSR = 0x40000000
*        FORCED = 1           - BusFault escalated to HardFault
*      BFSR = 0x00000082
*        PRECISERR = 1        - Precise data access violation
*        BFARVALID = 1        - BFAR is valid
*      BFAR = 0x00100000      - The address read from
*/
static int _IllegalRead(void) {
  int r;
  volatile unsigned int* p;

  p = (unsigned int*)0x00100000;        // 0x00100000-0x07FFFFFF is reserved on STM32F4
  //  F44F1380    mov.w r3, #0x00100000 <- The read address. Will be found in BFAR
  r = *p;
  //  681B        ldr r3, [r3]          <- Illegal read happens here and raises BusFault
  //  9300        str r3, [sp]

  return r;
}

Illegal Function Execution

/*********************************************************************
*
*       _IllegalFunc()
*
*  Function description
*   Trigger a BusFault or HardFault by executing at a reserved address.
*
*  Additional Information
*    BusFault is triggered on execution at the invalid address.
*    Related registers on fault:
*      HFSR = 0x40000000
*        FORCED = 1           - BusFault escalated to HardFault
*      BFSR = 0x00000001
*        IBUSERR = 1          - BusFault on instruction prefetch
*/
static int _IllegalFunc(void) {
  int r;
  int (*pF)(void);

  pF = (int(*)(void))0x00100001;         // 0x00100000-0x07FFFFFF is reserved on STM32F4
  //  F44F1380    mov.w r3, #0x00100001
  r = pF();
  //  4798        blx r3                 <- Branch to illegal address, causes fetch from 0x00100000 and fault exception
  return r;
}

UsageFault Examples

Undefined Instruction Execution

/*********************************************************************
*
*       _UndefInst()
*
*  Function description
*   Trigger a UsageFault or HardFault by executing an undefined instruction.
*
*  Additional Information
*    UsageFault is triggered on execution at the invalid address.
*    Related registers on hard fault:
*      HFSR = 0x40000000
*        FORCED = 1           - UsageFault escalated to HardFault
*      UFSR = 0x0001
*        UNDEFINSTR = 1       - Undefined instruction executed
*/
static int _UndefInst(void) {
  static const unsigned short _UDF[4] = {0xDEAD, 0xDEAD, 0xDEAD, 0xDEAD}; // 0xDEAD: UDF #<imm> (permanently undefined)
  int r;
  int (*pF)(void);

  pF = (int(*)(void))(((char*)&_UDF) + 1);
  //  4B05        ldr r3, =0x08001C18 <_UDF> <- Load address of "RAM Code" instructions
  //  3301        adds r3, #1                <- Make sure Thumb bit is set
  r = pF();
  //  4798        blx r3                     <- Call "RAM Code", will execute UDF instruction and raise exception
  //  9000        str r0, [sp]
  return r;
}

Illegal State

/*********************************************************************
*
*       _NoThumbFunc()
*
*  Function description
*   Trigger a UsageFault or HardFault by executing an address without thumb bit set.
*
*  Additional Information
*    UsageFault is triggered on execution at the invalid address.
*    Related registers on hard fault:
*      HFSR = 0x40000000
*        FORCED = 1           - UsageFault escalated to HardFault
*      UFSR = 0x0002
*        INVSTATE = 1         - Instruction execution with invalid state
*/
static int _NoThumbFunc(void) {
  int r;
  int (*pF)(void);

  pF = (int(*)(void))0x00100000;         // 0x00100000-0x07FFFFFF is reserved on STM32F4
  //  F44F1380    mov.w r3, #0x00100000  <- Note that bit [0] is not set.
  r = pF();
  //  4798        blx r3                 <- Branch exchange with mode change to ARM, but Cortex-M only supports Thumb mode.
  return r;
}

Division By Zero

/*********************************************************************
*
*       _DivideByZero()
*
*  Function description
*   Trigger a UsageFault or HardFault by dividing by zero.
*
*  Additional Information
*    UsageFault is triggered immediately on the divide instruction.
*    Related registers on hard fault:
*      HFSR = 0x40000000
*        FORCED = 1           - UsageFault escalated to HardFault
*      UFSR = 0x0200
*        DIVBYZERO = 1        - Divide-by-zero fault
*/
static int _DivideByZero(void) {
  int r;
  volatile unsigned int a;
  volatile unsigned int b;
  a = 1;
  //  2301        movs r3, #1       <- Load dividend
  b = 0;
  //  2300        movs r3, #0       <- Load divisor
  r = a / b;
  //  FBB2F3F3    udiv r3, r2, r3   <- divide by 0 raises fault exception
  return r;
}

Unaligned Access

/*********************************************************************
*
*       _UnalignedAccess()
*
*  Function description
*   Trigger a UsageFault or HardFault by an unaligned word access.
*
*  Additional Information
*    UsageFault is triggered immediately on the read or write instruction.
*    Related registers on fault:
*      HFSR = 0x40000000
*        FORCED = 1           - UsageFault escalated to HardFault
*      UFSR = 0x0100
*        UNALIGNED = 1        - Unaligned memory access
*/
static int _UnalignedAccess(void) {
  int r;
  volatile unsigned int* p;

  p = (unsigned int*)0x20000002;
  //  4B04        ldr r3, =0x20000002  <- Not word aligned address
  r = *p;
  //  681B        ldr r3, [r3]         <- Load word from unaligned address raises exception
  //  9300        str r3, [sp]
  return r;
}

HardFault Examples

Illegal Vector Table Fetch

/*********************************************************************
*
*       _IllegalVector()
*
*  Function description
*   Trigger a HardFault by interrupt with illegal vector table.
*
*  Additional Information
*    Related registers on fault:
*      HFSR = 0x00000002
*        VECTTBL = 1           - Vector table read fault
*/
static int _IllegalVector(void) {
  int r;

  SCB->VTOR = 0x001000000;            // Relocate vector table to illegal address  
  //  4B09        ldr r3, =0xE000ED00
  //  F04F7280    mov.w r2, #0x1000000
  //  609A        str r2, [r3, #8]
  SCB->ICSR = SCB_ICSR_PENDSVSET_Msk; // Trigger PendSV exception to read invalid vector
  //  4B07        ldr r3, =0xE000ED00
  //  F04F5280    mov.w r2, #0x10000000
  //  605A        str r2, [r3, #4]
  __ISB();
  //  F3BF8F6F    isb                 <- PendSV exception is to be executed. PendSV vector is tried to be read from illegal address 0x00100038 causes fault exception
  //  BF00        nop
  __DSB();
  //  F3BF8F4F    dsb sy
  //  BF00        nop
  return r;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

嵌入式开发笔记——调试组件SEGGER_HardFaultHandle 的相关文章

  • 计算统计笔记整理(持更)

    bootstrap方法 基本思想 xff1a 模拟 目的 xff1a 计算 xff08 任意估计的 xff09 标准误差 偏差和置信区间 分类 xff1a 1 参数化bootstrap 分布形式已知 xff0c 或可由样本估计出分布 xff
  • Javascript 分析Javascript事件机制和Settimeout讲解

    线程 JavaScript特点就是单线程 xff0c 理解是 xff0c 同一个时间只能做一件事 那么 xff0c 为什么JavaScript不能有多个线程呢 xff1f 现在我们假设 xff0c JavaScript同时有多个线程 xff
  • 规划人生之一: 嵌入式系统开发or算法开发

    这些天一直为一个问题所烦扰 不知道今后改把精力投入到嵌入式系统如arm dsp等的开发上还是在图像的压缩算法上 由于我们做的是嵌入式系统 在arm开发上还有嵌入式os 所以比较烦杂 而在dsp上还要进行mpeg以及264的开发 不知道那个更
  • vue中点击获取相应元素

    在vue中通过点击事件获取上一个标签 父标签 第一个子标签等元素 以下元素都是以所点击的元素进行查找 e target 获取当前点击的元素 e currentTarget 获取绑定事件的元素 e currentTarget previous
  • http-parser解析http报文详解

    说明 项目里用到力http parser xff0c 在这里简单说明一下其用法吧 下载地址 xff1a https github com joyent http parser 其使用说明很详细 开源用例 开源tcpflow 1 4 4中使用
  • BGP协议介绍

    一 BGP协议概述 BGP用于在不同的自治系统 xff08 AS xff09 之间交换路由信息 当两个AS需要交换路由信息时 xff0c 每个AS都必须指定一个运行BGP的节点 xff0c 来代表AS与其他的AS交换路由信息 通常是路由器来
  • nuxt asyncData extendRoutes nuxtServerInit

    材料来源 realworld 开源项目 asyncData 仅支持服务端 xff0c 页面初始化 xff0c 组件加载之前 xff0c 不能this调用 案例 官方 nuxt config js module span class toke
  • STM32F107的串口通讯总结

    STM32F107的串口通讯总结 STM32F107 的串口通讯总结 1 STM32 的一般规律 xff0c 首先要使用串口必先使能串口时钟 xff0c 比如串口1 xff1a RCC APB2PeriphClockCmd RCC APB2
  • STM32——高级定时器、通用定时器、基本定时器的区别

    TIM1 和 TIM8 定时器的功能包括 增强型 xff1a 16 位向上 向下 向上 下自动装载计数器 16 位可编程 可以实时修改 预分频器 xff0c 计数器时钟频率的分频系数为 1 xff5e 65535 之间的任意数值 多达 4
  • STM32F107的通用定时器中断实验总结

    1 STM32F107 的通用定时器是指 xff1a TIM2 TIM3 TIM4 TIM5 STM32F107 的高级定时器是指 xff1a TIM1 TIM8 STM32F107 的基本定时器是指 xff1a TIM6 TIM7 2 S
  • STM32F107的通用定时器PWM实验总结

    STM32F107 的通用定时器PWM 实验总结 1 STM32F107 的通用定时器是指 xff1a TIM2 TIM3 TIM4 TIM5 2 STM32F107 的通用定时器 xff08 TIM2 TIM3 TIM4 TIM5 xff
  • 鸿蒙WIFI-IoT开发板RTC时钟模块功能实现

    1 RTC时钟模块硬件准备 RTC时钟模块 RTC时钟模块在WiFiIoT套件上的连接 2 RTC时钟模块硬件介绍 RTC时钟模块使用I2C接口为I2C0 xff0c 对应管脚连接说明 xff1a SDA 底板的TX GPIO 13 SCL
  • Android studio新建项目之后由于gradle配置问题导致项目无法运行的个人解决方案分享

    本文主要针对本人自己新建Android Stuido项目的时候遇到的问题的一个经验总结 说明 xff1a IDE为 Android studio 2 1 Preview 1 Windows 8系统 现象描述 xff1a 一路默认设置来创建一
  • VS Code如何在win10环境下运行C/C++

    本篇文章适合有一定基础的同学 一 准备工作 1 安装VS Code xff0c 并且安装C C 43 43 插件 链接 xff1a https code visualstudio com 2 安装MinGW 链接 xff1a http ww
  • 百度2014校招笔试题(一)

    算法和程序设计题 xff1a 1 题意 xff1a 一幢大楼的底层有1001根电线 xff0c 这些电线一直延伸到大楼楼顶 xff0c 你需要确定底层的1001个线头和楼顶的1001次线头的对应关系 你有一个电池 xff0c 一个灯泡 xf
  • 【Python数据分析】Numpy常用操作(二)

    一 常用的数学和统计方法 1 一维数组 span class token comment np random randn 生成随机数组 每运行一次会改变一次 span arr span class token operator 61 spa
  • 【Python数据分析】Pandas常用操作(一)

    pandas基于Numpy构建 xff0c 最初被作为金融数据分析工具使用因此pandas为时间序列分析做了很好的支持 pandas的两种数据结构 xff1a Series和DataFrame 一 Series xff08 index va
  • 【Python数据分析】Pandas常用操作(二)

    一 Pandas中的常用方法 span class token comment 创建一个数据框 span span class token keyword import span numpy span class token keyword
  • 【Python数据分析】Pandas中的绘图函数

    Pandas中有许多能够利用DataFrame对象数据特点来创建标准图表的高级绘图方法 1 折线图 y span class token operator 61 span df span class token punctuation sp
  • 【Python数据分析】matplotlib绘图

    matplotlib 是一个 Python 的 2D绘图库 xff0c 用于数据可视化 它可以函数的方式操作各个绘图命令 xff08 类似Matlab软件 xff0c Matplotlib名字的含义就是Matlab风格的绘图库 xff09

随机推荐

  • PPT模板、素材下载网站(纯干货,建议收藏)

    清平乐博主精心收集PPT模板 xff0c 纯干货 xff01 一 OfficePlus 网址 xff1a https www officeplus cn 特点 xff1a 下载全部免费 xff1b 质量高 微软Office官方在线模板网站
  • Impala时间函数总结

    Impala 使用impala 您可以使用传统的SQL知识以极快的速度处理存储在HDFS中的数据 Impala是基于hive并使用内存进行计算 在查询过程中 并未进行MR转换 而是采用与商用并行关系数据库类似的分布式查询引擎 直接与HDFS
  • 【数仓设计】企业数仓为什么要进行分层?(六大好处)

    一 数据仓库要不要分层 数据仓库既然是数据存储计算的地方 那么为什么需要分层呢 同样也是数据规模 业务场景决定 可以说很多公司数据仓库建设刚起步时 大部分的数据都是经过粗暴的数据接入 进行ETL后就直接对接业务 生成报表或者导入业务系统直接
  • 快速搭建samba 简单samba服务

    基于RedHat service smb restart etc init d smb start 1 安装samba包 yum install samba 2 修改相关配置文件 vim etc samba smb conf 3 添加相关s
  • 程序员=加班??掌握时间才能掌握人生

    总是有些人一生中有无数作为 xff0c 而更多的人耗费一生的时间最终换来了不过四个字 死因不详 序言 近几年 xff0c 读了比较多的书 xff0c 涉猎也比较广泛 xff0c 经管 xff0c 哲学 xff0c 心理学 xff0c 成功学
  • Presto集群Web UI界面详解

    Presto Web UI 可以用来检查和监控Presto集群 xff0c 以及运行的查询 他所提供的关于查询的详细信息可以更好的理解以及调整整个集群和单个查询 Presto Web UI所展示的信息都来自于Presto系统表 当你进入Pr
  • 【好书推荐】《华为数据之道》

    数据技术要产生实际价值 xff0c 需要良好的数据治理体系保驾护航 最近华为出版了 华为数据之道 一书 xff0c 给出了非数字原生企业在数据管理方面的实战经验 xff0c 特别适合于面临数字化转型的企业管理者 数据从业者 一 整体框架 华
  • 【好书推荐】《Python编程:从入门到实践(第2版)》

    第二版是2020年底发布的 xff0c 第二版相比较第一版更新了不少新东西 不错的python入门书 xff0c 第一部分讲基础知识 xff0c 第二部分讲了三个实际的项目 xff1a 一个小游戏 xff0c 一个数据可视化程序 xff0c
  • 【小技巧】Navicat查看数据库密码

    一 导出链接 二 导出的时候一定要勾选导出密码 三 导出文件用notepad 打开 四 打开网址 将如下代码复制进去 打开这个网址 https tool lu coderunner 将如下PHP代码复制进去 span class token
  • 看《狂飙》读人生,致敬2023!

    作为2023年的第一篇博文 xff0c 我不想写代码 xff0c 我想谈谈最近看的 狂飙 xff0c 总结了十条哲理 xff0c 共勉 希望我们的2023 xff0c 未来的人生会更加出彩 01 你以为很好的关系 xff0c 其实也就那么回
  • MySQL生成排序序号RN

    有时因为业务的需求 我们需要在查询出的数据中加上排序序号 例 span class token keyword SQL span span class token keyword select span a span class token
  • MySQL实现row_number排序功能(不用函数)

    MySQL ROW NUMBER 函数为结果集中的每一行生成序列号 MySQL ROW NUMBER 从8 0版开始引入了功能 在使用8 0版之前的数据库时 往往也会用到排序逻辑 那我们如何在不使用ROW NUMBER 函数的情况下来实现排
  • 一文读懂【数据埋点】

    数据埋点是数据采集领域 xff08 尤其是用户行为数据采集领域 xff09 的术语 xff0c 指的是针对特定用户行为或事件进行捕获 处理和发送的相关技术及其实施过程 比如用户某个icon点击次数 观看某个视频的时长等等 数据分析是我们获得
  • Hive几个常用数学函数

    span class token number 1 span span class token punctuation span span class token comment round 四舍五入 span span class tok
  • ubuntu解决中文乱码

    1 查看当前系统使用的字符编码 locale LANG 61 en US LANGUAGE 61 en US LC CTYPE 61 34 en US 34 LC NUMERIC 61 34 en US 34 LC TIME 61 34 e
  • Python 中使用 Azure Blob 存储

    本文介绍如何使用适用于 Python 的 Azure 存储客户端库来上传 blob 你可以上传 blob xff0c 打开 blob 流并写入流 xff0c 或者上传带有索引标记的 blob Azure 存储中的 Blob 已组织成容器 必
  • 视频加速播放插件-Global Speed

    有时候我们觉得看视频的过程中视频播放的太慢了 xff0c 希望能够加快一点播放的速度 xff0c 谷歌浏览器里面有很多有意思的插件 例如Global Speed就可以控制视频播放的速度 1 打开谷歌浏览器 xff0c 输出商店扩展应用地址
  • 激光SLAM之图优化理论

    1 常用的两种优化方法介绍 SLAM问题的处理方法主要分为滤波和图优化两类 滤波的方法中常见的是扩展卡尔曼滤波 粒子滤波 信息滤波等 xff0c 熟悉滤波思想的同学应该容易知道这类SLAM问题是递增的 实时的处理数据并矫正机器人位姿 比如基
  • ROS常用命令合集

    一 创建 ROS 工作空间 1 启动 ROS roscore 2 创建工作环境 mkdir p catkin ws src cd catkin ws src catkin init workspace 3 编译 ROS 程序 cd catk
  • 嵌入式开发笔记——调试组件SEGGER_HardFaultHandle

    作者 xff1a zzssdd2E mail xff1a zzssdd2 64 foxmail com 一 前言 在使用Cortex M内核的MCU进行开发时 xff0c 有时候会因为对内存错误访问等原因造成程序产生异常从而进入HardFa