This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Fixed code for app_error_log

Source in components/libraries/util/app_error.h

static __INLINE void app_error_log(uint32_t id, uint32_t pc, uint32_t info)
{
    switch (id)
    {
        case NRF_FAULT_ID_SDK_ASSERT:
            //NRF_LOG_INFO(NRF_LOG_COLOR_RED "\r\n*** ASSERTION FAILED ***\r\n");
            if (((assert_info_t *)(info))->p_file_name)
            {
               // NRF_LOG_INFO(NRF_LOG_COLOR_WHITE "Line Number: %u\r\n", (unsigned int)                 ((assert_info_t *)(info))->line_num);
                //NRF_LOG_INFO("File Name:   %s\r\n", ((assert_info_t *)(info))->p_file_name);
            }
            //NRF_LOG_INFO(NRF_LOG_COLOR_DEFAULT "\r\n");
            break;

        case NRF_FAULT_ID_SDK_ERROR:
            //NRF_LOG_INFO(NRF_LOG_COLOR_RED "\r\n*** APPLICATION ERROR *** \r\n" NRF_LOG_COLOR_WHITE);
            if (((error_info_t *)(info))->p_file_name)
            {
                //NRF_LOG_INFO("Line Number: %u\r\n", (unsigned int) ((error_info_t *)(info))->line_num);
                //NRF_LOG_INFO("File Name:   %s\r\n", ((error_info_t *)(info))->p_file_name);
            }
            //NRF_LOG_INFO("Error Code:  0x%X\r\n" NRF_LOG_COLOR_DEFAULT "\r\n", (unsigned int)          ((error_info_t *)(info))->err_code);
            break;
    }
}  

Updated code to the following, seems to work

static __INLINE void app_error_log(uint32_t id, uint32_t pc, uint32_t info)
{
	error_info_t *err_info;
	assert_info_t *assert_info;
    switch (id)
    {
        case NRF_FAULT_ID_SDK_ASSERT:
            NRF_LOG_INFO("\r\n*** ASSERTION FAILED ***\r\n");
            assert_info = ((assert_info_t *)(info));
            if (assert_info->p_file_name)
            {
                NRF_LOG_INFO("Line Number: %u\r\n", (unsigned int) assert_info->line_num);
                NRF_LOG_INFO("File Name:   %s\r\n", nrf_log_push((char *)assert_info->p_file_name));
            }
            NRF_LOG_INFO("\r\n");
            break;

        case NRF_FAULT_ID_SDK_ERROR:
            NRF_LOG_INFO("\r\n*** APPLICATION ERROR *** \r\n");
            err_info = ((error_info_t *)(info));
            if (err_info->p_file_name)
            {
                NRF_LOG_INFO("Line Number: %u\r\n", (unsigned int) err_info->line_num);
                NRF_LOG_INFO("File Name:   %s\r\n", nrf_log_push((char *)err_info->p_file_name));
            }
            NRF_LOG_INFO("Error Code:  0x%X\r\n", (unsigned int) err_info->err_code);
            break;
    }
}  
Parents Reply Children
No Data
Related