123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #include <stdint.h>
- #include <stdbool.h>
- #include "nrf_log.h"
- #include "nrf_sdm.h"
- #include "app_util.h"
- #define APP_START_ADDR CODE_START
- uint32_t nrf_dfu_svci_vector_table_set(void)
- {
- uint32_t err_code;
- uint32_t bootloader_addr = BOOTLOADER_ADDRESS;
- if (bootloader_addr != 0xFFFFFFFF)
- {
- NRF_LOG_INFO("Setting vector table to bootloader: 0x%08x", bootloader_addr);
- err_code = sd_softdevice_vector_table_base_set(bootloader_addr);
- if (err_code != NRF_SUCCESS)
- {
- NRF_LOG_ERROR("Failed running sd_softdevice_vector_table_base_set");
- return err_code;
- }
- return NRF_SUCCESS;
- }
- NRF_LOG_ERROR("No bootloader was found");
- return NRF_ERROR_NO_MEM;
- }
- uint32_t nrf_dfu_svci_vector_table_unset(void)
- {
- uint32_t err_code;
- NRF_LOG_INFO("Setting vector table to main app: 0x%08x", APP_START_ADDR);
- err_code = sd_softdevice_vector_table_base_set(APP_START_ADDR);
- if (err_code != NRF_SUCCESS)
- {
- NRF_LOG_ERROR("Failed running sd_softdevice_vector_table_base_set");
- return err_code;
- }
- return NRF_SUCCESS;
- }
|