Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
ble_error_log.h
00001 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 00002 * 00003 * The information contained herein is property of Nordic Semiconductor ASA. 00004 * Terms and conditions of usage are described in detail in NORDIC 00005 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 00006 * 00007 * Licensees are granted free, non-transferable use of the information. NO 00008 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 00009 * the file. 00010 * 00011 */ 00012 00013 /** @file 00014 * 00015 * @defgroup ble_error_log_module Error Log Module 00016 * @{ 00017 * @ingroup ble_sdk_lib 00018 * @brief Module for writing error and stack to flash memory. 00019 * 00020 * @details It contains functions for writing an error code, line number, filename/message and 00021 * the stack to the flash during an error, e.g. in the assert handler. 00022 * 00023 */ 00024 #ifndef BLE_ERROR_LOG_H__ 00025 #define BLE_ERROR_LOG_H__ 00026 00027 #include <stdint.h> 00028 #include <stdbool.h> 00029 #include "ble_flash.h " 00030 #include "nordic_global.h" 00031 00032 #define ERROR_MESSAGE_LENGTH 128 /**< Length of error message to stored. */ 00033 #define STACK_DUMP_LENGTH 256 /**< Length of stack to be stored at max: 64 entries of 4 bytes each. */ 00034 #define FLASH_PAGE_ERROR_LOG (BLE_FLASH_PAGE_END - 2) /**< Address in flash where stack trace can be stored. */ 00035 00036 /**@brief Error Log Data structure. 00037 * 00038 * @details The structure contains the error, message/filename, line number as well as the current 00039 * stack, at the time where an error occured. 00040 */ 00041 typedef struct 00042 { 00043 uint16_t failure; /**< Indication that a major failure has occurred during last execution of the application. */ 00044 uint16_t line_number; /**< Line number indicating at which line the failure occurred. */ 00045 uint32_t err_code; /**< Error code when failure occurred. */ 00046 uint8_t message[ERROR_MESSAGE_LENGTH]; /**< Will just use the first 128 bytes of filename to store for debugging purposes. */ 00047 uint32_t stack_info[STACK_DUMP_LENGTH / 4]; /**< Will contain stack information, can be manually unwinded for debug purposes. */ 00048 } ble_error_log_data_t; 00049 00050 00051 /**@brief Function for writing the file name/message, line number, and current program stack 00052 * to flash. 00053 * 00054 * @note This function will force the writing to flash, and disregard any radio communication. 00055 * USE THIS FUNCTION WITH CARE. 00056 * 00057 * @param[in] err_code Error code to be logged. 00058 * @param[in] p_message Message to be written to the flash together with stack dump, usually 00059 * the file name where the error occured. 00060 * @param[in] line_number Line number where the error occured. 00061 * 00062 * @return NRF_SUCCESS on successful writing of the error log. 00063 * 00064 */ 00065 uint32_t ble_error_log_write(uint32_t err_code, const uint8_t * p_message, uint16_t line_number); 00066 00067 00068 #endif /* BLE_ERROR_LOG_H__ */ 00069 00070 /** @} */
Generated on Tue Jul 12 2022 18:44:25 by
1.7.2
