diff --git a/.rat-excludes b/.rat-excludes index 6c490eda30..ffe4164e4a 100644 --- a/.rat-excludes +++ b/.rat-excludes @@ -171,7 +171,6 @@ startup_MK64F12.S MK82FN256xxx15_flash.ld boot-MK82FN256xxx15_flash.ld startup_MK82F25615.S -system_MK82F25615.c fsl_ftfx_controller.c # LWIP - BSD License. diff --git a/hw/bsp/ada_feather_nrf52/src/hal_bsp.c b/hw/bsp/ada_feather_nrf52/src/hal_bsp.c index 41e6d1f661..d49d805a17 100644 --- a/hw/bsp/ada_feather_nrf52/src/hal_bsp.c +++ b/hw/bsp/ada_feather_nrf52/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -105,4 +106,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/ada_feather_stm32f405/src/hal_bsp.c b/hw/bsp/ada_feather_stm32f405/src/hal_bsp.c index f46cae54ed..1c7a0e1f8b 100644 --- a/hw/bsp/ada_feather_stm32f405/src/hal_bsp.c +++ b/hw/bsp/ada_feather_stm32f405/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -309,4 +310,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/apollo2_evb/src/hal_bsp.c b/hw/bsp/apollo2_evb/src/hal_bsp.c index 3c29955c75..a349e8a19b 100644 --- a/hw/bsp/apollo2_evb/src/hal_bsp.c +++ b/hw/bsp/apollo2_evb/src/hal_bsp.c @@ -24,6 +24,7 @@ #include #include #include +#include "mynewt_cm.h" #if MYNEWT_VAL(UART_0) #include "uart/uart.h" @@ -184,6 +185,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } int diff --git a/hw/bsp/apollo2_evb/src/system_apollo2.c b/hw/bsp/apollo2_evb/src/system_apollo2.c index 034a4d3b0b..56b72d0736 100644 --- a/hw/bsp/apollo2_evb/src/system_apollo2.c +++ b/hw/bsp/apollo2_evb/src/system_apollo2.c @@ -109,7 +109,5 @@ SystemInit(void) CLKGEN->CLKKEY = 0; // Disable write to CCTRL SystemCoreClockUpdate(); - - NVIC_Relocate(); } diff --git a/hw/bsp/apollo3_evb/src/hal_bsp.c b/hw/bsp/apollo3_evb/src/hal_bsp.c index d49ac016cf..78fa1bcf86 100644 --- a/hw/bsp/apollo3_evb/src/hal_bsp.c +++ b/hw/bsp/apollo3_evb/src/hal_bsp.c @@ -22,6 +22,7 @@ #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "flash_map/flash_map.h" @@ -70,6 +71,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } int diff --git a/hw/bsp/apollo3_evb/src/system_apollo3.c b/hw/bsp/apollo3_evb/src/system_apollo3.c index 2ae2b45e8d..89965ef422 100644 --- a/hw/bsp/apollo3_evb/src/system_apollo3.c +++ b/hw/bsp/apollo3_evb/src/system_apollo3.c @@ -112,7 +112,5 @@ SystemInit(void) CLKGEN->CLKKEY = 0; // Disable write to CCTRL SystemCoreClockUpdate(); - - NVIC_Relocate(); } diff --git a/hw/bsp/arduino_primo_nrf52/src/hal_bsp.c b/hw/bsp/arduino_primo_nrf52/src/hal_bsp.c index 459ae7f557..2a464dd52c 100644 --- a/hw/bsp/arduino_primo_nrf52/src/hal_bsp.c +++ b/hw/bsp/arduino_primo_nrf52/src/hal_bsp.c @@ -20,6 +20,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "bsp/bsp.h" #include "hal/hal_bsp.h" @@ -104,4 +105,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/arduino_zero/src/hal_bsp.c b/hw/bsp/arduino_zero/src/hal_bsp.c index 9f4da9171b..06b9fe6023 100644 --- a/hw/bsp/arduino_zero/src/hal_bsp.c +++ b/hw/bsp/arduino_zero/src/hal_bsp.c @@ -26,6 +26,7 @@ #include "sysinit/sysinit.h" #include "mcu/samd21.h" #include "bsp/bsp.h" +#include "mynewt_cm.h" /* * hw/mcu/atmel/samd21xx/src/sam0/drivers/tc/tc.h @@ -213,5 +214,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { - + Cortex_DisableAll(); } diff --git a/hw/bsp/b-l072z-lrwan1/src/hal_bsp.c b/hw/bsp/b-l072z-lrwan1/src/hal_bsp.c index 9d29775abe..9631831b7b 100644 --- a/hw/bsp/b-l072z-lrwan1/src/hal_bsp.c +++ b/hw/bsp/b-l072z-lrwan1/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -136,6 +137,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } /** diff --git a/hw/bsp/b-l475e-iot01a/src/hal_bsp.c b/hw/bsp/b-l475e-iot01a/src/hal_bsp.c index 9f10e78e5a..cf1a8070b6 100644 --- a/hw/bsp/b-l475e-iot01a/src/hal_bsp.c +++ b/hw/bsp/b-l475e-iot01a/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -173,6 +174,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } /** diff --git a/hw/bsp/bbc_microbit/src/hal_bsp.c b/hw/bsp/bbc_microbit/src/hal_bsp.c index 52802ae415..e09a2692ef 100644 --- a/hw/bsp/bbc_microbit/src/hal_bsp.c +++ b/hw/bsp/bbc_microbit/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "hal/hal_system.h" #include "bsp/bsp.h" @@ -226,4 +227,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/black_vet6/src/hal_bsp.c b/hw/bsp/black_vet6/src/hal_bsp.c index 589b73d665..c63c10a722 100644 --- a/hw/bsp/black_vet6/src/hal_bsp.c +++ b/hw/bsp/black_vet6/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -352,6 +353,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHB1ENR = RCC_AHB1ENR_CCMDATARAMEN; RCC->AHB2ENR = 0x0; RCC->AHB3ENR = 0x0; diff --git a/hw/bsp/ble400/src/hal_bsp.c b/hw/bsp/ble400/src/hal_bsp.c index 12405cde7a..7a897d2bb6 100644 --- a/hw/bsp/ble400/src/hal_bsp.c +++ b/hw/bsp/ble400/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "hal/hal_bsp.h" #include "hal/hal_system.h" #include "mcu/nrf51_hal.h" @@ -228,4 +229,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/bluepill/src/hal_bsp.c b/hw/bsp/bluepill/src/hal_bsp.c index b8cced159a..4161f940d9 100644 --- a/hw/bsp/bluepill/src/hal_bsp.c +++ b/hw/bsp/bluepill/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -95,6 +96,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHBENR = RCC_AHBENR_FLITFEN | RCC_AHBENR_SRAMEN; RCC->APB1ENR = 0; RCC->APB2ENR = 0; diff --git a/hw/bsp/bmd200/src/hal_bsp.c b/hw/bsp/bmd200/src/hal_bsp.c index 12405cde7a..7a897d2bb6 100644 --- a/hw/bsp/bmd200/src/hal_bsp.c +++ b/hw/bsp/bmd200/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "hal/hal_bsp.h" #include "hal/hal_system.h" #include "mcu/nrf51_hal.h" @@ -228,4 +229,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/bmd300eval/src/hal_bsp.c b/hw/bsp/bmd300eval/src/hal_bsp.c index 022729629c..2156debbab 100644 --- a/hw/bsp/bmd300eval/src/hal_bsp.c +++ b/hw/bsp/bmd300eval/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -105,4 +106,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/calliope_mini/src/hal_bsp.c b/hw/bsp/calliope_mini/src/hal_bsp.c index a39b6136b0..70f5da2f90 100644 --- a/hw/bsp/calliope_mini/src/hal_bsp.c +++ b/hw/bsp/calliope_mini/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "hal/hal_system.h" #include "bsp/bsp.h" @@ -228,4 +229,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/dialog_da14695-dk-usb/src/hal_bsp.c b/hw/bsp/dialog_da14695-dk-usb/src/hal_bsp.c index f5e0ca2297..58fa91f27d 100644 --- a/hw/bsp/dialog_da14695-dk-usb/src/hal_bsp.c +++ b/hw/bsp/dialog_da14695-dk-usb/src/hal_bsp.c @@ -24,6 +24,7 @@ #include "hal/hal_flash.h" #include "hal/hal_system.h" #include "mcu/mcu.h" +#include "mynewt_cm.h" #include "mcu/da1469x_hal.h" #include "mcu/da1469x_periph.h" #include "bsp/bsp.h" @@ -109,4 +110,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/dialog_da1469x-dk-pro/src/hal_bsp.c b/hw/bsp/dialog_da1469x-dk-pro/src/hal_bsp.c index 809888a783..5509a88343 100644 --- a/hw/bsp/dialog_da1469x-dk-pro/src/hal_bsp.c +++ b/hw/bsp/dialog_da1469x-dk-pro/src/hal_bsp.c @@ -24,6 +24,7 @@ #include "hal/hal_flash.h" #include "hal/hal_system.h" #include "mcu/mcu.h" +#include "mynewt_cm.h" #include "mcu/da1469x_hal.h" #include "mcu/da1469x_periph.h" #include "bsp/bsp.h" @@ -110,4 +111,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/dwm1001-dev/src/hal_bsp.c b/hw/bsp/dwm1001-dev/src/hal_bsp.c index 3bb0c712cd..2e53db04b6 100644 --- a/hw/bsp/dwm1001-dev/src/hal_bsp.c +++ b/hw/bsp/dwm1001-dev/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -106,4 +107,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/fanstel-ev-bt840/src/hal_bsp.c b/hw/bsp/fanstel-ev-bt840/src/hal_bsp.c index 419466728c..56f2592b33 100644 --- a/hw/bsp/fanstel-ev-bt840/src/hal_bsp.c +++ b/hw/bsp/fanstel-ev-bt840/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -90,4 +91,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/frdm-k64f/src/hal_bsp.c b/hw/bsp/frdm-k64f/src/hal_bsp.c index e0fe433752..bed6255cc4 100644 --- a/hw/bsp/frdm-k64f/src/hal_bsp.c +++ b/hw/bsp/frdm-k64f/src/hal_bsp.c @@ -23,6 +23,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "bsp/bsp.h" #include "hal/hal_bsp.h" #include "hal/hal_flash_int.h" @@ -270,4 +271,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/frdm-k82f/bsp.yml b/hw/bsp/frdm-k82f/bsp.yml index 24bf0a5e68..3bcc59fc2f 100644 --- a/hw/bsp/frdm-k82f/bsp.yml +++ b/hw/bsp/frdm-k82f/bsp.yml @@ -22,12 +22,9 @@ bsp.url: https://www.nxp.com/design/design-center/development-boards-and-designs bsp.maker: "NXP" bsp.arch: cortex_m4 bsp.compiler: compiler/arm-none-eabi-m4 -bsp.linkerscript: "hw/bsp/frdm-k82f/MK82FN256xxx15_flash.ld" -bsp.linkerscript.BOOT_LOADER.OVERWRITE: "hw/bsp/frdm-k82f/boot-MK82FN256xxx15_flash.ld" +bsp.linkerscript: autogenerated bsp.downloadscript: "hw/bsp/frdm-k82f/frdm-k82_download.sh" bsp.debugscript: "hw/bsp/frdm-k82f/frdm-k82_debug.sh" -bsp.downloadscript.WINDOWS.OVERWRITE: "hw/bsp/frdm-k82f/frdm-k82_download.cmd" -bsp.debugscript.WINDOWS.OVERWRITE: "hw/bsp/frdm-k82f/frdm-k82_debug.cmd" bsp.flash_map: areas: diff --git a/hw/bsp/frdm-k82f/frdm-k82_debug.cmd b/hw/bsp/frdm-k82f/frdm-k82_debug.cmd deleted file mode 100755 index 96f0b26050..0000000000 --- a/hw/bsp/frdm-k82f/frdm-k82_debug.cmd +++ /dev/null @@ -1,22 +0,0 @@ -@rem -@rem Licensed to the Apache Software Foundation (ASF) under one -@rem or more contributor license agreements. See the NOTICE file -@rem distributed with this work for additional information -@rem regarding copyright ownership. The ASF licenses this file -@rem to you under the Apache License, Version 2.0 (the -@rem "License"); you may not use this file except in compliance -@rem with the License. You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, -@rem software distributed under the License is distributed on an -@rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@rem KIND, either express or implied. See the License for the -@rem specific language governing permissions and limitations -@rem under the License. -@rem - -@rem Execute a shell with a script of the same name and .sh extension - -@bash "%~dp0%~n0.sh" diff --git a/hw/bsp/frdm-k82f/frdm-k82_download.cmd b/hw/bsp/frdm-k82f/frdm-k82_download.cmd deleted file mode 100755 index 96f0b26050..0000000000 --- a/hw/bsp/frdm-k82f/frdm-k82_download.cmd +++ /dev/null @@ -1,22 +0,0 @@ -@rem -@rem Licensed to the Apache Software Foundation (ASF) under one -@rem or more contributor license agreements. See the NOTICE file -@rem distributed with this work for additional information -@rem regarding copyright ownership. The ASF licenses this file -@rem to you under the Apache License, Version 2.0 (the -@rem "License"); you may not use this file except in compliance -@rem with the License. You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, -@rem software distributed under the License is distributed on an -@rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@rem KIND, either express or implied. See the License for the -@rem specific language governing permissions and limitations -@rem under the License. -@rem - -@rem Execute a shell with a script of the same name and .sh extension - -@bash "%~dp0%~n0.sh" diff --git a/hw/bsp/frdm-k82f/pkg.yml b/hw/bsp/frdm-k82f/pkg.yml index 8f3b7974b3..fbf96dc0a8 100644 --- a/hw/bsp/frdm-k82f/pkg.yml +++ b/hw/bsp/frdm-k82f/pkg.yml @@ -44,6 +44,7 @@ pkg.cflags.HARDFLOAT: pkg.deps: - "@apache-mynewt-core/hw/mcu/nxp/kinetis/MK8xF/MK82F" - "@apache-mynewt-core/libc" + - "@apache-mynewt-core/boot/startup" pkg.deps.UART_0: - "@apache-mynewt-core/hw/drivers/uart/uart_hal" diff --git a/hw/bsp/frdm-k82f/src/hal_bsp.c b/hw/bsp/frdm-k82f/src/hal_bsp.c index 973d5ba247..618d66020f 100644 --- a/hw/bsp/frdm-k82f/src/hal_bsp.c +++ b/hw/bsp/frdm-k82f/src/hal_bsp.c @@ -23,6 +23,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "bsp/bsp.h" #include "hal/hal_bsp.h" #include "hal/hal_flash_int.h" @@ -191,38 +192,6 @@ hal_bsp_power_state(int state) return (0); } -/*! - * @brief Function to override ARMGCC default function _sbrk - * - * _sbrk is called by malloc. ARMGCC default _sbrk compares "SP" register and - * heap end, if heap end is larger than "SP", then _sbrk returns error and - * memory allocation failed. This function changes to compare __HeapLimit with - * heap end. - */ -void * -_sbrk(int incr) -{ - extern char end __asm("end"); - extern char heap_limit __asm("__HeapLimit"); - static char *heap_end; - char *prev_heap_end; - - if (heap_end == NULL) - heap_end = &end; - - prev_heap_end = heap_end; - - if (heap_end + incr > &heap_limit) - { - errno = ENOMEM; - return (void *)-1; - } - - heap_end += incr; - - return (void *)prev_heap_end; -} - /** * Returns the configured priority for the given interrupt. If no priority * configured, return the priority passed in @@ -352,4 +321,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/frdm-k82f/syscfg.yml b/hw/bsp/frdm-k82f/syscfg.yml index 3cb11043d8..4292a94a08 100644 --- a/hw/bsp/frdm-k82f/syscfg.yml +++ b/hw/bsp/frdm-k82f/syscfg.yml @@ -23,6 +23,8 @@ syscfg.defs: value: 1 syscfg.vals: + MCU_RAM_SIZE: 0x40000 + MCU_RAM_START: 0x20000000 # Enabled by default, connected to CMSIS-DAP Interface UART_4: 1 UART_4_PORT: PORTC @@ -93,6 +95,3 @@ syscfg.vals: CRYPTO_HW_AES_CTR: 1 BOOTUTIL_SWAP_USING_MOVE: 1 - - # BSP uses private version of _sbrk - HAL_SBRK: 0 diff --git a/hw/bsp/lpcxpresso55s28/src/hal_bsp.c b/hw/bsp/lpcxpresso55s28/src/hal_bsp.c index 1e3953dee8..42b84ee589 100644 --- a/hw/bsp/lpcxpresso55s28/src/hal_bsp.c +++ b/hw/bsp/lpcxpresso55s28/src/hal_bsp.c @@ -23,6 +23,7 @@ #include #include #include +#include "mynewt_cm.h" #include #include #include @@ -182,4 +183,5 @@ hal_bsp_hw_id(uint8_t *id, int max_len) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nordic_pca10028-16k/src/hal_bsp.c b/hw/bsp/nordic_pca10028-16k/src/hal_bsp.c index 0042519e6c..6a7ff7d253 100644 --- a/hw/bsp/nordic_pca10028-16k/src/hal_bsp.c +++ b/hw/bsp/nordic_pca10028-16k/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "hal/hal_bsp.h" #include "hal/hal_system.h" #include "mcu/nrf51_hal.h" @@ -230,4 +231,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nordic_pca10028/src/hal_bsp.c b/hw/bsp/nordic_pca10028/src/hal_bsp.c index 943df05336..8e7590639c 100644 --- a/hw/bsp/nordic_pca10028/src/hal_bsp.c +++ b/hw/bsp/nordic_pca10028/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "hal/hal_bsp.h" #include "hal/hal_system.h" #include "mcu/nrf51_hal.h" @@ -230,4 +231,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nordic_pca10040/src/hal_bsp.c b/hw/bsp/nordic_pca10040/src/hal_bsp.c index b33572c17e..c7bd06f9ce 100644 --- a/hw/bsp/nordic_pca10040/src/hal_bsp.c +++ b/hw/bsp/nordic_pca10040/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -124,4 +125,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nordic_pca10056/src/hal_bsp.c b/hw/bsp/nordic_pca10056/src/hal_bsp.c index f62e287d74..5d1a289d61 100644 --- a/hw/bsp/nordic_pca10056/src/hal_bsp.c +++ b/hw/bsp/nordic_pca10056/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -108,6 +109,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } #if MYNEWT_VAL(BSP_USE_HAL_SPI) diff --git a/hw/bsp/nordic_pca10059/src/hal_bsp.c b/hw/bsp/nordic_pca10059/src/hal_bsp.c index f62e287d74..5d1a289d61 100644 --- a/hw/bsp/nordic_pca10059/src/hal_bsp.c +++ b/hw/bsp/nordic_pca10059/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -108,6 +109,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } #if MYNEWT_VAL(BSP_USE_HAL_SPI) diff --git a/hw/bsp/nordic_pca10090/src/hal_bsp.c b/hw/bsp/nordic_pca10090/src/hal_bsp.c index 1d88dca424..21ee9fe5e9 100644 --- a/hw/bsp/nordic_pca10090/src/hal_bsp.c +++ b/hw/bsp/nordic_pca10090/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -99,4 +100,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nordic_pca10095/src/hal_bsp.c b/hw/bsp/nordic_pca10095/src/hal_bsp.c index c491b9684e..b52c095ae0 100644 --- a/hw/bsp/nordic_pca10095/src/hal_bsp.c +++ b/hw/bsp/nordic_pca10095/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include +#include "mynewt_cm.h" #include #include #include @@ -105,4 +106,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nordic_pca10095_net/src/hal_bsp.c b/hw/bsp/nordic_pca10095_net/src/hal_bsp.c index d26bce94ad..7476031be4 100644 --- a/hw/bsp/nordic_pca10095_net/src/hal_bsp.c +++ b/hw/bsp/nordic_pca10095_net/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include +#include "mynewt_cm.h" #include #include #include @@ -105,4 +106,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nordic_pca10121/net/src/hal_bsp.c b/hw/bsp/nordic_pca10121/net/src/hal_bsp.c index d26bce94ad..7476031be4 100644 --- a/hw/bsp/nordic_pca10121/net/src/hal_bsp.c +++ b/hw/bsp/nordic_pca10121/net/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include +#include "mynewt_cm.h" #include #include #include @@ -105,4 +106,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nordic_pca10121/src/hal_bsp.c b/hw/bsp/nordic_pca10121/src/hal_bsp.c index 68a0054172..4be822e72f 100644 --- a/hw/bsp/nordic_pca10121/src/hal_bsp.c +++ b/hw/bsp/nordic_pca10121/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include +#include "mynewt_cm.h" #include #include #include @@ -119,4 +120,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nordic_pca20020/src/hal_bsp.c b/hw/bsp/nordic_pca20020/src/hal_bsp.c index 2ab8a3e4c1..c9a8c90bc8 100644 --- a/hw/bsp/nordic_pca20020/src/hal_bsp.c +++ b/hw/bsp/nordic_pca20020/src/hal_bsp.c @@ -22,6 +22,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -165,4 +166,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nordic_thingy53/src/hal_bsp.c b/hw/bsp/nordic_thingy53/src/hal_bsp.c index c491b9684e..b52c095ae0 100644 --- a/hw/bsp/nordic_thingy53/src/hal_bsp.c +++ b/hw/bsp/nordic_thingy53/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include +#include "mynewt_cm.h" #include #include #include @@ -105,4 +106,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nrf51-arduino_101/src/hal_bsp.c b/hw/bsp/nrf51-arduino_101/src/hal_bsp.c index 26076d6504..7b3ad00698 100644 --- a/hw/bsp/nrf51-arduino_101/src/hal_bsp.c +++ b/hw/bsp/nrf51-arduino_101/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include #include @@ -228,4 +229,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nrf51-blenano/src/hal_bsp.c b/hw/bsp/nrf51-blenano/src/hal_bsp.c index 5dc79ab387..6170f1c708 100644 --- a/hw/bsp/nrf51-blenano/src/hal_bsp.c +++ b/hw/bsp/nrf51-blenano/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "hal/hal_system.h" #include "bsp/bsp.h" @@ -229,4 +230,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nucleo-f030r8/src/hal_bsp.c b/hw/bsp/nucleo-f030r8/src/hal_bsp.c index fab06af5c3..2eea79404f 100644 --- a/hw/bsp/nucleo-f030r8/src/hal_bsp.c +++ b/hw/bsp/nucleo-f030r8/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -126,4 +127,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nucleo-f072rb/src/hal_bsp.c b/hw/bsp/nucleo-f072rb/src/hal_bsp.c index c5166f47d5..33eb9d070e 100644 --- a/hw/bsp/nucleo-f072rb/src/hal_bsp.c +++ b/hw/bsp/nucleo-f072rb/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -133,4 +134,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nucleo-f103rb/src/hal_bsp.c b/hw/bsp/nucleo-f103rb/src/hal_bsp.c index 79530778b8..8455bad441 100644 --- a/hw/bsp/nucleo-f103rb/src/hal_bsp.c +++ b/hw/bsp/nucleo-f103rb/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -143,6 +144,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHBENR = RCC_AHBENR_FLITFEN | RCC_AHBENR_SRAMEN; RCC->APB1ENR = 0; RCC->APB2ENR = 0; diff --git a/hw/bsp/nucleo-f303re/src/hal_bsp.c b/hw/bsp/nucleo-f303re/src/hal_bsp.c index 48ff5832e8..459b4a316d 100644 --- a/hw/bsp/nucleo-f303re/src/hal_bsp.c +++ b/hw/bsp/nucleo-f303re/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -135,4 +136,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/nucleo-f401re/src/hal_bsp.c b/hw/bsp/nucleo-f401re/src/hal_bsp.c index 306bbd9474..bbb9692f28 100644 --- a/hw/bsp/nucleo-f401re/src/hal_bsp.c +++ b/hw/bsp/nucleo-f401re/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -117,6 +118,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHB1ENR = 0; RCC->AHB2ENR = 0; RCC->APB1ENR = 0; diff --git a/hw/bsp/nucleo-f411re/src/hal_bsp.c b/hw/bsp/nucleo-f411re/src/hal_bsp.c index 8bd11f55d6..294798eef0 100644 --- a/hw/bsp/nucleo-f411re/src/hal_bsp.c +++ b/hw/bsp/nucleo-f411re/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -171,6 +172,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHB1ENR = 0; RCC->AHB2ENR = 0; RCC->APB1ENR = 0; diff --git a/hw/bsp/nucleo-f413zh/src/hal_bsp.c b/hw/bsp/nucleo-f413zh/src/hal_bsp.c index cac1f7c4cb..bc9ead4347 100644 --- a/hw/bsp/nucleo-f413zh/src/hal_bsp.c +++ b/hw/bsp/nucleo-f413zh/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -123,6 +124,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } /** diff --git a/hw/bsp/nucleo-f439zi/src/hal_bsp.c b/hw/bsp/nucleo-f439zi/src/hal_bsp.c index c32d537522..16e791dbb6 100644 --- a/hw/bsp/nucleo-f439zi/src/hal_bsp.c +++ b/hw/bsp/nucleo-f439zi/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -188,6 +189,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } /** diff --git a/hw/bsp/nucleo-f746zg/src/hal_bsp.c b/hw/bsp/nucleo-f746zg/src/hal_bsp.c index 08815d4478..826a73bc9b 100644 --- a/hw/bsp/nucleo-f746zg/src/hal_bsp.c +++ b/hw/bsp/nucleo-f746zg/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -185,6 +186,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } /** diff --git a/hw/bsp/nucleo-f767zi/src/hal_bsp.c b/hw/bsp/nucleo-f767zi/src/hal_bsp.c index 8fc726600b..7c9d92a12e 100644 --- a/hw/bsp/nucleo-f767zi/src/hal_bsp.c +++ b/hw/bsp/nucleo-f767zi/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -229,6 +230,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } /** diff --git a/hw/bsp/nucleo-g0b1re/src/hal_bsp.c b/hw/bsp/nucleo-g0b1re/src/hal_bsp.c index 3d20627307..c87ddb9a0b 100644 --- a/hw/bsp/nucleo-g0b1re/src/hal_bsp.c +++ b/hw/bsp/nucleo-g0b1re/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include "spiflash/spiflash.h" #include @@ -254,6 +255,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHBENR = 0x00000100; RCC->APBENR1 = 0x00000000; RCC->APBENR2 = 0x00000000; diff --git a/hw/bsp/nucleo-g491re/src/hal_bsp.c b/hw/bsp/nucleo-g491re/src/hal_bsp.c index 8384d2322e..53fe12429b 100644 --- a/hw/bsp/nucleo-g491re/src/hal_bsp.c +++ b/hw/bsp/nucleo-g491re/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include "spiflash/spiflash.h" #include @@ -211,6 +212,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHB1ENR = 0x00000100; RCC->AHB2ENR = 0x00000000; RCC->AHB3ENR = 0x80000000; diff --git a/hw/bsp/nucleo-h723zg/src/hal_bsp.c b/hw/bsp/nucleo-h723zg/src/hal_bsp.c index 6cbf95d1fc..5c1073f0be 100644 --- a/hw/bsp/nucleo-h723zg/src/hal_bsp.c +++ b/hw/bsp/nucleo-h723zg/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include "spiflash/spiflash.h" #include @@ -237,6 +238,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHB1ENR = 0; RCC->AHB2ENR = 0; RCC->AHB3ENR = 0; diff --git a/hw/bsp/nucleo-l073rz/src/hal_bsp.c b/hw/bsp/nucleo-l073rz/src/hal_bsp.c index d9f07db3b0..9880d79475 100644 --- a/hw/bsp/nucleo-l073rz/src/hal_bsp.c +++ b/hw/bsp/nucleo-l073rz/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -164,6 +165,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHBENR = 0x00000100; RCC->APB1ENR = 0; RCC->APB2ENR = 0; diff --git a/hw/bsp/nucleo-l476rg/src/hal_bsp.c b/hw/bsp/nucleo-l476rg/src/hal_bsp.c index cd3157d162..9020ccb2c2 100644 --- a/hw/bsp/nucleo-l476rg/src/hal_bsp.c +++ b/hw/bsp/nucleo-l476rg/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -147,6 +148,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHB1ENR = RCC_AHB1ENR_FLASHEN; RCC->AHB2ENR = 0; RCC->AHB3ENR = 0; diff --git a/hw/bsp/nucleo-u575zi-q/src/hal_bsp.c b/hw/bsp/nucleo-u575zi-q/src/hal_bsp.c index 506de08072..0de8f1c9c9 100644 --- a/hw/bsp/nucleo-u575zi-q/src/hal_bsp.c +++ b/hw/bsp/nucleo-u575zi-q/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include "spiflash/spiflash.h" #include @@ -203,6 +204,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHB1ENR = 0xD0000100; RCC->AHB2ENR1 = 0xC0000000; RCC->AHB2ENR2 = 0; diff --git a/hw/bsp/olimex-p103/src/hal_bsp.c b/hw/bsp/olimex-p103/src/hal_bsp.c index 59a2d9567f..91336da09d 100644 --- a/hw/bsp/olimex-p103/src/hal_bsp.c +++ b/hw/bsp/olimex-p103/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -95,6 +96,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } /** diff --git a/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c b/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c index 297b2b0a34..02cd545d1b 100644 --- a/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c +++ b/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -309,4 +310,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/p-nucleo-wb55-usbdongle/src/hal_bsp.c b/hw/bsp/p-nucleo-wb55-usbdongle/src/hal_bsp.c index 7f276cfb07..13db4f60e6 100644 --- a/hw/bsp/p-nucleo-wb55-usbdongle/src/hal_bsp.c +++ b/hw/bsp/p-nucleo-wb55-usbdongle/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -120,6 +121,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHB1ENR = 0; RCC->AHB2ENR = 0; RCC->AHB3ENR = RCC_AHB3ENR_FLASHEN | RCC_AHB3ENR_HSEMEN; diff --git a/hw/bsp/p-nucleo-wb55/src/hal_bsp.c b/hw/bsp/p-nucleo-wb55/src/hal_bsp.c index 6e289b1c2e..8c2caaf086 100644 --- a/hw/bsp/p-nucleo-wb55/src/hal_bsp.c +++ b/hw/bsp/p-nucleo-wb55/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -95,6 +96,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHB1ENR = 0; RCC->AHB2ENR = 0; RCC->AHB3ENR = RCC_AHB3ENR_FLASHEN | RCC_AHB3ENR_HSEMEN; diff --git a/hw/bsp/pinetime/src/hal_bsp.c b/hw/bsp/pinetime/src/hal_bsp.c index 723916cb78..66bfe5bcb9 100644 --- a/hw/bsp/pinetime/src/hal_bsp.c +++ b/hw/bsp/pinetime/src/hal_bsp.c @@ -27,6 +27,7 @@ #include "hal/hal_bsp.h" #include "os/os.h" #include "bsp/bsp.h" +#include "mynewt_cm.h" #include "mcu/nrf52_hal.h" #include "mcu/nrf52_periph.h" #if MYNEWT_VAL(BSP_CHARGER) @@ -240,4 +241,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/puckjs/src/hal_bsp.c b/hw/bsp/puckjs/src/hal_bsp.c index 3bb0c712cd..2e53db04b6 100644 --- a/hw/bsp/puckjs/src/hal_bsp.c +++ b/hw/bsp/puckjs/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -106,4 +107,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/rb-blend2/src/hal_bsp.c b/hw/bsp/rb-blend2/src/hal_bsp.c index a2a8ea8e03..9cb5ffec1a 100644 --- a/hw/bsp/rb-blend2/src/hal_bsp.c +++ b/hw/bsp/rb-blend2/src/hal_bsp.c @@ -20,6 +20,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "bsp/bsp.h" #include "hal/hal_bsp.h" @@ -105,4 +106,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/rb-nano2/src/hal_bsp.c b/hw/bsp/rb-nano2/src/hal_bsp.c index 00c026e281..2d0e4aff01 100644 --- a/hw/bsp/rb-nano2/src/hal_bsp.c +++ b/hw/bsp/rb-nano2/src/hal_bsp.c @@ -20,6 +20,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "bsp/bsp.h" #include "hal/hal_bsp.h" @@ -104,4 +105,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/reel_board/src/hal_bsp.c b/hw/bsp/reel_board/src/hal_bsp.c index 51c56b3200..82c75c7973 100644 --- a/hw/bsp/reel_board/src/hal_bsp.c +++ b/hw/bsp/reel_board/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -98,4 +99,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/ruuvitag_rev_b/src/hal_bsp.c b/hw/bsp/ruuvitag_rev_b/src/hal_bsp.c index 837f0559ef..337a199fc6 100644 --- a/hw/bsp/ruuvitag_rev_b/src/hal_bsp.c +++ b/hw/bsp/ruuvitag_rev_b/src/hal_bsp.c @@ -22,6 +22,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -214,4 +215,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/stm32f3discovery/src/hal_bsp.c b/hw/bsp/stm32f3discovery/src/hal_bsp.c index 0d28425fc8..eee167cfd3 100644 --- a/hw/bsp/stm32f3discovery/src/hal_bsp.c +++ b/hw/bsp/stm32f3discovery/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -177,4 +178,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/stm32f411discovery/src/hal_bsp.c b/hw/bsp/stm32f411discovery/src/hal_bsp.c index b7a8681fe3..14fde03b14 100644 --- a/hw/bsp/stm32f411discovery/src/hal_bsp.c +++ b/hw/bsp/stm32f411discovery/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -171,6 +172,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHB1ENR = 0; RCC->AHB2ENR = 0; RCC->APB1ENR = 0; diff --git a/hw/bsp/stm32f429discovery/src/hal_bsp.c b/hw/bsp/stm32f429discovery/src/hal_bsp.c index 0c6d5c9f31..638e5f7921 100644 --- a/hw/bsp/stm32f429discovery/src/hal_bsp.c +++ b/hw/bsp/stm32f429discovery/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -126,6 +127,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } /** diff --git a/hw/bsp/stm32f4discovery/src/hal_bsp.c b/hw/bsp/stm32f4discovery/src/hal_bsp.c index 9fc921c1da..3741c7ec23 100644 --- a/hw/bsp/stm32f4discovery/src/hal_bsp.c +++ b/hw/bsp/stm32f4discovery/src/hal_bsp.c @@ -21,6 +21,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -144,6 +145,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } /** diff --git a/hw/bsp/stm32f7discovery/src/hal_bsp.c b/hw/bsp/stm32f7discovery/src/hal_bsp.c index 5bb0d5bd82..444b366768 100644 --- a/hw/bsp/stm32f7discovery/src/hal_bsp.c +++ b/hw/bsp/stm32f7discovery/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -163,6 +164,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } /** diff --git a/hw/bsp/stm32l152discovery/src/hal_bsp.c b/hw/bsp/stm32l152discovery/src/hal_bsp.c index 245530961f..505580ae82 100644 --- a/hw/bsp/stm32l152discovery/src/hal_bsp.c +++ b/hw/bsp/stm32l152discovery/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -95,6 +96,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } /** diff --git a/hw/bsp/telee02/src/hal_bsp.c b/hw/bsp/telee02/src/hal_bsp.c index 4c32cda3ef..ce0f4e1f08 100644 --- a/hw/bsp/telee02/src/hal_bsp.c +++ b/hw/bsp/telee02/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -121,6 +122,7 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } #if MYNEWT_VAL(LORA_NODE) diff --git a/hw/bsp/ublox_bmd_345/src/hal_bsp.c b/hw/bsp/ublox_bmd_345/src/hal_bsp.c index 26bcf49811..43f06bf26a 100644 --- a/hw/bsp/ublox_bmd_345/src/hal_bsp.c +++ b/hw/bsp/ublox_bmd_345/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -116,6 +117,7 @@ void tp_val(uint8_t v) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } #if MYNEWT_VAL(BSP_USE_HAL_SPI) diff --git a/hw/bsp/usbmkw41z/src/arch/cortex_m0/gcc_startup_mkw41z.s b/hw/bsp/usbmkw41z/src/arch/cortex_m0/gcc_startup_mkw41z.s index e80a85ffc0..73c15a58b2 100644 --- a/hw/bsp/usbmkw41z/src/arch/cortex_m0/gcc_startup_mkw41z.s +++ b/hw/bsp/usbmkw41z/src/arch/cortex_m0/gcc_startup_mkw41z.s @@ -169,6 +169,8 @@ Reset_Handler: LDR R0, =SystemInit BLX R0 + LDR R0, =hal_system_init + BLX R0 LDR R0, =_start BX R0 .pool diff --git a/hw/bsp/usbmkw41z/src/hal_bsp.c b/hw/bsp/usbmkw41z/src/hal_bsp.c index fab0afbb60..ac743407cc 100644 --- a/hw/bsp/usbmkw41z/src/hal_bsp.c +++ b/hw/bsp/usbmkw41z/src/hal_bsp.c @@ -24,6 +24,7 @@ #include "bsp/bsp.h" #include "flash_map/flash_map.h" #include "hal/hal_flash.h" +#include "mynewt_cm.h" /* * What memory to include in coredump. @@ -90,4 +91,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/vbluno51/src/hal_bsp.c b/hw/bsp/vbluno51/src/hal_bsp.c index 7a2eee7bc9..63119e4d89 100644 --- a/hw/bsp/vbluno51/src/hal_bsp.c +++ b/hw/bsp/vbluno51/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "hal/hal_bsp.h" #include "hal/hal_system.h" #include "mcu/nrf51_hal.h" @@ -228,4 +229,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/vbluno52/src/hal_bsp.c b/hw/bsp/vbluno52/src/hal_bsp.c index 3bb0c712cd..2e53db04b6 100644 --- a/hw/bsp/vbluno52/src/hal_bsp.c +++ b/hw/bsp/vbluno52/src/hal_bsp.c @@ -21,6 +21,7 @@ #include #include #include "os/mynewt.h" +#include "mynewt_cm.h" #include "nrfx.h" #include "flash_map/flash_map.h" #include "hal/hal_bsp.h" @@ -106,4 +107,5 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); } diff --git a/hw/bsp/weact_g431cb/src/hal_bsp.c b/hw/bsp/weact_g431cb/src/hal_bsp.c index 826f462fbb..1dc95719b7 100644 --- a/hw/bsp/weact_g431cb/src/hal_bsp.c +++ b/hw/bsp/weact_g431cb/src/hal_bsp.c @@ -20,6 +20,7 @@ #include "bsp/bsp.h" #include "os/mynewt.h" +#include "mynewt_cm.h" #include #include @@ -169,6 +170,8 @@ hal_bsp_init(void) void hal_bsp_deinit(void) { + Cortex_DisableAll(); + RCC->AHB1ENR = 0x00000100; RCC->AHB2ENR = 0x00000000; RCC->AHB3ENR = 0x80000000; diff --git a/hw/cmsis-core/include/mynewt_cm.h b/hw/cmsis-core/include/mynewt_cm.h new file mode 100644 index 0000000000..4e65a69085 --- /dev/null +++ b/hw/cmsis-core/include/mynewt_cm.h @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#ifndef MYNEWT_CM_H +#define MYNEWT_CM_H + +#include + +static inline void +Cortex_DisableAll(void) +{ + /* Disable SysTick interrupt */ + SysTick->CTRL = 0; + /* Disable all NVIC interrupts */ + NVIC_DisableAll(); +} + +#endif diff --git a/hw/cmsis-core/include/mynewt_nvic.h b/hw/cmsis-core/include/mynewt_nvic.h new file mode 100644 index 0000000000..cd58ca9531 --- /dev/null +++ b/hw/cmsis-core/include/mynewt_nvic.h @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#ifndef MYNEWT_NVIC_H +#define MYNEWT_NVIC_H + +#include +#include + +void NVIC_Relocate(void); +void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); +uint32_t NVIC_GetVector(IRQn_Type IRQn); + +static inline void +NVIC_DisableAll(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(NVIC->ICER); ++i) { + NVIC->ICER[i] = 0xffffffff; + NVIC->ICPR[i] = 0xffffffff; + } +} + +#endif diff --git a/hw/mcu/ambiq/apollo2/include/mcu/cmsis_nvic.h b/hw/mcu/ambiq/apollo2/include/mcu/cmsis_nvic.h index 1e8fec1d82..ee509ac6dc 100644 --- a/hw/mcu/ambiq/apollo2/include/mcu/cmsis_nvic.h +++ b/hw/mcu/ambiq/apollo2/include/mcu/cmsis_nvic.h @@ -18,10 +18,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h b/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h index d9779873d2..b1cfb8c03b 100644 --- a/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h +++ b/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h @@ -21,6 +21,7 @@ #define __MCU_CORTEX_M4_H__ #include "mcu/apollo2.h" +#include "mynewt_cm.h" #ifdef __cplusplus extern "C" { diff --git a/hw/mcu/ambiq/apollo2/src/hal_system.c b/hw/mcu/ambiq/apollo2/src/hal_system.c index 43058d81be..31e05a4b39 100644 --- a/hw/mcu/ambiq/apollo2/src/hal_system.c +++ b/hw/mcu/ambiq/apollo2/src/hal_system.c @@ -28,6 +28,7 @@ am_hal_mcuctrl_device_t adevinfo; void hal_system_init(void) { + NVIC_Relocate(); } void diff --git a/hw/mcu/ambiq/apollo3/include/mcu/cmsis_nvic.h b/hw/mcu/ambiq/apollo3/include/mcu/cmsis_nvic.h index a7398f992d..f1d4bd71cb 100644 --- a/hw/mcu/ambiq/apollo3/include/mcu/cmsis_nvic.h +++ b/hw/mcu/ambiq/apollo3/include/mcu/cmsis_nvic.h @@ -18,10 +18,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/ambiq/apollo3/include/mcu/cortex_m4.h b/hw/mcu/ambiq/apollo3/include/mcu/cortex_m4.h index d006e34d1c..4b1d638dff 100644 --- a/hw/mcu/ambiq/apollo3/include/mcu/cortex_m4.h +++ b/hw/mcu/ambiq/apollo3/include/mcu/cortex_m4.h @@ -21,6 +21,7 @@ #define __MCU_CORTEX_M4_H__ #include "mcu/apollo3.h" +#include "mynewt_cm.h" #ifdef __cplusplus extern "C" { diff --git a/hw/mcu/ambiq/apollo3/src/hal_system.c b/hw/mcu/ambiq/apollo3/src/hal_system.c index 770f030d63..e811c69efb 100644 --- a/hw/mcu/ambiq/apollo3/src/hal_system.c +++ b/hw/mcu/ambiq/apollo3/src/hal_system.c @@ -26,6 +26,7 @@ void hal_system_init(void) { + NVIC_Relocate(); } void diff --git a/hw/mcu/atmel/samd21xx/include/mcu/cmsis_nvic.h b/hw/mcu/atmel/samd21xx/include/mcu/cmsis_nvic.h index 4b8909b61c..788b65c0ef 100644 --- a/hw/mcu/atmel/samd21xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/atmel/samd21xx/include/mcu/cmsis_nvic.h @@ -37,10 +37,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/dialog/da1469x/include/mcu/cmsis_nvic.h b/hw/mcu/dialog/da1469x/include/mcu/cmsis_nvic.h index 04298ac142..a298498ddb 100644 --- a/hw/mcu/dialog/da1469x/include/mcu/cmsis_nvic.h +++ b/hw/mcu/dialog/da1469x/include/mcu/cmsis_nvic.h @@ -17,10 +17,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/nordic/nrf51xxx/include/mcu/cmsis_nvic.h b/hw/mcu/nordic/nrf51xxx/include/mcu/cmsis_nvic.h index 5d2ae8304e..cd1b749115 100644 --- a/hw/mcu/nordic/nrf51xxx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/nordic/nrf51xxx/include/mcu/cmsis_nvic.h @@ -19,10 +19,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/nordic/nrf51xxx/src/hal_system.c b/hw/mcu/nordic/nrf51xxx/src/hal_system.c index 03e2eb4893..884067ebeb 100644 --- a/hw/mcu/nordic/nrf51xxx/src/hal_system.c +++ b/hw/mcu/nordic/nrf51xxx/src/hal_system.c @@ -19,6 +19,7 @@ #include "os/mynewt.h" #include +#include "mynewt_cm.h" #include "hal/hal_system.h" #include #include @@ -36,6 +37,8 @@ void hal_system_init(void) { + NVIC_Relocate(); + #if MYNEWT_VAL(MCU_DCDC_ENABLED) NRF_POWER->DCDCEN = 1; #endif diff --git a/hw/mcu/nordic/nrf51xxx/src/system_nrf51.c b/hw/mcu/nordic/nrf51xxx/src/system_nrf51.c index c90ed6f014..55e8de81e7 100644 --- a/hw/mcu/nordic/nrf51xxx/src/system_nrf51.c +++ b/hw/mcu/nordic/nrf51xxx/src/system_nrf51.c @@ -79,8 +79,6 @@ void SystemInit(void) { NRF_MPU->DISABLEINDEBUG = MPU_DISABLEINDEBUG_DISABLEINDEBUG_Disabled << MPU_DISABLEINDEBUG_DISABLEINDEBUG_Pos; } - - NVIC_Relocate(); } diff --git a/hw/mcu/nordic/nrf52xxx/include/mcu/cmsis_nvic.h b/hw/mcu/nordic/nrf52xxx/include/mcu/cmsis_nvic.h index 11a812d337..363be02758 100644 --- a/hw/mcu/nordic/nrf52xxx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/nordic/nrf52xxx/include/mcu/cmsis_nvic.h @@ -17,10 +17,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_system.c b/hw/mcu/nordic/nrf52xxx/src/hal_system.c index 497c7b6a98..cd8e63d392 100644 --- a/hw/mcu/nordic/nrf52xxx/src/hal_system.c +++ b/hw/mcu/nordic/nrf52xxx/src/hal_system.c @@ -19,6 +19,7 @@ #include "syscfg/syscfg.h" #include "mcu/cortex_m4.h" +#include "mynewt_cm.h" #include "hal/hal_system.h" #include "hal/hal_debug.h" #include "nrf.h" @@ -37,6 +38,7 @@ void hal_system_init(void) { + NVIC_Relocate(); #if MYNEWT_VAL(MCU_ICACHE_ENABLED) NRF_NVMC->ICACHECNF = 1; diff --git a/hw/mcu/nordic/nrf52xxx/src/system_nrf52.c b/hw/mcu/nordic/nrf52xxx/src/system_nrf52.c index c236e0b736..5046afd04b 100644 --- a/hw/mcu/nordic/nrf52xxx/src/system_nrf52.c +++ b/hw/mcu/nordic/nrf52xxx/src/system_nrf52.c @@ -532,8 +532,6 @@ void SystemInit(void) nrf52_handle_approtect(); SystemCoreClockUpdate(); - - NVIC_Relocate(); } #ifdef NRF52 diff --git a/hw/mcu/nordic/nrf5340/include/mcu/cmsis_nvic.h b/hw/mcu/nordic/nrf5340/include/mcu/cmsis_nvic.h index 94e9e986a2..aa06940578 100644 --- a/hw/mcu/nordic/nrf5340/include/mcu/cmsis_nvic.h +++ b/hw/mcu/nordic/nrf5340/include/mcu/cmsis_nvic.h @@ -17,10 +17,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/nordic/nrf5340/src/hal_system.c b/hw/mcu/nordic/nrf5340/src/hal_system.c index a1e863f32e..ff9305d07a 100644 --- a/hw/mcu/nordic/nrf5340/src/hal_system.c +++ b/hw/mcu/nordic/nrf5340/src/hal_system.c @@ -22,6 +22,7 @@ #include #include #include +#include "mynewt_cm.h" #include #include #include @@ -40,6 +41,8 @@ void hal_system_init(void) { + NVIC_Relocate(); + #if MYNEWT_VAL(MCU_CACHE_ENABLED) #if MYNEWT_VAL(MCU_APP_SECURE) || MYNEWT_VAL(BOOT_LOADER) NRF_CACHE_S->ENABLE = 1; diff --git a/hw/mcu/nordic/nrf5340/src/system_nrf5340.c b/hw/mcu/nordic/nrf5340/src/system_nrf5340.c index bf01a9f451..ef8ad0d11e 100644 --- a/hw/mcu/nordic/nrf5340/src/system_nrf5340.c +++ b/hw/mcu/nordic/nrf5340/src/system_nrf5340.c @@ -254,8 +254,6 @@ void SystemInit(void) SystemCoreClockUpdate(); - NVIC_Relocate(); - /* Setup Cortex-M33 stack limiter to detect stack overflow in interrupts and bootloader code */ __set_MSPLIM((uint32_t)__StackLimit); } diff --git a/hw/mcu/nordic/nrf5340_net/include/mcu/cmsis_nvic.h b/hw/mcu/nordic/nrf5340_net/include/mcu/cmsis_nvic.h index 0c26de0406..fd0d8811ab 100644 --- a/hw/mcu/nordic/nrf5340_net/include/mcu/cmsis_nvic.h +++ b/hw/mcu/nordic/nrf5340_net/include/mcu/cmsis_nvic.h @@ -17,10 +17,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/nordic/nrf5340_net/src/hal_system.c b/hw/mcu/nordic/nrf5340_net/src/hal_system.c index d7d1f3cb51..71322cf568 100644 --- a/hw/mcu/nordic/nrf5340_net/src/hal_system.c +++ b/hw/mcu/nordic/nrf5340_net/src/hal_system.c @@ -22,6 +22,7 @@ #include #include #include +#include #include /** @@ -37,6 +38,8 @@ void hal_system_init(void) { + NVIC_Relocate(); + #if MYNEWT_VAL(MCU_ICACHE_ENABLED) NRF_NVMC_NS->ICACHECNF = 1; #endif diff --git a/hw/mcu/nordic/nrf5340_net/src/system_nrf5340_net.c b/hw/mcu/nordic/nrf5340_net/src/system_nrf5340_net.c index 2888f0e0c8..bde6bf804f 100644 --- a/hw/mcu/nordic/nrf5340_net/src/system_nrf5340_net.c +++ b/hw/mcu/nordic/nrf5340_net/src/system_nrf5340_net.c @@ -93,8 +93,6 @@ void SystemInit(void) SystemCoreClockUpdate(); - NVIC_Relocate(); - /* Setup Cortex-M33 stack limiter to detect stack overflow in interrupts and bootloader code */ __set_MSPLIM((uint32_t)__StackLimit); } diff --git a/hw/mcu/nordic/nrf91xx/include/mcu/cmsis_nvic.h b/hw/mcu/nordic/nrf91xx/include/mcu/cmsis_nvic.h index 26656353f6..de60957edc 100644 --- a/hw/mcu/nordic/nrf91xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/nordic/nrf91xx/include/mcu/cmsis_nvic.h @@ -16,10 +16,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/nordic/nrf91xx/src/hal_system.c b/hw/mcu/nordic/nrf91xx/src/hal_system.c index 66e24e87d0..f370ffb04d 100644 --- a/hw/mcu/nordic/nrf91xx/src/hal_system.c +++ b/hw/mcu/nordic/nrf91xx/src/hal_system.c @@ -21,6 +21,7 @@ #include "mcu/cortex_m33.h" #include "hal/hal_system.h" #include "hal/hal_debug.h" +#include "mynewt_cm.h" #include "nrf.h" #include "nrfx_config.h" @@ -37,6 +38,8 @@ void hal_system_init(void) { + NVIC_Relocate(); + #if MYNEWT_VAL(MCU_DCDC_ENABLED) NRF_REGULATORS->DCDCEN = 1; #endif diff --git a/hw/mcu/nordic/nrf91xx/src/system_nrf9160.c b/hw/mcu/nordic/nrf91xx/src/system_nrf9160.c index 8100a955fa..615c273359 100644 --- a/hw/mcu/nordic/nrf91xx/src/system_nrf9160.c +++ b/hw/mcu/nordic/nrf91xx/src/system_nrf9160.c @@ -237,8 +237,6 @@ void SystemInit(void) #endif SystemCoreClockUpdate(); - - NVIC_Relocate(); } diff --git a/hw/mcu/nxp/kinetis/MK8xF/MK82F/src/system_MK82F25615.c b/hw/mcu/nxp/kinetis/MK8xF/MK82F/src/system_MK82F25615.c deleted file mode 100644 index 82ac6e8d67..0000000000 --- a/hw/mcu/nxp/kinetis/MK8xF/MK82F/src/system_MK82F25615.c +++ /dev/null @@ -1,212 +0,0 @@ -/* -** ################################################################### -** Processors: MK82FN256CAx15 -** MK82FN256VDC15 -** MK82FN256VLL15 -** MK82FN256VLQ15 -** -** Compilers: Freescale C/C++ for Embedded ARM -** GNU C Compiler -** IAR ANSI C/C++ Compiler for ARM -** Keil ARM C/C++ Compiler -** MCUXpresso Compiler -** -** Reference manual: K82P121M150SF5RM, Rev. 0, May 2015 -** Version: rev. 1.2, 2015-07-29 -** Build: b181105 -** -** Abstract: -** Provides a system configuration function and a global variable that -** contains the system frequency. It configures the device and initializes -** the oscillator (PLL) that is part of the microcontroller device. -** -** Copyright 2016 Freescale Semiconductor, Inc. -** Copyright 2016-2018 NXP -** All rights reserved. -** -** SPDX-License-Identifier: BSD-3-Clause -** -** http: www.nxp.com -** mail: support@nxp.com -** -** Revisions: -** - rev. 1.0 (2015-04-09) -** Initial version -** - rev. 1.1 (2015-05-28) -** Update according to the reference manual Rev. 0. -** - rev. 1.2 (2015-07-29) -** Correction of backward compatibility. -** -** ################################################################### -*/ - -/*! - * @file MK82F25615 - * @version 1.2 - * @date 2015-07-29 - * @brief Device specific configuration file for MK82F25615 (implementation file) - * - * Provides a system configuration function and a global variable that contains - * the system frequency. It configures the device and initializes the oscillator - * (PLL) that is part of the microcontroller device. - */ - -#include -#include "fsl_device_registers.h" -#include "mcu/cmsis_nvic.h" - - -/* ---------------------------------------------------------------------------- - -- Core clock - ---------------------------------------------------------------------------- */ - -uint32_t SystemCoreClock = DEFAULT_SYSTEM_CLOCK; - -/* ---------------------------------------------------------------------------- - -- SystemInit() - ---------------------------------------------------------------------------- */ - -void SystemInit (void) { -#if ((__FPU_PRESENT == 1) && (__FPU_USED == 1)) - SCB->CPACR |= ((3UL << 10*2) | (3UL << 11*2)); /* set CP10, CP11 Full Access */ -#endif /* ((__FPU_PRESENT == 1) && (__FPU_USED == 1)) */ - -#if (DISABLE_WDOG) - /* WDOG->UNLOCK: WDOGUNLOCK=0xC520 */ - WDOG->UNLOCK = WDOG_UNLOCK_WDOGUNLOCK(0xC520); /* Key 1 */ - /* WDOG->UNLOCK: WDOGUNLOCK=0xD928 */ - WDOG->UNLOCK = WDOG_UNLOCK_WDOGUNLOCK(0xD928); /* Key 2 */ - /* WDOG->STCTRLH: ?=0,DISTESTWDOG=0,BYTESEL=0,TESTSEL=0,TESTWDOG=0,?=0,?=1,WAITEN=1,STOPEN=1,DBGEN=0,ALLOWUPDATE=1,WINEN=0,IRQRSTEN=0,CLKSRC=1,WDOGEN=0 */ - WDOG->STCTRLH = WDOG_STCTRLH_BYTESEL(0x00) | - WDOG_STCTRLH_WAITEN_MASK | - WDOG_STCTRLH_STOPEN_MASK | - WDOG_STCTRLH_ALLOWUPDATE_MASK | - WDOG_STCTRLH_CLKSRC_MASK | - 0x0100U; -#endif /* (DISABLE_WDOG) */ - NVIC_Relocate(); - SystemInitHook(); -} - -/* ---------------------------------------------------------------------------- - -- SystemCoreClockUpdate() - ---------------------------------------------------------------------------- */ - -void SystemCoreClockUpdate (void) { - - uint32_t MCGOUTClock; /* Variable to store output clock frequency of the MCG module */ - uint16_t Divider; - uint8_t tmpC7 = 0; - - if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x00U) { - /* Output of FLL or PLL is selected */ - if ((MCG->C6 & MCG_C6_PLLS_MASK) == 0x00U) { - /* FLL is selected */ - if ((MCG->C1 & MCG_C1_IREFS_MASK) == 0x00U) { - /* External reference clock is selected */ - switch (MCG->C7 & MCG_C7_OSCSEL_MASK) { - case 0x00U: - MCGOUTClock = CPU_XTAL_CLK_HZ; /* System oscillator drives MCG clock */ - break; - case 0x01U: - MCGOUTClock = CPU_XTAL32k_CLK_HZ; /* RTC 32 kHz oscillator drives MCG clock */ - break; - case 0x02U: - default: - MCGOUTClock = CPU_INT_IRC_CLK_HZ; /* IRC 48MHz oscillator drives MCG clock */ - break; - } - tmpC7 = MCG->C7; - if (((MCG->C2 & MCG_C2_RANGE_MASK) != 0x00U) && ((tmpC7 & MCG_C7_OSCSEL_MASK) != 0x01U)) { - switch (MCG->C1 & MCG_C1_FRDIV_MASK) { - case 0x38U: - Divider = 1536U; - break; - case 0x30U: - Divider = 1280U; - break; - default: - Divider = (uint16_t)(32LU << ((MCG->C1 & MCG_C1_FRDIV_MASK) >> MCG_C1_FRDIV_SHIFT)); - break; - } - } else {/* ((MCG->C2 & MCG_C2_RANGE_MASK) != 0x00U) */ - Divider = (uint16_t)(1LU << ((MCG->C1 & MCG_C1_FRDIV_MASK) >> MCG_C1_FRDIV_SHIFT)); - } - MCGOUTClock = (MCGOUTClock / Divider); /* Calculate the divided FLL reference clock */ - } else { /* (!((MCG->C1 & MCG_C1_IREFS_MASK) == 0x00U)) */ - MCGOUTClock = CPU_INT_SLOW_CLK_HZ; /* The slow internal reference clock is selected */ - } /* (!((MCG->C1 & MCG_C1_IREFS_MASK) == 0x00U)) */ - /* Select correct multiplier to calculate the MCG output clock */ - switch (MCG->C4 & (MCG_C4_DMX32_MASK | MCG_C4_DRST_DRS_MASK)) { - case 0x00U: - MCGOUTClock *= 640U; - break; - case 0x20U: - MCGOUTClock *= 1280U; - break; - case 0x40U: - MCGOUTClock *= 1920U; - break; - case 0x60U: - MCGOUTClock *= 2560U; - break; - case 0x80U: - MCGOUTClock *= 732U; - break; - case 0xA0U: - MCGOUTClock *= 1464U; - break; - case 0xC0U: - MCGOUTClock *= 2197U; - break; - case 0xE0U: - MCGOUTClock *= 2929U; - break; - default: - MCGOUTClock *= 640U; - break; - } - } else { /* (!((MCG->C6 & MCG_C6_PLLS_MASK) == 0x00U)) */ - /* PLL is selected */ - Divider = (((uint16_t)MCG->C5 & MCG_C5_PRDIV_MASK) + 0x01U); - MCGOUTClock = (uint32_t)(CPU_XTAL_CLK_HZ / Divider); /* Calculate the PLL reference clock */ - Divider = (((uint16_t)MCG->C6 & MCG_C6_VDIV_MASK) + 16U); - MCGOUTClock *= Divider; /* Calculate the VCO output clock */ - MCGOUTClock /= 2U; /* Calculate the MCG output clock */ - } /* (!((MCG->C6 & MCG_C6_PLLS_MASK) == 0x00U)) */ - } else if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x40U) { - /* Internal reference clock is selected */ - if ((MCG->C2 & MCG_C2_IRCS_MASK) == 0x00U) { - MCGOUTClock = CPU_INT_SLOW_CLK_HZ; /* Slow internal reference clock selected */ - } else { /* (!((MCG->C2 & MCG_C2_IRCS_MASK) == 0x00U)) */ - Divider = (uint16_t)(0x01LU << ((MCG->SC & MCG_SC_FCRDIV_MASK) >> MCG_SC_FCRDIV_SHIFT)); - MCGOUTClock = (uint32_t) (CPU_INT_FAST_CLK_HZ / Divider); /* Fast internal reference clock selected */ - } /* (!((MCG->C2 & MCG_C2_IRCS_MASK) == 0x00U)) */ - } else if ((MCG->C1 & MCG_C1_CLKS_MASK) == 0x80U) { - /* External reference clock is selected */ - switch (MCG->C7 & MCG_C7_OSCSEL_MASK) { - case 0x00U: - MCGOUTClock = CPU_XTAL_CLK_HZ; /* System oscillator drives MCG clock */ - break; - case 0x01U: - MCGOUTClock = CPU_XTAL32k_CLK_HZ; /* RTC 32 kHz oscillator drives MCG clock */ - break; - case 0x02U: - default: - MCGOUTClock = CPU_INT_IRC_CLK_HZ; /* IRC 48MHz oscillator drives MCG clock */ - break; - } - } else { /* (!((MCG->C1 & MCG_C1_CLKS_MASK) == 0x80U)) */ - /* Reserved value */ - return; - } /* (!((MCG->C1 & MCG_C1_CLKS_MASK) == 0x80U)) */ - SystemCoreClock = (MCGOUTClock / (0x01U + ((SIM->CLKDIV1 & SIM_CLKDIV1_OUTDIV1_MASK) >> SIM_CLKDIV1_OUTDIV1_SHIFT))); -} - -/* ---------------------------------------------------------------------------- - -- SystemInitHook() - ---------------------------------------------------------------------------- */ - -__attribute__ ((weak)) void SystemInitHook (void) { - /* Void implementation of the weak function. */ -} diff --git a/hw/mcu/nxp/kinetis/MK8xF/include/mcu/cmsis_nvic.h b/hw/mcu/nxp/kinetis/MK8xF/include/mcu/cmsis_nvic.h index ed3ca6005a..61147286f0 100644 --- a/hw/mcu/nxp/kinetis/MK8xF/include/mcu/cmsis_nvic.h +++ b/hw/mcu/nxp/kinetis/MK8xF/include/mcu/cmsis_nvic.h @@ -36,10 +36,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/nxp/kinetis/MK8xF/include/mcu/mcu_vectors.h b/hw/mcu/nxp/kinetis/MK8xF/include/mcu/mcu_vectors.h new file mode 100644 index 0000000000..34020b9288 --- /dev/null +++ b/hw/mcu/nxp/kinetis/MK8xF/include/mcu/mcu_vectors.h @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#ifdef CPU_MK82FN256VLL15 +#include "vectors/mk82f25615_vectors.h" +#else +#error "Unknown device" +#endif diff --git a/hw/mcu/nxp/kinetis/MK8xF/include/mcu/vectors/mk82f25615_vectors.h b/hw/mcu/nxp/kinetis/MK8xF/include/mcu/vectors/mk82f25615_vectors.h new file mode 100644 index 0000000000..d0a455c712 --- /dev/null +++ b/hw/mcu/nxp/kinetis/MK8xF/include/mcu/vectors/mk82f25615_vectors.h @@ -0,0 +1,143 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +INT_VECTOR_STACK_TOP(__StackTop) +INT_VECTOR_RESET_HANDLER(Reset_Handler) +INT_VECTOR_NMI_HANDLER(NMI_Handler) +INT_VECTOR_HARDFAULT_HANDLER(HardFault_Handler) +INT_VECTOR_MEMMANAGE_HANDLER(MemManage_Handler) +INT_VECTOR_BUSFAULT_HANDLER(BusFault_Handler) +INT_VECTOR_USAGEFAULT_HANDLER(UsageFault_Handler) +INT_VECTOR_UNUSED(0) +INT_VECTOR_UNUSED(0) +INT_VECTOR_UNUSED(0) +INT_VECTOR_UNUSED(0) +INT_VECTOR_SVC_HANDLER(SVC_Handler) +INT_VECTOR_DEBUGMON_HANDLER(DebugMon_Handler) +INT_VECTOR_UNUSED(0) +INT_VECTOR_PENDSV_HANDLER(PendSV_Handler) +INT_VECTOR_SYSTICK_HANDLER(SysTick_Handler) + +INT_VECTOR(DMA0_DMA16_IRQHandler) +INT_VECTOR(DMA1_DMA17_IRQHandler) +INT_VECTOR(DMA3_DMA19_IRQHandler) +INT_VECTOR(DMA2_DMA18_IRQHandler) +INT_VECTOR(DMA4_DMA20_IRQHandler) +INT_VECTOR(DMA5_DMA21_IRQHandler) +INT_VECTOR(DMA6_DMA22_IRQHandler) +INT_VECTOR(DMA7_DMA23_IRQHandler) +INT_VECTOR(DMA8_DMA24_IRQHandler) +INT_VECTOR(DMA9_DMA25_IRQHandler) +INT_VECTOR(DMA10_DMA26_IRQHandler) +INT_VECTOR(DMA11_DMA27_IRQHandler) +INT_VECTOR(DMA12_DMA28_IRQHandler) +INT_VECTOR(DMA13_DMA29_IRQHandler) +INT_VECTOR(DMA14_DMA30_IRQHandler) +INT_VECTOR(DMA15_DMA31_IRQHandler) +INT_VECTOR(DMA_Error_IRQHandler) +INT_VECTOR(MCM_IRQHandler) +INT_VECTOR(FTFA_IRQHandler) +INT_VECTOR(Read_Collision_IRQHandler) +INT_VECTOR(LVD_LVW_IRQHandler) +INT_VECTOR(LLWU_IRQHandler) +INT_VECTOR(WDOG_EWM_IRQHandler) +INT_VECTOR(TRNG0_IRQHandler) +INT_VECTOR(I2C0_IRQHandler) +INT_VECTOR(I2C1_IRQHandler) +INT_VECTOR(SPI0_IRQHandler) +INT_VECTOR(SPI1_IRQHandler) +INT_VECTOR(I2S0_Tx_IRQHandler) +INT_VECTOR(I2S0_Rx_IRQHandler) +INT_VECTOR(LPUART0_IRQHandler) +INT_VECTOR(LPUART1_IRQHandler) +INT_VECTOR(LPUART2_IRQHandler) +INT_VECTOR(LPUART3_IRQHandler) +INT_VECTOR(LPUART4_IRQHandler) +INT_VECTOR(Reserved51_IRQHandler) +INT_VECTOR(Reserved52_IRQHandler) +INT_VECTOR(EMVSIM0_IRQHandler) +INT_VECTOR(EMVSIM1_IRQHandler) +INT_VECTOR(ADC0_IRQHandler) +INT_VECTOR(CMP0_IRQHandler) +INT_VECTOR(CMP1_IRQHandler) +INT_VECTOR(FTM0_IRQHandler) +INT_VECTOR(FTM1_IRQHandler) +INT_VECTOR(FTM2_IRQHandler) +INT_VECTOR(CMT_IRQHandler) +INT_VECTOR(RTC_IRQHandler) +INT_VECTOR(RTC_Seconds_IRQHandler) +INT_VECTOR(PIT0CH0_IRQHandler) +INT_VECTOR(PIT0CH1_IRQHandler) +INT_VECTOR(PIT0CH2_IRQHandler) +INT_VECTOR(PIT0CH3_IRQHandler) +INT_VECTOR(PDB0_IRQHandler) +INT_VECTOR(USB0_IRQHandler) +INT_VECTOR(USBDCD_IRQHandler) +INT_VECTOR(Reserved71_IRQHandler) +INT_VECTOR(DAC0_IRQHandler) +INT_VECTOR(MCG_IRQHandler) +INT_VECTOR(LPTMR0_LPTMR1_IRQHandler) +INT_VECTOR(PORTA_IRQHandler) +INT_VECTOR(PORTB_IRQHandler) +INT_VECTOR(PORTC_IRQHandler) +INT_VECTOR(PORTD_IRQHandler) +INT_VECTOR(PORTE_IRQHandler) +INT_VECTOR(SWI_IRQHandler) +INT_VECTOR(SPI2_IRQHandler) +INT_VECTOR(Reserved82_IRQHandler) +INT_VECTOR(Reserved83_IRQHandler) +INT_VECTOR(Reserved84_IRQHandler) +INT_VECTOR(Reserved85_IRQHandler) +INT_VECTOR(FLEXIO0_IRQHandler) +INT_VECTOR(FTM3_IRQHandler) +INT_VECTOR(Reserved88_IRQHandler) +INT_VECTOR(Reserved89_IRQHandler) +INT_VECTOR(I2C2_IRQHandler) +INT_VECTOR(Reserved91_IRQHandler) +INT_VECTOR(Reserved92_IRQHandler) +INT_VECTOR(Reserved93_IRQHandler) +INT_VECTOR(Reserved94_IRQHandler) +INT_VECTOR(Reserved95_IRQHandler) +INT_VECTOR(Reserved96_IRQHandler) +INT_VECTOR(SDHC_IRQHandler) +INT_VECTOR(Reserved98_IRQHandler) +INT_VECTOR(Reserved99_IRQHandler) +INT_VECTOR(Reserved100_IRQHandler) +INT_VECTOR(Reserved101_IRQHandler) +INT_VECTOR(Reserved102_IRQHandler) +INT_VECTOR(TSI0_IRQHandler) +INT_VECTOR(TPM1_IRQHandler) +INT_VECTOR(TPM2_IRQHandler) +INT_VECTOR(Reserved106_IRQHandler) +INT_VECTOR(I2C3_IRQHandler) +INT_VECTOR(Reserved108_IRQHandler) +INT_VECTOR(Reserved109_IRQHandler) +INT_VECTOR(Reserved110_IRQHandler) +INT_VECTOR(Reserved111_IRQHandler) +INT_VECTOR(Reserved112_IRQHandler) +INT_VECTOR(Reserved113_IRQHandler) +INT_VECTOR(Reserved114_IRQHandler) +INT_VECTOR(Reserved115_IRQHandler) +INT_VECTOR(QuadSPI0_IRQHandler) +INT_VECTOR(Reserved117_IRQHandler) +INT_VECTOR(Reserved118_IRQHandler) +INT_VECTOR(Reserved119_IRQHandler) +INT_VECTOR(LTC0_IRQHandler) +INT_VECTOR(Reserved121_IRQHandler) +INT_VECTOR(Reserved122_IRQHandler) diff --git a/hw/mcu/nxp/kinetis/src/hal_system_init.c b/hw/mcu/nxp/kinetis/src/hal_system_init.c new file mode 100644 index 0000000000..2d6348b838 --- /dev/null +++ b/hw/mcu/nxp/kinetis/src/hal_system_init.c @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#include "os/mynewt.h" +#include + +void +hal_system_init(void) +{ + /* Relocate the vector table */ + NVIC_Relocate(); +} diff --git a/hw/mcu/nxp/lpc55xx/include/mcu/cmsis_nvic.h b/hw/mcu/nxp/lpc55xx/include/mcu/cmsis_nvic.h index 4b6b981246..785852202b 100644 --- a/hw/mcu/nxp/lpc55xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/nxp/lpc55xx/include/mcu/cmsis_nvic.h @@ -18,10 +18,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/nxp/lpc55xx/src/hal_system.c b/hw/mcu/nxp/lpc55xx/src/hal_system.c index 3a96c28ea2..59c311dd9d 100644 --- a/hw/mcu/nxp/lpc55xx/src/hal_system.c +++ b/hw/mcu/nxp/lpc55xx/src/hal_system.c @@ -43,7 +43,6 @@ void hal_system_reset(void) void SystemInitHook(void) { - NVIC_Relocate(); if (MYNEWT_VAL_CHOICE(LPC55XX_BOOT_CLOCK, FRO12M)) { BOARD_BootClockFRO12M(); } else if (MYNEWT_VAL_CHOICE(LPC55XX_BOOT_CLOCK, FROHF96M)) { diff --git a/hw/mcu/nxp/lpc55xx/src/hal_system_init.c b/hw/mcu/nxp/lpc55xx/src/hal_system_init.c index 4d7622d74f..64bd9e9223 100644 --- a/hw/mcu/nxp/lpc55xx/src/hal_system_init.c +++ b/hw/mcu/nxp/lpc55xx/src/hal_system_init.c @@ -20,6 +20,7 @@ #include "os/mynewt.h" #include #include +#include static int mpu_add_region(uint32_t rnr, uint32_t start, size_t size, uint8_t attr_ix, uint8_t ro, uint8_t xn) diff --git a/hw/mcu/nxp/mcux-sdk/pkg.yml b/hw/mcu/nxp/mcux-sdk/pkg.yml index f4ba931208..953abeede8 100644 --- a/hw/mcu/nxp/mcux-sdk/pkg.yml +++ b/hw/mcu/nxp/mcux-sdk/pkg.yml @@ -80,6 +80,7 @@ pkg.include_dirs.MCU_MK82F25615: - "@nxp-mcux-sdk/devices/MK82F25615/drivers" pkg.src_dirs.MCU_MK82F25615: - "@nxp-mcux-sdk/devices/MK82F25615/drivers" + - "@nxp-mcux-sdk/devices/MK82F25615" pkg.ign_files.MCU_MK82F25615: # Modified mynewt version exists - "drivers/flash/fsl_ftfx_controller.c" diff --git a/hw/mcu/nxp/mkw41z/include/mcu/cmsis_nvic.h b/hw/mcu/nxp/mkw41z/include/mcu/cmsis_nvic.h index c6d951930d..918adf9e00 100644 --- a/hw/mcu/nxp/mkw41z/include/mcu/cmsis_nvic.h +++ b/hw/mcu/nxp/mkw41z/include/mcu/cmsis_nvic.h @@ -18,10 +18,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/nxp/mkw41z/src/hal_system_init.c b/hw/mcu/nxp/mkw41z/src/hal_system_init.c new file mode 100644 index 0000000000..2d6348b838 --- /dev/null +++ b/hw/mcu/nxp/mkw41z/src/hal_system_init.c @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#include "os/mynewt.h" +#include + +void +hal_system_init(void) +{ + /* Relocate the vector table */ + NVIC_Relocate(); +} diff --git a/hw/mcu/nxp/mkw41z/src/system_MKW41Z4.c b/hw/mcu/nxp/mkw41z/src/system_MKW41Z4.c index 77d87b947a..aebc7fe635 100644 --- a/hw/mcu/nxp/mkw41z/src/system_MKW41Z4.c +++ b/hw/mcu/nxp/mkw41z/src/system_MKW41Z4.c @@ -67,7 +67,6 @@ #include #include "mcu/fsl_device_registers.h" -#include "mcu/cmsis_nvic.h" /* ---------------------------------------------------------------------------- -- Core clock @@ -86,7 +85,6 @@ void SystemInit (void) { SIM->COPC = (uint32_t)0x00u; #endif /* (DISABLE_WDOG) */ - NVIC_Relocate(); } /* ---------------------------------------------------------------------------- diff --git a/hw/mcu/stm/stm32f0xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32f0xx/include/mcu/cmsis_nvic.h index e7b89009ce..3f0b2a01ba 100644 --- a/hw/mcu/stm/stm32f0xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/stm/stm32f0xx/include/mcu/cmsis_nvic.h @@ -18,10 +18,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/stm/stm32f0xx/src/hal_system_init.c b/hw/mcu/stm/stm32f0xx/src/hal_system_init.c index 4206b8da92..33d46fdfea 100644 --- a/hw/mcu/stm/stm32f0xx/src/hal_system_init.c +++ b/hw/mcu/stm/stm32f0xx/src/hal_system_init.c @@ -20,6 +20,7 @@ #include "os/mynewt.h" #include "mcu/stm32_hal.h" #include +#include "mynewt_cm.h" void SystemClock_Config(void); diff --git a/hw/mcu/stm/stm32f1xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32f1xx/include/mcu/cmsis_nvic.h index a1b36b9eb8..fc3880c162 100644 --- a/hw/mcu/stm/stm32f1xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/stm/stm32f1xx/include/mcu/cmsis_nvic.h @@ -22,10 +22,6 @@ extern uint32_t __isr_vector_end[]; extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/stm/stm32f1xx/src/hal_system_init.c b/hw/mcu/stm/stm32f1xx/src/hal_system_init.c index 0610072d13..3f8e63b4c1 100644 --- a/hw/mcu/stm/stm32f1xx/src/hal_system_init.c +++ b/hw/mcu/stm/stm32f1xx/src/hal_system_init.c @@ -20,16 +20,13 @@ #include "os/mynewt.h" #include "mcu/stm32_hal.h" #include - -extern char __vector_tbl_reloc__[]; +#include "mynewt_cm.h" void SystemClock_Config(void); void hal_system_init(void) { - SCB->VTOR = (uint32_t)&__vector_tbl_reloc__; - /* Configure System Clock */ SystemClock_Config(); diff --git a/hw/mcu/stm/stm32f3xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32f3xx/include/mcu/cmsis_nvic.h index ceb3f86519..93c50b7702 100644 --- a/hw/mcu/stm/stm32f3xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/stm/stm32f3xx/include/mcu/cmsis_nvic.h @@ -41,10 +41,6 @@ extern uint32_t __isr_vector_end[]; extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/stm/stm32f3xx/src/hal_system_init.c b/hw/mcu/stm/stm32f3xx/src/hal_system_init.c index 0c8b67a202..3f8e63b4c1 100644 --- a/hw/mcu/stm/stm32f3xx/src/hal_system_init.c +++ b/hw/mcu/stm/stm32f3xx/src/hal_system_init.c @@ -20,27 +20,24 @@ #include "os/mynewt.h" #include "mcu/stm32_hal.h" #include - -extern char __vector_tbl_reloc__[]; +#include "mynewt_cm.h" void SystemClock_Config(void); void hal_system_init(void) { - SCB->VTOR = (uint32_t)&__vector_tbl_reloc__; - /* Configure System Clock */ SystemClock_Config(); /* Update SystemCoreClock global variable */ SystemCoreClockUpdate(); + /* Relocate the vector table */ + NVIC_Relocate(); + if (PREFETCH_ENABLE) { __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); } - - /* Relocate the vector table */ - NVIC_Relocate(); } diff --git a/hw/mcu/stm/stm32f4xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32f4xx/include/mcu/cmsis_nvic.h index 0a74b2ae1f..04663a5631 100644 --- a/hw/mcu/stm/stm32f4xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/stm/stm32f4xx/include/mcu/cmsis_nvic.h @@ -22,10 +22,6 @@ extern uint32_t __isr_vector_end[]; extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/stm/stm32f4xx/src/hal_system_init.c b/hw/mcu/stm/stm32f4xx/src/hal_system_init.c index 96db768086..d819c47e70 100644 --- a/hw/mcu/stm/stm32f4xx/src/hal_system_init.c +++ b/hw/mcu/stm/stm32f4xx/src/hal_system_init.c @@ -20,16 +20,13 @@ #include "os/mynewt.h" #include "mcu/stm32_hal.h" #include - -extern char __vector_tbl_reloc__[]; +#include "mynewt_cm.h" void SystemClock_Config(void); void hal_system_init(void) { - SCB->VTOR = (uint32_t)&__vector_tbl_reloc__; - /* Configure System Clock */ SystemClock_Config(); diff --git a/hw/mcu/stm/stm32f7xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32f7xx/include/mcu/cmsis_nvic.h index 040d9cf16b..cf130a2f7d 100644 --- a/hw/mcu/stm/stm32f7xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/stm/stm32f7xx/include/mcu/cmsis_nvic.h @@ -22,10 +22,6 @@ extern uint32_t __isr_vector_end[]; extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/stm/stm32f7xx/src/hal_system_init.c b/hw/mcu/stm/stm32f7xx/src/hal_system_init.c index 01e408b451..522a2a11cd 100644 --- a/hw/mcu/stm/stm32f7xx/src/hal_system_init.c +++ b/hw/mcu/stm/stm32f7xx/src/hal_system_init.c @@ -20,16 +20,13 @@ #include "os/mynewt.h" #include "mcu/stm32_hal.h" #include - -extern char __vector_tbl_reloc__[]; +#include "mynewt_cm.h" void SystemClock_Config(void); void hal_system_init(void) { - SCB->VTOR = (uint32_t)&__vector_tbl_reloc__; - /* Configure System Clock */ SystemClock_Config(); @@ -47,4 +44,3 @@ hal_system_init(void) __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); #endif } - diff --git a/hw/mcu/stm/stm32g0xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32g0xx/include/mcu/cmsis_nvic.h index cd25c74c2a..551bb023d7 100644 --- a/hw/mcu/stm/stm32g0xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/stm/stm32g0xx/include/mcu/cmsis_nvic.h @@ -23,10 +23,6 @@ enum { extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/stm/stm32g0xx/src/hal_system_init.c b/hw/mcu/stm/stm32g0xx/src/hal_system_init.c index dc995be19c..bff9728fa5 100644 --- a/hw/mcu/stm/stm32g0xx/src/hal_system_init.c +++ b/hw/mcu/stm/stm32g0xx/src/hal_system_init.c @@ -18,21 +18,15 @@ */ #include "os/mynewt.h" +#include "mynewt_cm.h" #include "mcu/stm32_hal.h" #include -extern char __vector_tbl_reloc__[]; - -/* - * XXX BSP specific - */ void SystemClock_Config(void); void hal_system_init(void) { - SCB->VTOR = (uint32_t)&__vector_tbl_reloc__; - /* Configure System Clock */ SystemClock_Config(); @@ -50,4 +44,3 @@ hal_system_init(void) __HAL_FLASH_INSTRUCTION_CACHE_ENABLE(); } } - diff --git a/hw/mcu/stm/stm32g4xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32g4xx/include/mcu/cmsis_nvic.h index a9d9003941..366e1f1372 100644 --- a/hw/mcu/stm/stm32g4xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/stm/stm32g4xx/include/mcu/cmsis_nvic.h @@ -22,10 +22,6 @@ extern uint32_t __isr_vector_end[]; extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/stm/stm32g4xx/src/hal_system_init.c b/hw/mcu/stm/stm32g4xx/src/hal_system_init.c index 414a4daf05..eb8a213af0 100644 --- a/hw/mcu/stm/stm32g4xx/src/hal_system_init.c +++ b/hw/mcu/stm/stm32g4xx/src/hal_system_init.c @@ -18,16 +18,13 @@ */ #include "os/mynewt.h" +#include "mynewt_cm.h" #include "mcu/stm32_hal.h" #include -extern char __vector_tbl_reloc__[]; - void hal_system_init(void) { - SCB->VTOR = (uint32_t)&__vector_tbl_reloc__; - if (PREFETCH_ENABLE) { __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); } @@ -39,5 +36,7 @@ hal_system_init(void) if (MYNEWT_VAL(STM32_ENABLE_DCACHE)) { __HAL_FLASH_DATA_CACHE_ENABLE(); } + + NVIC_Relocate(); } diff --git a/hw/mcu/stm/stm32h7xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32h7xx/include/mcu/cmsis_nvic.h index 7f11693aed..53b1c35d8f 100644 --- a/hw/mcu/stm/stm32h7xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/stm/stm32h7xx/include/mcu/cmsis_nvic.h @@ -22,10 +22,6 @@ extern uint32_t __isr_vector_end[]; extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/stm/stm32h7xx/src/hal_system_init.c b/hw/mcu/stm/stm32h7xx/src/hal_system_init.c index 46d6e4bbcc..8bd31e745f 100644 --- a/hw/mcu/stm/stm32h7xx/src/hal_system_init.c +++ b/hw/mcu/stm/stm32h7xx/src/hal_system_init.c @@ -18,18 +18,15 @@ */ #include "os/mynewt.h" +#include "mynewt_cm.h" #include "mcu/stm32_hal.h" #include -extern char __vector_tbl_reloc__[]; - void SystemClock_Config(void); void hal_system_init(void) { - SCB->VTOR = (uint32_t)&__vector_tbl_reloc__; - /* Configure System Clock */ SystemClock_Config(); diff --git a/hw/mcu/stm/stm32l0xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32l0xx/include/mcu/cmsis_nvic.h index 8b6225805e..1c53b95814 100644 --- a/hw/mcu/stm/stm32l0xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/stm/stm32l0xx/include/mcu/cmsis_nvic.h @@ -18,10 +18,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/stm/stm32l0xx/src/hal_system_init.c b/hw/mcu/stm/stm32l0xx/src/hal_system_init.c index a784b41fee..8e97f8e59c 100644 --- a/hw/mcu/stm/stm32l0xx/src/hal_system_init.c +++ b/hw/mcu/stm/stm32l0xx/src/hal_system_init.c @@ -18,18 +18,15 @@ */ #include "os/mynewt.h" +#include "mynewt_cm.h" #include "mcu/stm32_hal.h" #include -extern char __vector_tbl_reloc__[]; - void SystemClock_Config(void); void hal_system_init(void) { - SCB->VTOR = (uint32_t)&__vector_tbl_reloc__; - /* Configure System Clock */ SystemClock_Config(); diff --git a/hw/mcu/stm/stm32l1xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32l1xx/include/mcu/cmsis_nvic.h index 5526559dbc..93fe85a887 100644 --- a/hw/mcu/stm/stm32l1xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/stm/stm32l1xx/include/mcu/cmsis_nvic.h @@ -18,10 +18,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/stm/stm32l1xx/src/hal_system_init.c b/hw/mcu/stm/stm32l1xx/src/hal_system_init.c new file mode 100644 index 0000000000..866afa6a19 --- /dev/null +++ b/hw/mcu/stm/stm32l1xx/src/hal_system_init.c @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#include "os/mynewt.h" +#include "mynewt_cm.h" + +void +hal_system_init(void) +{ + NVIC_Relocate(); +} diff --git a/hw/mcu/stm/stm32l1xx/src/system_stm32l1xx.c b/hw/mcu/stm/stm32l1xx/src/system_stm32l1xx.c index 0d24392c7e..3d43dc2581 100644 --- a/hw/mcu/stm/stm32l1xx/src/system_stm32l1xx.c +++ b/hw/mcu/stm/stm32l1xx/src/system_stm32l1xx.c @@ -98,9 +98,6 @@ SystemInit(void) /* Update SystemCoreClock global variable */ SystemCoreClockUpdate(); - - /* Relocate the vector table */ - NVIC_Relocate(); } /** diff --git a/hw/mcu/stm/stm32l4xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32l4xx/include/mcu/cmsis_nvic.h index dbf2cc2e7f..0f1de3caaf 100644 --- a/hw/mcu/stm/stm32l4xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/stm/stm32l4xx/include/mcu/cmsis_nvic.h @@ -22,10 +22,6 @@ extern uint32_t __isr_vector_end[]; extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/stm/stm32l4xx/src/hal_system_init.c b/hw/mcu/stm/stm32l4xx/src/hal_system_init.c index 5a1935b180..ac16557ab5 100644 --- a/hw/mcu/stm/stm32l4xx/src/hal_system_init.c +++ b/hw/mcu/stm/stm32l4xx/src/hal_system_init.c @@ -18,18 +18,15 @@ */ #include "os/mynewt.h" +#include "mynewt_cm.h" #include "mcu/stm32_hal.h" #include -extern char __vector_tbl_reloc__[]; - void SystemClock_Config(void); void hal_system_init(void) { - SCB->VTOR = (uint32_t)&__vector_tbl_reloc__; - /* Configure System Clock */ SystemClock_Config(); @@ -39,5 +36,8 @@ hal_system_init(void) if (PREFETCH_ENABLE) { __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); } + + /* Relocate the vector table */ + NVIC_Relocate(); } diff --git a/hw/mcu/stm/stm32u5xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32u5xx/include/mcu/cmsis_nvic.h index d92bc2d8b1..9e1ab7c201 100644 --- a/hw/mcu/stm/stm32u5xx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/stm/stm32u5xx/include/mcu/cmsis_nvic.h @@ -18,10 +18,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/stm/stm32u5xx/src/hal_system_init.c b/hw/mcu/stm/stm32u5xx/src/hal_system_init.c index 46d6e4bbcc..8bd31e745f 100644 --- a/hw/mcu/stm/stm32u5xx/src/hal_system_init.c +++ b/hw/mcu/stm/stm32u5xx/src/hal_system_init.c @@ -18,18 +18,15 @@ */ #include "os/mynewt.h" +#include "mynewt_cm.h" #include "mcu/stm32_hal.h" #include -extern char __vector_tbl_reloc__[]; - void SystemClock_Config(void); void hal_system_init(void) { - SCB->VTOR = (uint32_t)&__vector_tbl_reloc__; - /* Configure System Clock */ SystemClock_Config(); diff --git a/hw/mcu/stm/stm32wbxx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32wbxx/include/mcu/cmsis_nvic.h index 8e268d3468..aafebedbfd 100644 --- a/hw/mcu/stm/stm32wbxx/include/mcu/cmsis_nvic.h +++ b/hw/mcu/stm/stm32wbxx/include/mcu/cmsis_nvic.h @@ -18,10 +18,6 @@ extern "C" { #endif -void NVIC_Relocate(void); -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - #ifdef __cplusplus } #endif diff --git a/hw/mcu/stm/stm32wbxx/src/hal_system_init.c b/hw/mcu/stm/stm32wbxx/src/hal_system_init.c index b848c4c901..ef678d2dda 100644 --- a/hw/mcu/stm/stm32wbxx/src/hal_system_init.c +++ b/hw/mcu/stm/stm32wbxx/src/hal_system_init.c @@ -18,18 +18,15 @@ */ #include "os/mynewt.h" +#include "mynewt_cm.h" #include "mcu/stm32_hal.h" #include -extern char __vector_tbl_reloc__[]; - void SystemClock_Config(void); void hal_system_init(void) { - SCB->VTOR = (uint32_t)&__vector_tbl_reloc__; - /* Configure System Clock */ SystemClock_Config();