The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_NRF52_DK/TARGET_NORDIC/TARGET_NRF5/sdk/ble/ble_error_log/ble_error_log.h@123:b0220dba8be7, 2016-08-12 (annotated)
- Committer:
- Kojto
- Date:
- Fri Aug 12 13:04:35 2016 +0200
- Revision:
- 123:b0220dba8be7
Release 123 of the mbed library
Changes:
- new targets: nucleo_f207zg, beetle, nrf51_dk, hexiwear,
nuvoton nuc472, vk rz a1h
- ST - fix timer interrupt handler, sleep api fix
- NXP - lpc15xx us ticker fix
- Nordic - analogin fixes, LF clock init addition, enable i2c async
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 123:b0220dba8be7 | 1 | /* |
Kojto | 123:b0220dba8be7 | 2 | * Copyright (c) 2012 Nordic Semiconductor ASA |
Kojto | 123:b0220dba8be7 | 3 | * All rights reserved. |
Kojto | 123:b0220dba8be7 | 4 | * |
Kojto | 123:b0220dba8be7 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 123:b0220dba8be7 | 6 | * are permitted provided that the following conditions are met: |
Kojto | 123:b0220dba8be7 | 7 | * |
Kojto | 123:b0220dba8be7 | 8 | * 1. Redistributions of source code must retain the above copyright notice, this list |
Kojto | 123:b0220dba8be7 | 9 | * of conditions and the following disclaimer. |
Kojto | 123:b0220dba8be7 | 10 | * |
Kojto | 123:b0220dba8be7 | 11 | * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA |
Kojto | 123:b0220dba8be7 | 12 | * integrated circuit in a product or a software update for such product, must reproduce |
Kojto | 123:b0220dba8be7 | 13 | * the above copyright notice, this list of conditions and the following disclaimer in |
Kojto | 123:b0220dba8be7 | 14 | * the documentation and/or other materials provided with the distribution. |
Kojto | 123:b0220dba8be7 | 15 | * |
Kojto | 123:b0220dba8be7 | 16 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be |
Kojto | 123:b0220dba8be7 | 17 | * used to endorse or promote products derived from this software without specific prior |
Kojto | 123:b0220dba8be7 | 18 | * written permission. |
Kojto | 123:b0220dba8be7 | 19 | * |
Kojto | 123:b0220dba8be7 | 20 | * 4. This software, with or without modification, must only be used with a |
Kojto | 123:b0220dba8be7 | 21 | * Nordic Semiconductor ASA integrated circuit. |
Kojto | 123:b0220dba8be7 | 22 | * |
Kojto | 123:b0220dba8be7 | 23 | * 5. Any software provided in binary or object form under this license must not be reverse |
Kojto | 123:b0220dba8be7 | 24 | * engineered, decompiled, modified and/or disassembled. |
Kojto | 123:b0220dba8be7 | 25 | * |
Kojto | 123:b0220dba8be7 | 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
Kojto | 123:b0220dba8be7 | 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
Kojto | 123:b0220dba8be7 | 28 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 123:b0220dba8be7 | 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
Kojto | 123:b0220dba8be7 | 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
Kojto | 123:b0220dba8be7 | 31 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
Kojto | 123:b0220dba8be7 | 32 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
Kojto | 123:b0220dba8be7 | 33 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
Kojto | 123:b0220dba8be7 | 34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
Kojto | 123:b0220dba8be7 | 35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 123:b0220dba8be7 | 36 | * |
Kojto | 123:b0220dba8be7 | 37 | */ |
Kojto | 123:b0220dba8be7 | 38 | |
Kojto | 123:b0220dba8be7 | 39 | |
Kojto | 123:b0220dba8be7 | 40 | /** @file |
Kojto | 123:b0220dba8be7 | 41 | * |
Kojto | 123:b0220dba8be7 | 42 | * @defgroup ble_error_log_module Error Log Module |
Kojto | 123:b0220dba8be7 | 43 | * @{ |
Kojto | 123:b0220dba8be7 | 44 | * @ingroup ble_sdk_lib |
Kojto | 123:b0220dba8be7 | 45 | * @brief Module for writing error and stack to flash memory. |
Kojto | 123:b0220dba8be7 | 46 | * |
Kojto | 123:b0220dba8be7 | 47 | * @details It contains functions for writing an error code, line number, filename/message and |
Kojto | 123:b0220dba8be7 | 48 | * the stack to the flash during an error, e.g. in the assert handler. |
Kojto | 123:b0220dba8be7 | 49 | * |
Kojto | 123:b0220dba8be7 | 50 | */ |
Kojto | 123:b0220dba8be7 | 51 | #ifndef BLE_ERROR_LOG_H__ |
Kojto | 123:b0220dba8be7 | 52 | #define BLE_ERROR_LOG_H__ |
Kojto | 123:b0220dba8be7 | 53 | |
Kojto | 123:b0220dba8be7 | 54 | #include <stdint.h> |
Kojto | 123:b0220dba8be7 | 55 | #include <stdbool.h> |
Kojto | 123:b0220dba8be7 | 56 | #include "ble_flash.h" |
Kojto | 123:b0220dba8be7 | 57 | |
Kojto | 123:b0220dba8be7 | 58 | #define ERROR_MESSAGE_LENGTH 128 /**< Length of error message to stored. */ |
Kojto | 123:b0220dba8be7 | 59 | #define STACK_DUMP_LENGTH 256 /**< Length of stack to be stored at max: 64 entries of 4 bytes each. */ |
Kojto | 123:b0220dba8be7 | 60 | #define FLASH_PAGE_ERROR_LOG (BLE_FLASH_PAGE_END - 2) /**< Address in flash where stack trace can be stored. */ |
Kojto | 123:b0220dba8be7 | 61 | |
Kojto | 123:b0220dba8be7 | 62 | /**@brief Error Log Data structure. |
Kojto | 123:b0220dba8be7 | 63 | * |
Kojto | 123:b0220dba8be7 | 64 | * @details The structure contains the error, message/filename, line number as well as the current |
Kojto | 123:b0220dba8be7 | 65 | * stack, at the time where an error occured. |
Kojto | 123:b0220dba8be7 | 66 | */ |
Kojto | 123:b0220dba8be7 | 67 | typedef struct |
Kojto | 123:b0220dba8be7 | 68 | { |
Kojto | 123:b0220dba8be7 | 69 | uint16_t failure; /**< Indication that a major failure has occurred during last execution of the application. */ |
Kojto | 123:b0220dba8be7 | 70 | uint16_t line_number; /**< Line number indicating at which line the failure occurred. */ |
Kojto | 123:b0220dba8be7 | 71 | uint32_t err_code; /**< Error code when failure occurred. */ |
Kojto | 123:b0220dba8be7 | 72 | uint8_t message[ERROR_MESSAGE_LENGTH]; /**< Will just use the first 128 bytes of filename to store for debugging purposes. */ |
Kojto | 123:b0220dba8be7 | 73 | uint32_t stack_info[STACK_DUMP_LENGTH / 4]; /**< Will contain stack information, can be manually unwinded for debug purposes. */ |
Kojto | 123:b0220dba8be7 | 74 | } ble_error_log_data_t; |
Kojto | 123:b0220dba8be7 | 75 | |
Kojto | 123:b0220dba8be7 | 76 | |
Kojto | 123:b0220dba8be7 | 77 | /**@brief Function for writing the file name/message, line number, and current program stack |
Kojto | 123:b0220dba8be7 | 78 | * to flash. |
Kojto | 123:b0220dba8be7 | 79 | * |
Kojto | 123:b0220dba8be7 | 80 | * @note This function will force the writing to flash, and disregard any radio communication. |
Kojto | 123:b0220dba8be7 | 81 | * USE THIS FUNCTION WITH CARE. |
Kojto | 123:b0220dba8be7 | 82 | * |
Kojto | 123:b0220dba8be7 | 83 | * @param[in] err_code Error code to be logged. |
Kojto | 123:b0220dba8be7 | 84 | * @param[in] p_message Message to be written to the flash together with stack dump, usually |
Kojto | 123:b0220dba8be7 | 85 | * the file name where the error occured. |
Kojto | 123:b0220dba8be7 | 86 | * @param[in] line_number Line number where the error occured. |
Kojto | 123:b0220dba8be7 | 87 | * |
Kojto | 123:b0220dba8be7 | 88 | * @return NRF_SUCCESS on successful writing of the error log. |
Kojto | 123:b0220dba8be7 | 89 | * |
Kojto | 123:b0220dba8be7 | 90 | */ |
Kojto | 123:b0220dba8be7 | 91 | uint32_t ble_error_log_write(uint32_t err_code, const uint8_t * p_message, uint16_t line_number); |
Kojto | 123:b0220dba8be7 | 92 | |
Kojto | 123:b0220dba8be7 | 93 | |
Kojto | 123:b0220dba8be7 | 94 | #endif /* BLE_ERROR_LOG_H__ */ |
Kojto | 123:b0220dba8be7 | 95 | |
Kojto | 123:b0220dba8be7 | 96 | /** @} */ |