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_TY51822R3/TOOLCHAIN_IAR/nrf_assert.h@171:3a7713b1edbc, 2018-11-08 (annotated)
- Committer:
- AnnaBridge
- Date:
- Thu Nov 08 11:45:42 2018 +0000
- Revision:
- 171:3a7713b1edbc
- Parent:
- TARGET_NRF51_DK/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_11/libraries/util/nrf_assert.h@169:a7c7b631e539
mbed library. Release version 164
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Anna Bridge |
169:a7c7b631e539 | 1 | /* |
Anna Bridge |
169:a7c7b631e539 | 2 | * Copyright (c) 2006 Nordic Semiconductor ASA |
Anna Bridge |
169:a7c7b631e539 | 3 | * All rights reserved. |
Anna Bridge |
169:a7c7b631e539 | 4 | * |
Anna Bridge |
169:a7c7b631e539 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
Anna Bridge |
169:a7c7b631e539 | 6 | * are permitted provided that the following conditions are met: |
Anna Bridge |
169:a7c7b631e539 | 7 | * |
Anna Bridge |
169:a7c7b631e539 | 8 | * 1. Redistributions of source code must retain the above copyright notice, this list |
Anna Bridge |
169:a7c7b631e539 | 9 | * of conditions and the following disclaimer. |
Anna Bridge |
169:a7c7b631e539 | 10 | * |
Anna Bridge |
169:a7c7b631e539 | 11 | * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA |
Anna Bridge |
169:a7c7b631e539 | 12 | * integrated circuit in a product or a software update for such product, must reproduce |
Anna Bridge |
169:a7c7b631e539 | 13 | * the above copyright notice, this list of conditions and the following disclaimer in |
Anna Bridge |
169:a7c7b631e539 | 14 | * the documentation and/or other materials provided with the distribution. |
Anna Bridge |
169:a7c7b631e539 | 15 | * |
Anna Bridge |
169:a7c7b631e539 | 16 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be |
Anna Bridge |
169:a7c7b631e539 | 17 | * used to endorse or promote products derived from this software without specific prior |
Anna Bridge |
169:a7c7b631e539 | 18 | * written permission. |
Anna Bridge |
169:a7c7b631e539 | 19 | * |
Anna Bridge |
169:a7c7b631e539 | 20 | * 4. This software, with or without modification, must only be used with a |
Anna Bridge |
169:a7c7b631e539 | 21 | * Nordic Semiconductor ASA integrated circuit. |
Anna Bridge |
169:a7c7b631e539 | 22 | * |
Anna Bridge |
169:a7c7b631e539 | 23 | * 5. Any software provided in binary or object form under this license must not be reverse |
Anna Bridge |
169:a7c7b631e539 | 24 | * engineered, decompiled, modified and/or disassembled. |
Anna Bridge |
169:a7c7b631e539 | 25 | * |
Anna Bridge |
169:a7c7b631e539 | 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
Anna Bridge |
169:a7c7b631e539 | 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
Anna Bridge |
169:a7c7b631e539 | 28 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Anna Bridge |
169:a7c7b631e539 | 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
Anna Bridge |
169:a7c7b631e539 | 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
Anna Bridge |
169:a7c7b631e539 | 31 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
Anna Bridge |
169:a7c7b631e539 | 32 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
Anna Bridge |
169:a7c7b631e539 | 33 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
Anna Bridge |
169:a7c7b631e539 | 34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
Anna Bridge |
169:a7c7b631e539 | 35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Anna Bridge |
169:a7c7b631e539 | 36 | * |
Anna Bridge |
169:a7c7b631e539 | 37 | */ |
Anna Bridge |
169:a7c7b631e539 | 38 | |
Anna Bridge |
169:a7c7b631e539 | 39 | |
Anna Bridge |
169:a7c7b631e539 | 40 | /** @file |
Anna Bridge |
169:a7c7b631e539 | 41 | * @brief Utilities for verifying program logic |
Anna Bridge |
169:a7c7b631e539 | 42 | */ |
Anna Bridge |
169:a7c7b631e539 | 43 | |
Anna Bridge |
169:a7c7b631e539 | 44 | #ifndef NRF_ASSERT_H_ |
Anna Bridge |
169:a7c7b631e539 | 45 | #define NRF_ASSERT_H_ |
Anna Bridge |
169:a7c7b631e539 | 46 | |
Anna Bridge |
169:a7c7b631e539 | 47 | #include <stdint.h> |
Anna Bridge |
169:a7c7b631e539 | 48 | #include "nrf.h" |
Anna Bridge |
169:a7c7b631e539 | 49 | #include "app_error.h" |
Anna Bridge |
169:a7c7b631e539 | 50 | |
Anna Bridge |
169:a7c7b631e539 | 51 | #ifdef __cplusplus |
Anna Bridge |
169:a7c7b631e539 | 52 | extern "C" { |
Anna Bridge |
169:a7c7b631e539 | 53 | #endif |
Anna Bridge |
169:a7c7b631e539 | 54 | |
Anna Bridge |
169:a7c7b631e539 | 55 | #if !defined(NDEBUG) && !defined(DEBUG_NRF_USER) |
Anna Bridge |
169:a7c7b631e539 | 56 | #define DEBUG_NRF_USER |
Anna Bridge |
169:a7c7b631e539 | 57 | #endif |
Anna Bridge |
169:a7c7b631e539 | 58 | |
Anna Bridge |
169:a7c7b631e539 | 59 | #if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) |
Anna Bridge |
169:a7c7b631e539 | 60 | |
Anna Bridge |
169:a7c7b631e539 | 61 | /** @brief Function for handling assertions. |
Anna Bridge |
169:a7c7b631e539 | 62 | * |
Anna Bridge |
169:a7c7b631e539 | 63 | * |
Anna Bridge |
169:a7c7b631e539 | 64 | * @note |
Anna Bridge |
169:a7c7b631e539 | 65 | * This function is called when an assertion has triggered. |
Anna Bridge |
169:a7c7b631e539 | 66 | * |
Anna Bridge |
169:a7c7b631e539 | 67 | * |
Anna Bridge |
169:a7c7b631e539 | 68 | * @post |
Anna Bridge |
169:a7c7b631e539 | 69 | * All hardware is put into an idle non-emitting state (in particular the radio is highly |
Anna Bridge |
169:a7c7b631e539 | 70 | * important to switch off since the radio might be in a state that makes it send |
Anna Bridge |
169:a7c7b631e539 | 71 | * packets continiously while a typical final infinit ASSERT loop is executing). |
Anna Bridge |
169:a7c7b631e539 | 72 | * |
Anna Bridge |
169:a7c7b631e539 | 73 | * |
Anna Bridge |
169:a7c7b631e539 | 74 | * @param line_num The line number where the assertion is called |
Anna Bridge |
169:a7c7b631e539 | 75 | * @param file_name Pointer to the file name |
Anna Bridge |
169:a7c7b631e539 | 76 | */ |
Anna Bridge |
169:a7c7b631e539 | 77 | void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); |
Anna Bridge |
169:a7c7b631e539 | 78 | |
Anna Bridge |
169:a7c7b631e539 | 79 | /*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */ |
Anna Bridge |
169:a7c7b631e539 | 80 | /*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \ |
Anna Bridge |
169:a7c7b631e539 | 81 | |
Anna Bridge |
169:a7c7b631e539 | 82 | /** @brief Function for checking intended for production code. |
Anna Bridge |
169:a7c7b631e539 | 83 | * |
Anna Bridge |
169:a7c7b631e539 | 84 | * Check passes if "expr" evaluates to true. */ |
Anna Bridge |
169:a7c7b631e539 | 85 | #define ASSERT(expr) \ |
Anna Bridge |
169:a7c7b631e539 | 86 | if (expr) \ |
Anna Bridge |
169:a7c7b631e539 | 87 | { \ |
Anna Bridge |
169:a7c7b631e539 | 88 | } \ |
Anna Bridge |
169:a7c7b631e539 | 89 | else \ |
Anna Bridge |
169:a7c7b631e539 | 90 | { \ |
Anna Bridge |
169:a7c7b631e539 | 91 | assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \ |
Anna Bridge |
169:a7c7b631e539 | 92 | } |
Anna Bridge |
169:a7c7b631e539 | 93 | #else |
Anna Bridge |
169:a7c7b631e539 | 94 | #ifndef ASSERT |
Anna Bridge |
169:a7c7b631e539 | 95 | #define ASSERT(expr) //!< Assert empty when disabled |
Anna Bridge |
169:a7c7b631e539 | 96 | __WEAK void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); |
Anna Bridge |
169:a7c7b631e539 | 97 | #endif |
Anna Bridge |
169:a7c7b631e539 | 98 | #endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */ |
Anna Bridge |
169:a7c7b631e539 | 99 | |
Anna Bridge |
169:a7c7b631e539 | 100 | #ifdef __cplusplus |
Anna Bridge |
169:a7c7b631e539 | 101 | } |
Anna Bridge |
169:a7c7b631e539 | 102 | #endif |
Anna Bridge |
169:a7c7b631e539 | 103 | |
Anna Bridge |
169:a7c7b631e539 | 104 | #endif /* NRF_ASSERT_H_ */ |