EasyLogger icon indicating copy to clipboard operation
EasyLogger copied to clipboard

FreeRTOS下有时候会导致外部中断进不去

Open langxing08 opened this issue 6 years ago • 0 comments

MCU是STM32L4,使用ST的HAL库,FreeRTOS下移植使用信号量进行elog_port_output_lock和elog_port_output_unlock,有时候会导致STM32不能进入不能进入外部中断函数,请问该怎么解决?谢谢!

static SemaphoreHandle_t log_sem; /**

  • EasyLogger port initialize

  • @return result */ ElogErrCode elog_port_init(void) { ElogErrCode result = ELOG_NO_ERR;

    /* add your code here */ log_sem = xSemaphoreCreateBinary(); if (log_sem != NULL) { xSemaphoreGive(log_sem); } return result; }

/**

  • output lock */ void elog_port_output_lock(void) {

    /* add your code here */ //__disable_irq(); if (log_sem == NULL) { return; }

    xSemaphoreTake(log_sem, portMAX_DELAY);
    }

/**

  • output unlock */ void elog_port_output_unlock(void) {

    /* add your code here */ //__enable_irq(); if (log_sem == NULL) { return; }

    xSemaphoreGive(log_sem); }

langxing08 avatar Aug 23 '19 02:08 langxing08