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_NRF51_DONGLE/TOOLCHAIN_IAR/bootloader.h@172:65be27845400, 2019-02-20 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Feb 20 20:53:29 2019 +0000
- Revision:
- 172:65be27845400
- Parent:
- 171:3a7713b1edbc
mbed library release version 165
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 143:86740a56073b | 1 | /* |
AnnaBridge | 143:86740a56073b | 2 | * Copyright (c) 2013 Nordic Semiconductor ASA |
AnnaBridge | 143:86740a56073b | 3 | * All rights reserved. |
AnnaBridge | 143:86740a56073b | 4 | * |
AnnaBridge | 143:86740a56073b | 5 | * Redistribution and use in source and binary forms, with or without modification, |
AnnaBridge | 143:86740a56073b | 6 | * are permitted provided that the following conditions are met: |
AnnaBridge | 143:86740a56073b | 7 | * |
AnnaBridge | 143:86740a56073b | 8 | * 1. Redistributions of source code must retain the above copyright notice, this list |
AnnaBridge | 143:86740a56073b | 9 | * of conditions and the following disclaimer. |
AnnaBridge | 143:86740a56073b | 10 | * |
AnnaBridge | 143:86740a56073b | 11 | * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA |
AnnaBridge | 143:86740a56073b | 12 | * integrated circuit in a product or a software update for such product, must reproduce |
AnnaBridge | 143:86740a56073b | 13 | * the above copyright notice, this list of conditions and the following disclaimer in |
AnnaBridge | 143:86740a56073b | 14 | * the documentation and/or other materials provided with the distribution. |
AnnaBridge | 143:86740a56073b | 15 | * |
AnnaBridge | 143:86740a56073b | 16 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be |
AnnaBridge | 143:86740a56073b | 17 | * used to endorse or promote products derived from this software without specific prior |
AnnaBridge | 143:86740a56073b | 18 | * written permission. |
AnnaBridge | 143:86740a56073b | 19 | * |
AnnaBridge | 143:86740a56073b | 20 | * 4. This software, with or without modification, must only be used with a |
AnnaBridge | 143:86740a56073b | 21 | * Nordic Semiconductor ASA integrated circuit. |
AnnaBridge | 143:86740a56073b | 22 | * |
AnnaBridge | 143:86740a56073b | 23 | * 5. Any software provided in binary or object form under this license must not be reverse |
AnnaBridge | 143:86740a56073b | 24 | * engineered, decompiled, modified and/or disassembled. |
AnnaBridge | 143:86740a56073b | 25 | * |
AnnaBridge | 143:86740a56073b | 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
AnnaBridge | 143:86740a56073b | 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
AnnaBridge | 143:86740a56073b | 28 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
AnnaBridge | 143:86740a56073b | 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
AnnaBridge | 143:86740a56073b | 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
AnnaBridge | 143:86740a56073b | 31 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
AnnaBridge | 143:86740a56073b | 32 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
AnnaBridge | 143:86740a56073b | 33 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
AnnaBridge | 143:86740a56073b | 34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
AnnaBridge | 143:86740a56073b | 35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
AnnaBridge | 143:86740a56073b | 36 | * |
AnnaBridge | 143:86740a56073b | 37 | */ |
AnnaBridge | 143:86740a56073b | 38 | |
AnnaBridge | 143:86740a56073b | 39 | |
AnnaBridge | 143:86740a56073b | 40 | /**@file |
AnnaBridge | 143:86740a56073b | 41 | * |
AnnaBridge | 143:86740a56073b | 42 | * @defgroup nrf_bootloader Bootloader API. |
AnnaBridge | 143:86740a56073b | 43 | * @{ |
AnnaBridge | 143:86740a56073b | 44 | * |
AnnaBridge | 143:86740a56073b | 45 | * @brief Bootloader module interface. |
AnnaBridge | 143:86740a56073b | 46 | */ |
AnnaBridge | 143:86740a56073b | 47 | |
AnnaBridge | 143:86740a56073b | 48 | #ifndef BOOTLOADER_H__ |
AnnaBridge | 143:86740a56073b | 49 | #define BOOTLOADER_H__ |
AnnaBridge | 143:86740a56073b | 50 | |
AnnaBridge | 143:86740a56073b | 51 | #include <stdbool.h> |
AnnaBridge | 143:86740a56073b | 52 | #include <stdint.h> |
AnnaBridge | 143:86740a56073b | 53 | #include "bootloader_types.h" |
AnnaBridge | 143:86740a56073b | 54 | #include <dfu_types.h> |
AnnaBridge | 143:86740a56073b | 55 | |
AnnaBridge | 143:86740a56073b | 56 | /**@brief Function for initializing the Bootloader. |
AnnaBridge | 143:86740a56073b | 57 | * |
AnnaBridge | 143:86740a56073b | 58 | * @retval NRF_SUCCESS If bootloader was succesfully initialized. |
AnnaBridge | 143:86740a56073b | 59 | */ |
AnnaBridge | 143:86740a56073b | 60 | uint32_t bootloader_init(void); |
AnnaBridge | 143:86740a56073b | 61 | |
AnnaBridge | 143:86740a56073b | 62 | /**@brief Function for validating application region in flash. |
AnnaBridge | 143:86740a56073b | 63 | * |
AnnaBridge | 143:86740a56073b | 64 | * @param[in] app_addr Address to the region in flash where the application is stored. |
AnnaBridge | 143:86740a56073b | 65 | * |
AnnaBridge | 143:86740a56073b | 66 | * @retval true If Application region is valid. |
AnnaBridge | 143:86740a56073b | 67 | * @retval false If Application region is not valid. |
AnnaBridge | 143:86740a56073b | 68 | */ |
AnnaBridge | 143:86740a56073b | 69 | bool bootloader_app_is_valid(uint32_t app_addr); |
AnnaBridge | 143:86740a56073b | 70 | |
AnnaBridge | 143:86740a56073b | 71 | /**@brief Function for starting the Device Firmware Update. |
AnnaBridge | 143:86740a56073b | 72 | * |
AnnaBridge | 143:86740a56073b | 73 | * @retval NRF_SUCCESS If new application image was successfully transferred. |
AnnaBridge | 143:86740a56073b | 74 | */ |
AnnaBridge | 143:86740a56073b | 75 | uint32_t bootloader_dfu_start(void); |
AnnaBridge | 143:86740a56073b | 76 | |
AnnaBridge | 143:86740a56073b | 77 | /**@brief Function for exiting bootloader and booting into application. |
AnnaBridge | 143:86740a56073b | 78 | * |
AnnaBridge | 143:86740a56073b | 79 | * @details This function will disable SoftDevice and all interrupts before jumping to application. |
AnnaBridge | 143:86740a56073b | 80 | * The SoftDevice vector table base for interrupt forwarding will be set the application |
AnnaBridge | 143:86740a56073b | 81 | * address. |
AnnaBridge | 143:86740a56073b | 82 | * |
AnnaBridge | 143:86740a56073b | 83 | * @param[in] app_addr Address to the region where the application is stored. |
AnnaBridge | 143:86740a56073b | 84 | */ |
AnnaBridge | 143:86740a56073b | 85 | void bootloader_app_start(uint32_t app_addr); |
AnnaBridge | 143:86740a56073b | 86 | |
AnnaBridge | 143:86740a56073b | 87 | /**@brief Function for retrieving the bootloader settings. |
AnnaBridge | 143:86740a56073b | 88 | * |
AnnaBridge | 143:86740a56073b | 89 | * @param[out] p_settings A copy of the current bootloader settings is returned in the structure |
AnnaBridge | 143:86740a56073b | 90 | * provided. |
AnnaBridge | 143:86740a56073b | 91 | */ |
AnnaBridge | 143:86740a56073b | 92 | void bootloader_settings_get(bootloader_settings_t * const p_settings); |
AnnaBridge | 143:86740a56073b | 93 | |
AnnaBridge | 143:86740a56073b | 94 | /**@brief Function for processing DFU status update. |
AnnaBridge | 143:86740a56073b | 95 | * |
AnnaBridge | 143:86740a56073b | 96 | * @param[in] update_status DFU update status. |
AnnaBridge | 143:86740a56073b | 97 | */ |
AnnaBridge | 143:86740a56073b | 98 | void bootloader_dfu_update_process(dfu_update_status_t update_status); |
AnnaBridge | 143:86740a56073b | 99 | |
AnnaBridge | 143:86740a56073b | 100 | /**@brief Function getting state of SoftDevice update in progress. |
AnnaBridge | 143:86740a56073b | 101 | * After a successfull SoftDevice transfer the system restarts in orderto disable SoftDevice |
AnnaBridge | 143:86740a56073b | 102 | * and complete the update. |
AnnaBridge | 143:86740a56073b | 103 | * |
AnnaBridge | 143:86740a56073b | 104 | * @retval true A SoftDevice update is in progress. This indicates that second stage |
AnnaBridge | 143:86740a56073b | 105 | * of a SoftDevice update procedure can be initiated. |
AnnaBridge | 143:86740a56073b | 106 | * @retval false No SoftDevice update is in progress. |
AnnaBridge | 143:86740a56073b | 107 | */ |
AnnaBridge | 143:86740a56073b | 108 | bool bootloader_dfu_sd_in_progress(void); |
AnnaBridge | 143:86740a56073b | 109 | |
AnnaBridge | 143:86740a56073b | 110 | /**@brief Function for continuing the Device Firmware Update of a SoftDevice. |
AnnaBridge | 143:86740a56073b | 111 | * |
AnnaBridge | 143:86740a56073b | 112 | * @retval NRF_SUCCESS If the final stage of SoftDevice update was successful. |
AnnaBridge | 143:86740a56073b | 113 | */ |
AnnaBridge | 143:86740a56073b | 114 | uint32_t bootloader_dfu_sd_update_continue(void); |
AnnaBridge | 143:86740a56073b | 115 | |
AnnaBridge | 143:86740a56073b | 116 | /**@brief Function for finalizing the Device Firmware Update of a SoftDevice. |
AnnaBridge | 143:86740a56073b | 117 | * |
AnnaBridge | 143:86740a56073b | 118 | * @retval NRF_SUCCESS If the final stage of SoftDevice update was successful. |
AnnaBridge | 143:86740a56073b | 119 | */ |
AnnaBridge | 143:86740a56073b | 120 | uint32_t bootloader_dfu_sd_update_finalize(void); |
AnnaBridge | 143:86740a56073b | 121 | |
AnnaBridge | 143:86740a56073b | 122 | #endif // BOOTLOADER_H__ |
AnnaBridge | 143:86740a56073b | 123 | |
AnnaBridge | 143:86740a56073b | 124 | /**@} */ |