テスト用です。

Dependencies:   mbed

Committer:
jksoft
Date:
Tue Oct 11 11:09:42 2016 +0000
Revision:
0:8468a4403fea
SB??ver;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:8468a4403fea 1 /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
jksoft 0:8468a4403fea 2 *
jksoft 0:8468a4403fea 3 * The information contained herein is property of Nordic Semiconductor ASA.
jksoft 0:8468a4403fea 4 * Terms and conditions of usage are described in detail in NORDIC
jksoft 0:8468a4403fea 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
jksoft 0:8468a4403fea 6 *
jksoft 0:8468a4403fea 7 * Licensees are granted free, non-transferable use of the information. NO
jksoft 0:8468a4403fea 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
jksoft 0:8468a4403fea 9 * the file.
jksoft 0:8468a4403fea 10 *
jksoft 0:8468a4403fea 11 */
jksoft 0:8468a4403fea 12
jksoft 0:8468a4403fea 13 #include "ble_debug_assert_handler.h"
jksoft 0:8468a4403fea 14 #include <string.h>
jksoft 0:8468a4403fea 15 #include "nrf51.h"
jksoft 0:8468a4403fea 16 #include "ble_error_log.h"
jksoft 0:8468a4403fea 17 #include "nordic_common.h"
jksoft 0:8468a4403fea 18
jksoft 0:8468a4403fea 19 #define MAX_LENGTH_FILENAME 128 /**< Max length of filename to copy for the debug error handlier. */
jksoft 0:8468a4403fea 20
jksoft 0:8468a4403fea 21
jksoft 0:8468a4403fea 22 // WARNING - DO NOT USE THIS FUNCTION IN END PRODUCT. - WARNING
jksoft 0:8468a4403fea 23 // WARNING - FOR DEBUG PURPOSES ONLY. - WARNING
jksoft 0:8468a4403fea 24 void ble_debug_assert_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name)
jksoft 0:8468a4403fea 25 {
jksoft 0:8468a4403fea 26 // Copying parameters to static variables because parameters may not be accessible in debugger.
jksoft 0:8468a4403fea 27 static volatile uint8_t s_file_name[MAX_LENGTH_FILENAME];
jksoft 0:8468a4403fea 28 static volatile uint16_t s_line_num;
jksoft 0:8468a4403fea 29 static volatile uint32_t s_error_code;
jksoft 0:8468a4403fea 30
jksoft 0:8468a4403fea 31 strncpy((char *)s_file_name, (const char *)p_file_name, MAX_LENGTH_FILENAME - 1);
jksoft 0:8468a4403fea 32 s_file_name[MAX_LENGTH_FILENAME - 1] = '\0';
jksoft 0:8468a4403fea 33 s_line_num = line_num;
jksoft 0:8468a4403fea 34 s_error_code = error_code;
jksoft 0:8468a4403fea 35 UNUSED_VARIABLE(s_file_name);
jksoft 0:8468a4403fea 36 UNUSED_VARIABLE(s_line_num);
jksoft 0:8468a4403fea 37 UNUSED_VARIABLE(s_error_code);
jksoft 0:8468a4403fea 38
jksoft 0:8468a4403fea 39 // WARNING: The PRIMASK register is set to disable ALL interrups during writing the error log.
jksoft 0:8468a4403fea 40 //
jksoft 0:8468a4403fea 41 // Do not use __disable_irq() in normal operation.
jksoft 0:8468a4403fea 42 __disable_irq();
jksoft 0:8468a4403fea 43
jksoft 0:8468a4403fea 44 // This function will write error code, filename, and line number to the flash.
jksoft 0:8468a4403fea 45 // In addition, the Cortex-M0 stack memory will also be written to the flash.
jksoft 0:8468a4403fea 46 //(void) ble_error_log_write(error_code, p_file_name, line_num);
jksoft 0:8468a4403fea 47
jksoft 0:8468a4403fea 48 // For debug purposes, this function never returns.
jksoft 0:8468a4403fea 49 // Attach a debugger for tracing the error cause.
jksoft 0:8468a4403fea 50 for (;;)
jksoft 0:8468a4403fea 51 {
jksoft 0:8468a4403fea 52 // Do nothing.
jksoft 0:8468a4403fea 53 }
jksoft 0:8468a4403fea 54 }
jksoft 0:8468a4403fea 55