mbed library sources. Supersedes mbed-src.
Fork of mbed-dev by
targets/TARGET_NORDIC/TARGET_NRF5/reloc_vector_table.c@150:02e0a0aed4ec, 2016-11-08 (annotated)
- Committer:
- <>
- Date:
- Tue Nov 08 17:45:16 2016 +0000
- Revision:
- 150:02e0a0aed4ec
This updates the lib to the mbed lib v129
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 150:02e0a0aed4ec | 1 | /* |
<> | 150:02e0a0aed4ec | 2 | * Copyright (c) 2016 Nordic Semiconductor ASA |
<> | 150:02e0a0aed4ec | 3 | * All rights reserved. |
<> | 150:02e0a0aed4ec | 4 | * |
<> | 150:02e0a0aed4ec | 5 | * Redistribution and use in source and binary forms, with or without modification, |
<> | 150:02e0a0aed4ec | 6 | * are permitted provided that the following conditions are met: |
<> | 150:02e0a0aed4ec | 7 | * |
<> | 150:02e0a0aed4ec | 8 | * 1. Redistributions of source code must retain the above copyright notice, this list |
<> | 150:02e0a0aed4ec | 9 | * of conditions and the following disclaimer. |
<> | 150:02e0a0aed4ec | 10 | * |
<> | 150:02e0a0aed4ec | 11 | * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA |
<> | 150:02e0a0aed4ec | 12 | * integrated circuit in a product or a software update for such product, must reproduce |
<> | 150:02e0a0aed4ec | 13 | * the above copyright notice, this list of conditions and the following disclaimer in |
<> | 150:02e0a0aed4ec | 14 | * the documentation and/or other materials provided with the distribution. |
<> | 150:02e0a0aed4ec | 15 | * |
<> | 150:02e0a0aed4ec | 16 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be |
<> | 150:02e0a0aed4ec | 17 | * used to endorse or promote products derived from this software without specific prior |
<> | 150:02e0a0aed4ec | 18 | * written permission. |
<> | 150:02e0a0aed4ec | 19 | * |
<> | 150:02e0a0aed4ec | 20 | * 4. This software, with or without modification, must only be used with a |
<> | 150:02e0a0aed4ec | 21 | * Nordic Semiconductor ASA integrated circuit. |
<> | 150:02e0a0aed4ec | 22 | * |
<> | 150:02e0a0aed4ec | 23 | * 5. Any software provided in binary or object form under this license must not be reverse |
<> | 150:02e0a0aed4ec | 24 | * engineered, decompiled, modified and/or disassembled. |
<> | 150:02e0a0aed4ec | 25 | * |
<> | 150:02e0a0aed4ec | 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
<> | 150:02e0a0aed4ec | 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
<> | 150:02e0a0aed4ec | 28 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
<> | 150:02e0a0aed4ec | 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
<> | 150:02e0a0aed4ec | 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
<> | 150:02e0a0aed4ec | 31 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
<> | 150:02e0a0aed4ec | 32 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
<> | 150:02e0a0aed4ec | 33 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
<> | 150:02e0a0aed4ec | 34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
<> | 150:02e0a0aed4ec | 35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
<> | 150:02e0a0aed4ec | 36 | * |
<> | 150:02e0a0aed4ec | 37 | */ |
<> | 150:02e0a0aed4ec | 38 | |
<> | 150:02e0a0aed4ec | 39 | #include "nrf.h" |
<> | 150:02e0a0aed4ec | 40 | #include "cmsis_nvic.h" |
<> | 150:02e0a0aed4ec | 41 | #include "stdint.h" |
<> | 150:02e0a0aed4ec | 42 | #include "nrf_sdm.h" |
<> | 150:02e0a0aed4ec | 43 | #include "section_vars.h" |
<> | 150:02e0a0aed4ec | 44 | |
<> | 150:02e0a0aed4ec | 45 | #if defined(__CC_ARM) |
<> | 150:02e0a0aed4ec | 46 | __attribute__ ((section("noinit"),zero_init)) |
<> | 150:02e0a0aed4ec | 47 | uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS]; |
<> | 150:02e0a0aed4ec | 48 | #elif defined(__GNUC__) |
<> | 150:02e0a0aed4ec | 49 | __attribute__ ((section(".noinit"))) |
<> | 150:02e0a0aed4ec | 50 | uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS]; |
<> | 150:02e0a0aed4ec | 51 | #elif defined(__ICCARM__) |
<> | 150:02e0a0aed4ec | 52 | uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS] @ ".noinit"; |
<> | 150:02e0a0aed4ec | 53 | #endif |
<> | 150:02e0a0aed4ec | 54 | |
<> | 150:02e0a0aed4ec | 55 | |
<> | 150:02e0a0aed4ec | 56 | typedef void (*generic_irq_handler_t)(void); |
<> | 150:02e0a0aed4ec | 57 | |
<> | 150:02e0a0aed4ec | 58 | |
<> | 150:02e0a0aed4ec | 59 | extern uint32_t __Vectors[]; |
<> | 150:02e0a0aed4ec | 60 | #define VECTORS_FLASH_START __Vectors |
<> | 150:02e0a0aed4ec | 61 | |
<> | 150:02e0a0aed4ec | 62 | /** |
<> | 150:02e0a0aed4ec | 63 | * @brief Function for relocation of the vector to RAM on nRF5x devices. |
<> | 150:02e0a0aed4ec | 64 | * This function is intended to be called during startup. |
<> | 150:02e0a0aed4ec | 65 | */ |
<> | 150:02e0a0aed4ec | 66 | void nrf_reloc_vector_table(void) |
<> | 150:02e0a0aed4ec | 67 | { |
<> | 150:02e0a0aed4ec | 68 | // Copy and switch to dynamic vectors |
<> | 150:02e0a0aed4ec | 69 | uint32_t *old_vectors = (uint32_t*)VECTORS_FLASH_START; |
<> | 150:02e0a0aed4ec | 70 | uint32_t i; |
<> | 150:02e0a0aed4ec | 71 | for (i = 0; i< NVIC_NUM_VECTORS; i++) { |
<> | 150:02e0a0aed4ec | 72 | nrf_dispatch_vector[i] = old_vectors[i]; |
<> | 150:02e0a0aed4ec | 73 | } |
<> | 150:02e0a0aed4ec | 74 | |
<> | 150:02e0a0aed4ec | 75 | sd_softdevice_vector_table_base_set((uint32_t) nrf_dispatch_vector); |
<> | 150:02e0a0aed4ec | 76 | } |