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 BLE_WallbotBLE_Challenge by
ble_error_log.cpp
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 #include <string.h> 00014 #include <stdint.h> 00015 #include <stdbool.h> 00016 #include <nrf51.h> 00017 #include "ble_error_log.h " 00018 #include "app_util.h " 00019 #include "app_error.h " 00020 #include "nrf_gpio.h" 00021 #include "pstorage.h " 00022 00023 00024 // Made static to avoid the error_log to go on the stack. 00025 static ble_error_log_data_t m_ble_error_log; /**< . */ 00026 //lint -esym(526,__Vectors) 00027 extern uint32_t * __Vectors; /**< The initialization vector holds the address to __initial_sp that will be used when fetching the stack. */ 00028 00029 static void fetch_stack(ble_error_log_data_t * error_log) 00030 { 00031 // KTOWN: Temporarily removed 06022014 00032 /* 00033 uint32_t * p_stack; 00034 uint32_t * initial_sp; 00035 uint32_t length; 00036 00037 initial_sp = (uint32_t *) __Vectors; 00038 p_stack = (uint32_t *) GET_SP(); 00039 00040 length = ((uint32_t) initial_sp) - ((uint32_t) p_stack); 00041 memcpy(error_log->stack_info, 00042 p_stack, 00043 (length > STACK_DUMP_LENGTH) ? STACK_DUMP_LENGTH : length); 00044 */ 00045 } 00046 00047 uint32_t ble_error_log_write(uint32_t err_code, const uint8_t * p_message, uint16_t line_number) 00048 { 00049 m_ble_error_log.failure = true; 00050 m_ble_error_log.err_code = err_code; 00051 m_ble_error_log.line_number = line_number; 00052 00053 strncpy((char *)m_ble_error_log.message, (const char *)p_message, ERROR_MESSAGE_LENGTH - 1); 00054 m_ble_error_log.message[ERROR_MESSAGE_LENGTH - 1] = '\0'; 00055 00056 fetch_stack(&m_ble_error_log); 00057 00058 // Write to flash removed, to be redone. 00059 00060 return NRF_SUCCESS; 00061 }
Generated on Tue Jul 12 2022 13:52:30 by
