You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2024/11/05 09:19:54 UTC

(mynewt-core) branch master updated (2d3823288 -> d6534df12)

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


    from 2d3823288 mcu/nrf5340: Enable NSC region
     new c88a97c48 hw/cmsis: Cleanup NVIC related prototypes
     new 51938d337 hw/cmsis: Add NVIC_DisableAll and Cortex_DisableAll
     new b92dfd330 hw/bsp: Disable NVIC interrupts in all hal_bsp_deinit
     new 25bfdb1be mcu/nrf: Move NVIC_Relocate to hal_system_init
     new 5472f775c hw/mcu/stm32: Cleanup hal_system_init
     new e99658374 hw/mcu/MKW41Z4: Move NVIC_Relocate to hal_system_init
     new 5e4535044 hw/mcu/MK8xF: Use autogenerated linker script
     new ffbe8b8ae hw/mcu/apollo: Move NVIC_Relocate to hal_system_init
     new 405ef3e95 hw/mcu/lpc55xx: Remove duplicate call to NVIC_Relocate
     new d6534df12 hw/mcu/samd21xx: Update repo version

The 10 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .rat-excludes                                      |   1 -
 hw/bsp/ada_feather_nrf52/src/hal_bsp.c             |   2 +
 hw/bsp/ada_feather_stm32f405/src/hal_bsp.c         |   2 +
 hw/bsp/apollo2_evb/src/hal_bsp.c                   |   2 +
 hw/bsp/apollo2_evb/src/system_apollo2.c            |   2 -
 hw/bsp/apollo3_evb/src/hal_bsp.c                   |   2 +
 hw/bsp/apollo3_evb/src/system_apollo3.c            |   2 -
 hw/bsp/arduino_primo_nrf52/src/hal_bsp.c           |   2 +
 hw/bsp/arduino_zero/src/hal_bsp.c                  |   3 +-
 hw/bsp/b-l072z-lrwan1/src/hal_bsp.c                |   2 +
 hw/bsp/b-l475e-iot01a/src/hal_bsp.c                |   2 +
 hw/bsp/bbc_microbit/src/hal_bsp.c                  |   2 +
 hw/bsp/black_vet6/src/hal_bsp.c                    |   3 +
 hw/bsp/ble400/src/hal_bsp.c                        |   2 +
 hw/bsp/bluepill/src/hal_bsp.c                      |   3 +
 hw/bsp/bmd200/src/hal_bsp.c                        |   2 +
 hw/bsp/bmd300eval/src/hal_bsp.c                    |   2 +
 hw/bsp/calliope_mini/src/hal_bsp.c                 |   2 +
 hw/bsp/dialog_da14695-dk-usb/src/hal_bsp.c         |   2 +
 hw/bsp/dialog_da1469x-dk-pro/src/hal_bsp.c         |   2 +
 hw/bsp/dwm1001-dev/src/hal_bsp.c                   |   2 +
 hw/bsp/fanstel-ev-bt840/src/hal_bsp.c              |   2 +
 hw/bsp/frdm-k64f/src/hal_bsp.c                     |   2 +
 hw/bsp/frdm-k82f/bsp.yml                           |   5 +-
 hw/bsp/frdm-k82f/frdm-k82_debug.cmd                |  22 ---
 hw/bsp/frdm-k82f/frdm-k82_download.cmd             |  22 ---
 hw/bsp/frdm-k82f/pkg.yml                           |   1 +
 hw/bsp/frdm-k82f/src/hal_bsp.c                     |  34 +---
 hw/bsp/frdm-k82f/syscfg.yml                        |   5 +-
 hw/bsp/lpcxpresso55s28/src/hal_bsp.c               |   2 +
 hw/bsp/nordic_pca10028-16k/src/hal_bsp.c           |   2 +
 hw/bsp/nordic_pca10028/src/hal_bsp.c               |   2 +
 hw/bsp/nordic_pca10040/src/hal_bsp.c               |   2 +
 hw/bsp/nordic_pca10056/src/hal_bsp.c               |   2 +
 hw/bsp/nordic_pca10059/src/hal_bsp.c               |   2 +
 hw/bsp/nordic_pca10090/src/hal_bsp.c               |   2 +
 hw/bsp/nordic_pca10095/src/hal_bsp.c               |   2 +
 hw/bsp/nordic_pca10095_net/src/hal_bsp.c           |   2 +
 hw/bsp/nordic_pca10121/net/src/hal_bsp.c           |   2 +
 hw/bsp/nordic_pca10121/src/hal_bsp.c               |   2 +
 hw/bsp/nordic_pca20020/src/hal_bsp.c               |   2 +
 hw/bsp/nordic_thingy53/src/hal_bsp.c               |   2 +
 hw/bsp/nrf51-arduino_101/src/hal_bsp.c             |   2 +
 hw/bsp/nrf51-blenano/src/hal_bsp.c                 |   2 +
 hw/bsp/nucleo-f030r8/src/hal_bsp.c                 |   2 +
 hw/bsp/nucleo-f072rb/src/hal_bsp.c                 |   2 +
 hw/bsp/nucleo-f103rb/src/hal_bsp.c                 |   3 +
 hw/bsp/nucleo-f303re/src/hal_bsp.c                 |   2 +
 hw/bsp/nucleo-f401re/src/hal_bsp.c                 |   3 +
 hw/bsp/nucleo-f411re/src/hal_bsp.c                 |   3 +
 hw/bsp/nucleo-f413zh/src/hal_bsp.c                 |   2 +
 hw/bsp/nucleo-f439zi/src/hal_bsp.c                 |   2 +
 hw/bsp/nucleo-f746zg/src/hal_bsp.c                 |   2 +
 hw/bsp/nucleo-f767zi/src/hal_bsp.c                 |   2 +
 hw/bsp/nucleo-g0b1re/src/hal_bsp.c                 |   3 +
 hw/bsp/nucleo-g491re/src/hal_bsp.c                 |   3 +
 hw/bsp/nucleo-h723zg/src/hal_bsp.c                 |   3 +
 hw/bsp/nucleo-l073rz/src/hal_bsp.c                 |   3 +
 hw/bsp/nucleo-l476rg/src/hal_bsp.c                 |   3 +
 hw/bsp/nucleo-u575zi-q/src/hal_bsp.c               |   3 +
 hw/bsp/olimex-p103/src/hal_bsp.c                   |   2 +
 hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c    |   2 +
 hw/bsp/p-nucleo-wb55-usbdongle/src/hal_bsp.c       |   3 +
 hw/bsp/p-nucleo-wb55/src/hal_bsp.c                 |   3 +
 hw/bsp/pinetime/src/hal_bsp.c                      |   2 +
 hw/bsp/puckjs/src/hal_bsp.c                        |   2 +
 hw/bsp/rb-blend2/src/hal_bsp.c                     |   2 +
 hw/bsp/rb-nano2/src/hal_bsp.c                      |   2 +
 hw/bsp/reel_board/src/hal_bsp.c                    |   2 +
 hw/bsp/ruuvitag_rev_b/src/hal_bsp.c                |   2 +
 hw/bsp/stm32f3discovery/src/hal_bsp.c              |   2 +
 hw/bsp/stm32f411discovery/src/hal_bsp.c            |   3 +
 hw/bsp/stm32f429discovery/src/hal_bsp.c            |   2 +
 hw/bsp/stm32f4discovery/src/hal_bsp.c              |   2 +
 hw/bsp/stm32f7discovery/src/hal_bsp.c              |   2 +
 hw/bsp/stm32l152discovery/src/hal_bsp.c            |   2 +
 hw/bsp/telee02/src/hal_bsp.c                       |   2 +
 hw/bsp/ublox_bmd_345/src/hal_bsp.c                 |   2 +
 .../src/arch/cortex_m0/gcc_startup_mkw41z.s        |   2 +
 hw/bsp/usbmkw41z/src/hal_bsp.c                     |   2 +
 hw/bsp/vbluno51/src/hal_bsp.c                      |   2 +
 hw/bsp/vbluno52/src/hal_bsp.c                      |   2 +
 hw/bsp/weact_g431cb/src/hal_bsp.c                  |   3 +
 .../cortex_m0.h => cmsis-core/include/mynewt_cm.h} |  21 +-
 .../include/mynewt_nvic.h}                         |  26 +--
 hw/mcu/ambiq/apollo2/include/mcu/cmsis_nvic.h      |   4 -
 hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h       |   1 +
 hw/mcu/ambiq/apollo2/src/hal_system.c              |   1 +
 hw/mcu/ambiq/apollo3/include/mcu/cmsis_nvic.h      |   4 -
 hw/mcu/ambiq/apollo3/include/mcu/cortex_m4.h       |   1 +
 hw/mcu/ambiq/apollo3/src/hal_system.c              |   1 +
 hw/mcu/atmel/samd21xx/ext/pkg.yml                  |   2 +-
 hw/mcu/atmel/samd21xx/include/mcu/cmsis_nvic.h     |   4 -
 hw/mcu/dialog/da1469x/include/mcu/cmsis_nvic.h     |   4 -
 hw/mcu/nordic/nrf51xxx/include/mcu/cmsis_nvic.h    |   4 -
 hw/mcu/nordic/nrf51xxx/src/hal_system.c            |   3 +
 hw/mcu/nordic/nrf51xxx/src/system_nrf51.c          |   2 -
 hw/mcu/nordic/nrf52xxx/include/mcu/cmsis_nvic.h    |   4 -
 hw/mcu/nordic/nrf52xxx/src/hal_system.c            |   2 +
 hw/mcu/nordic/nrf52xxx/src/system_nrf52.c          |   2 -
 hw/mcu/nordic/nrf5340/include/mcu/cmsis_nvic.h     |   4 -
 hw/mcu/nordic/nrf5340/src/hal_system.c             |   3 +
 hw/mcu/nordic/nrf5340/src/system_nrf5340.c         |   2 -
 hw/mcu/nordic/nrf5340_net/include/mcu/cmsis_nvic.h |   4 -
 hw/mcu/nordic/nrf5340_net/src/hal_system.c         |   3 +
 hw/mcu/nordic/nrf5340_net/src/system_nrf5340_net.c |   2 -
 hw/mcu/nordic/nrf91xx/include/mcu/cmsis_nvic.h     |   4 -
 hw/mcu/nordic/nrf91xx/src/hal_system.c             |   3 +
 hw/mcu/nordic/nrf91xx/src/system_nrf9160.c         |   2 -
 .../kinetis/MK8xF/MK82F/src/system_MK82F25615.c    | 212 ---------------------
 hw/mcu/nxp/kinetis/MK8xF/include/mcu/cmsis_nvic.h  |   4 -
 .../nxp/kinetis/MK8xF/include/mcu/mcu_vectors.h}   |   6 +-
 .../MK8xF/include/mcu/vectors/mk82f25615_vectors.h | 143 ++++++++++++++
 .../mcu/nxp/kinetis/src/hal_system_init.c          |   9 +-
 hw/mcu/nxp/lpc55xx/include/mcu/cmsis_nvic.h        |   4 -
 hw/mcu/nxp/lpc55xx/src/hal_system.c                |   1 -
 hw/mcu/nxp/lpc55xx/src/hal_system_init.c           |   1 +
 hw/mcu/nxp/mcux-sdk/pkg.yml                        |   1 +
 hw/mcu/nxp/mkw41z/include/mcu/cmsis_nvic.h         |   4 -
 .../mcu/nxp/mkw41z/src/hal_system_init.c           |   9 +-
 hw/mcu/nxp/mkw41z/src/system_MKW41Z4.c             |   2 -
 hw/mcu/stm/stm32f0xx/include/mcu/cmsis_nvic.h      |   4 -
 hw/mcu/stm/stm32f0xx/src/hal_system_init.c         |   1 +
 hw/mcu/stm/stm32f1xx/include/mcu/cmsis_nvic.h      |   4 -
 hw/mcu/stm/stm32f1xx/src/hal_system_init.c         |   5 +-
 hw/mcu/stm/stm32f3xx/include/mcu/cmsis_nvic.h      |   4 -
 hw/mcu/stm/stm32f3xx/src/hal_system_init.c         |  11 +-
 hw/mcu/stm/stm32f4xx/include/mcu/cmsis_nvic.h      |   4 -
 hw/mcu/stm/stm32f4xx/src/hal_system_init.c         |   5 +-
 hw/mcu/stm/stm32f7xx/include/mcu/cmsis_nvic.h      |   4 -
 hw/mcu/stm/stm32f7xx/src/hal_system_init.c         |   6 +-
 hw/mcu/stm/stm32g0xx/include/mcu/cmsis_nvic.h      |   4 -
 hw/mcu/stm/stm32g0xx/src/hal_system_init.c         |   9 +-
 hw/mcu/stm/stm32g4xx/include/mcu/cmsis_nvic.h      |   4 -
 hw/mcu/stm/stm32g4xx/src/hal_system_init.c         |   7 +-
 hw/mcu/stm/stm32h7xx/include/mcu/cmsis_nvic.h      |   4 -
 hw/mcu/stm/stm32h7xx/src/hal_system_init.c         |   5 +-
 hw/mcu/stm/stm32l0xx/include/mcu/cmsis_nvic.h      |   4 -
 hw/mcu/stm/stm32l0xx/src/hal_system_init.c         |   5 +-
 hw/mcu/stm/stm32l1xx/include/mcu/cmsis_nvic.h      |   4 -
 .../stm32l1xx/src/hal_system_init.c}               |  10 +-
 hw/mcu/stm/stm32l1xx/src/system_stm32l1xx.c        |   3 -
 hw/mcu/stm/stm32l4xx/include/mcu/cmsis_nvic.h      |   4 -
 hw/mcu/stm/stm32l4xx/src/hal_system_init.c         |   8 +-
 hw/mcu/stm/stm32u5xx/include/mcu/cmsis_nvic.h      |   4 -
 hw/mcu/stm/stm32u5xx/src/hal_system_init.c         |   5 +-
 hw/mcu/stm/stm32wbxx/include/mcu/cmsis_nvic.h      |   4 -
 hw/mcu/stm/stm32wbxx/src/hal_system_init.c         |   5 +-
 148 files changed, 395 insertions(+), 509 deletions(-)
 delete mode 100755 hw/bsp/frdm-k82f/frdm-k82_debug.cmd
 delete mode 100755 hw/bsp/frdm-k82f/frdm-k82_download.cmd
 copy hw/{mcu/nxp/mkw41z/include/mcu/cortex_m0.h => cmsis-core/include/mynewt_cm.h} (80%)
 copy hw/{mcu/ambiq/apollo3/include/mcu/cortex_m4.h => cmsis-core/include/mynewt_nvic.h} (69%)
 delete mode 100644 hw/mcu/nxp/kinetis/MK8xF/MK82F/src/system_MK82F25615.c
 copy hw/{bsp/weact_g431cb/link/include/bsp_config.ld.h => mcu/nxp/kinetis/MK8xF/include/mcu/mcu_vectors.h} (89%)
 create mode 100644 hw/mcu/nxp/kinetis/MK8xF/include/mcu/vectors/mk82f25615_vectors.h
 copy kernel/os/selftest/src/time_test.c => hw/mcu/nxp/kinetis/src/hal_system_init.c (88%)
 copy kernel/os/selftest/src/time_test.c => hw/mcu/nxp/mkw41z/src/hal_system_init.c (88%)
 copy hw/mcu/{native/src/hal_reset_cause.c => stm/stm32l1xx/src/hal_system_init.c} (89%)


(mynewt-core) 09/10: hw/mcu/lpc55xx: Remove duplicate call to NVIC_Relocate

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 405ef3e959e85dfe24f0f4731a60e4c3dd305010
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri Oct 4 12:41:12 2024 +0200

    hw/mcu/lpc55xx: Remove duplicate call to NVIC_Relocate
    
    NVIC_Relocate call was in two places
    Now it is only in hal_system_init function that
    is way it's done in mynewt
    
    Signed-off-by: Jerzy Kasenberg <je...@codecoup.pl>
---
 hw/mcu/nxp/lpc55xx/src/hal_system.c      | 1 -
 hw/mcu/nxp/lpc55xx/src/hal_system_init.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/mcu/nxp/lpc55xx/src/hal_system.c b/hw/mcu/nxp/lpc55xx/src/hal_system.c
index 3a96c28ea..59c311dd9 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 4d7622d74..64bd9e922 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 <hal/hal_system.h>
 #include <mpu_armv8.h>
+#include <mynewt_cm.h>
 
 static int
 mpu_add_region(uint32_t rnr, uint32_t start, size_t size, uint8_t attr_ix, uint8_t ro, uint8_t xn)


(mynewt-core) 03/10: hw/bsp: Disable NVIC interrupts in all hal_bsp_deinit

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit b92dfd33026647d09a8b650c04c277d2a54497b4
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri Oct 4 11:28:51 2024 +0200

    hw/bsp: Disable NVIC interrupts in all hal_bsp_deinit
    
    For CortexM devices add call to Cortex_DisableAll() that
    will disable all interrupts before control is passed from
    bootloader to application
    
    Signed-off-by: Jerzy Kasenberg <je...@codecoup.pl>
---
 hw/bsp/ada_feather_nrf52/src/hal_bsp.c          | 2 ++
 hw/bsp/ada_feather_stm32f405/src/hal_bsp.c      | 2 ++
 hw/bsp/arduino_primo_nrf52/src/hal_bsp.c        | 2 ++
 hw/bsp/arduino_zero/src/hal_bsp.c               | 3 ++-
 hw/bsp/b-l072z-lrwan1/src/hal_bsp.c             | 2 ++
 hw/bsp/b-l475e-iot01a/src/hal_bsp.c             | 2 ++
 hw/bsp/bbc_microbit/src/hal_bsp.c               | 2 ++
 hw/bsp/black_vet6/src/hal_bsp.c                 | 3 +++
 hw/bsp/ble400/src/hal_bsp.c                     | 2 ++
 hw/bsp/bluepill/src/hal_bsp.c                   | 3 +++
 hw/bsp/bmd200/src/hal_bsp.c                     | 2 ++
 hw/bsp/bmd300eval/src/hal_bsp.c                 | 2 ++
 hw/bsp/calliope_mini/src/hal_bsp.c              | 2 ++
 hw/bsp/dialog_da14695-dk-usb/src/hal_bsp.c      | 2 ++
 hw/bsp/dialog_da1469x-dk-pro/src/hal_bsp.c      | 2 ++
 hw/bsp/dwm1001-dev/src/hal_bsp.c                | 2 ++
 hw/bsp/fanstel-ev-bt840/src/hal_bsp.c           | 2 ++
 hw/bsp/frdm-k64f/src/hal_bsp.c                  | 2 ++
 hw/bsp/lpcxpresso55s28/src/hal_bsp.c            | 2 ++
 hw/bsp/nordic_pca10028-16k/src/hal_bsp.c        | 2 ++
 hw/bsp/nordic_pca10028/src/hal_bsp.c            | 2 ++
 hw/bsp/nordic_pca10040/src/hal_bsp.c            | 2 ++
 hw/bsp/nordic_pca10056/src/hal_bsp.c            | 2 ++
 hw/bsp/nordic_pca10059/src/hal_bsp.c            | 2 ++
 hw/bsp/nordic_pca10090/src/hal_bsp.c            | 2 ++
 hw/bsp/nordic_pca10095/src/hal_bsp.c            | 2 ++
 hw/bsp/nordic_pca10095_net/src/hal_bsp.c        | 2 ++
 hw/bsp/nordic_pca10121/net/src/hal_bsp.c        | 2 ++
 hw/bsp/nordic_pca10121/src/hal_bsp.c            | 2 ++
 hw/bsp/nordic_pca20020/src/hal_bsp.c            | 2 ++
 hw/bsp/nordic_thingy53/src/hal_bsp.c            | 2 ++
 hw/bsp/nrf51-arduino_101/src/hal_bsp.c          | 2 ++
 hw/bsp/nrf51-blenano/src/hal_bsp.c              | 2 ++
 hw/bsp/nucleo-f030r8/src/hal_bsp.c              | 2 ++
 hw/bsp/nucleo-f072rb/src/hal_bsp.c              | 2 ++
 hw/bsp/nucleo-f103rb/src/hal_bsp.c              | 3 +++
 hw/bsp/nucleo-f303re/src/hal_bsp.c              | 2 ++
 hw/bsp/nucleo-f401re/src/hal_bsp.c              | 3 +++
 hw/bsp/nucleo-f411re/src/hal_bsp.c              | 3 +++
 hw/bsp/nucleo-f413zh/src/hal_bsp.c              | 2 ++
 hw/bsp/nucleo-f439zi/src/hal_bsp.c              | 2 ++
 hw/bsp/nucleo-f746zg/src/hal_bsp.c              | 2 ++
 hw/bsp/nucleo-f767zi/src/hal_bsp.c              | 2 ++
 hw/bsp/nucleo-g0b1re/src/hal_bsp.c              | 3 +++
 hw/bsp/nucleo-g491re/src/hal_bsp.c              | 3 +++
 hw/bsp/nucleo-h723zg/src/hal_bsp.c              | 3 +++
 hw/bsp/nucleo-l073rz/src/hal_bsp.c              | 3 +++
 hw/bsp/nucleo-l476rg/src/hal_bsp.c              | 3 +++
 hw/bsp/nucleo-u575zi-q/src/hal_bsp.c            | 3 +++
 hw/bsp/olimex-p103/src/hal_bsp.c                | 2 ++
 hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c | 2 ++
 hw/bsp/p-nucleo-wb55-usbdongle/src/hal_bsp.c    | 3 +++
 hw/bsp/p-nucleo-wb55/src/hal_bsp.c              | 3 +++
 hw/bsp/pinetime/src/hal_bsp.c                   | 2 ++
 hw/bsp/puckjs/src/hal_bsp.c                     | 2 ++
 hw/bsp/rb-blend2/src/hal_bsp.c                  | 2 ++
 hw/bsp/rb-nano2/src/hal_bsp.c                   | 2 ++
 hw/bsp/reel_board/src/hal_bsp.c                 | 2 ++
 hw/bsp/ruuvitag_rev_b/src/hal_bsp.c             | 2 ++
 hw/bsp/stm32f3discovery/src/hal_bsp.c           | 2 ++
 hw/bsp/stm32f411discovery/src/hal_bsp.c         | 3 +++
 hw/bsp/stm32f429discovery/src/hal_bsp.c         | 2 ++
 hw/bsp/stm32f4discovery/src/hal_bsp.c           | 2 ++
 hw/bsp/stm32f7discovery/src/hal_bsp.c           | 2 ++
 hw/bsp/stm32l152discovery/src/hal_bsp.c         | 2 ++
 hw/bsp/telee02/src/hal_bsp.c                    | 2 ++
 hw/bsp/ublox_bmd_345/src/hal_bsp.c              | 2 ++
 hw/bsp/usbmkw41z/src/hal_bsp.c                  | 2 ++
 hw/bsp/vbluno51/src/hal_bsp.c                   | 2 ++
 hw/bsp/vbluno52/src/hal_bsp.c                   | 2 ++
 hw/bsp/weact_g431cb/src/hal_bsp.c               | 3 +++
 71 files changed, 157 insertions(+), 1 deletion(-)

diff --git a/hw/bsp/ada_feather_nrf52/src/hal_bsp.c b/hw/bsp/ada_feather_nrf52/src/hal_bsp.c
index 41e6d1f66..d49d805a1 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 <stddef.h>
 #include <assert.h>
 #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 f46cae54e..1c7a0e1f8 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -309,4 +310,5 @@ hal_bsp_init(void)
 void
 hal_bsp_deinit(void)
 {
+    Cortex_DisableAll();
 }
diff --git a/hw/bsp/arduino_primo_nrf52/src/hal_bsp.c b/hw/bsp/arduino_primo_nrf52/src/hal_bsp.c
index 459ae7f55..2a464dd52 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 <stddef.h>
 #include <assert.h>
 #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 9f4da9171..06b9fe602 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 9d29775ab..9631831b7 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 9f10e78e5..cf1a8070b 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 52802ae41..e09a2692e 100644
--- a/hw/bsp/bbc_microbit/src/hal_bsp.c
+++ b/hw/bsp/bbc_microbit/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 589b73d66..c63c10a72 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 12405cde7..7a897d2bb 100644
--- a/hw/bsp/ble400/src/hal_bsp.c
+++ b/hw/bsp/ble400/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 b8cced159..4161f940d 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 12405cde7..7a897d2bb 100644
--- a/hw/bsp/bmd200/src/hal_bsp.c
+++ b/hw/bsp/bmd200/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 022729629..2156debba 100644
--- a/hw/bsp/bmd300eval/src/hal_bsp.c
+++ b/hw/bsp/bmd300eval/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 a39b6136b..70f5da2f9 100644
--- a/hw/bsp/calliope_mini/src/hal_bsp.c
+++ b/hw/bsp/calliope_mini/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 f5e0ca229..58fa91f27 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 809888a78..5509a8834 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 3bb0c712c..2e53db04b 100644
--- a/hw/bsp/dwm1001-dev/src/hal_bsp.c
+++ b/hw/bsp/dwm1001-dev/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 419466728..56f2592b3 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 <stddef.h>
 #include <assert.h>
 #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 e0fe43375..bed6255cc 100644
--- a/hw/bsp/frdm-k64f/src/hal_bsp.c
+++ b/hw/bsp/frdm-k64f/src/hal_bsp.c
@@ -23,6 +23,7 @@
 #include <sys/types.h>
 #include <stdio.h>
 #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/lpcxpresso55s28/src/hal_bsp.c b/hw/bsp/lpcxpresso55s28/src/hal_bsp.c
index 1e3953dee..42b84ee58 100644
--- a/hw/bsp/lpcxpresso55s28/src/hal_bsp.c
+++ b/hw/bsp/lpcxpresso55s28/src/hal_bsp.c
@@ -23,6 +23,7 @@
 #include <sys/types.h>
 #include <stdio.h>
 #include <os/mynewt.h>
+#include "mynewt_cm.h"
 #include <bsp/bsp.h>
 #include <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 0042519e6..6a7ff7d25 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 <stddef.h>
 #include <assert.h>
 #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 943df0533..8e7590639 100644
--- a/hw/bsp/nordic_pca10028/src/hal_bsp.c
+++ b/hw/bsp/nordic_pca10028/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 b33572c17..c7bd06f9c 100644
--- a/hw/bsp/nordic_pca10040/src/hal_bsp.c
+++ b/hw/bsp/nordic_pca10040/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 f62e287d7..5d1a289d6 100644
--- a/hw/bsp/nordic_pca10056/src/hal_bsp.c
+++ b/hw/bsp/nordic_pca10056/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 f62e287d7..5d1a289d6 100644
--- a/hw/bsp/nordic_pca10059/src/hal_bsp.c
+++ b/hw/bsp/nordic_pca10059/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 1d88dca42..21ee9fe5e 100644
--- a/hw/bsp/nordic_pca10090/src/hal_bsp.c
+++ b/hw/bsp/nordic_pca10090/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 c491b9684..b52c095ae 100644
--- a/hw/bsp/nordic_pca10095/src/hal_bsp.c
+++ b/hw/bsp/nordic_pca10095/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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/nordic_pca10095_net/src/hal_bsp.c b/hw/bsp/nordic_pca10095_net/src/hal_bsp.c
index d26bce94a..7476031be 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 <stddef.h>
 #include <assert.h>
 #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/nordic_pca10121/net/src/hal_bsp.c b/hw/bsp/nordic_pca10121/net/src/hal_bsp.c
index d26bce94a..7476031be 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 <stddef.h>
 #include <assert.h>
 #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/nordic_pca10121/src/hal_bsp.c b/hw/bsp/nordic_pca10121/src/hal_bsp.c
index 68a005417..4be822e72 100644
--- a/hw/bsp/nordic_pca10121/src/hal_bsp.c
+++ b/hw/bsp/nordic_pca10121/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #include <os/mynewt.h>
+#include "mynewt_cm.h"
 #include <nrfx.h>
 #include <flash_map/flash_map.h>
 #include <hal/hal_bsp.h>
@@ -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 2ab8a3e4c..c9a8c90bc 100644
--- a/hw/bsp/nordic_pca20020/src/hal_bsp.c
+++ b/hw/bsp/nordic_pca20020/src/hal_bsp.c
@@ -22,6 +22,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 c491b9684..b52c095ae 100644
--- a/hw/bsp/nordic_thingy53/src/hal_bsp.c
+++ b/hw/bsp/nordic_thingy53/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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/nrf51-arduino_101/src/hal_bsp.c b/hw/bsp/nrf51-arduino_101/src/hal_bsp.c
index 26076d650..7b3ad0069 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 <stddef.h>
 #include <assert.h>
 #include "os/mynewt.h"
+#include "mynewt_cm.h"
 #include "nrfx.h"
 #include <mcu/nrf51_hal.h>
 #include <hal/hal_bsp.h>
@@ -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 5dc79ab38..6170f1c70 100644
--- a/hw/bsp/nrf51-blenano/src/hal_bsp.c
+++ b/hw/bsp/nrf51-blenano/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 fab06af5c..2eea79404 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 c5166f47d..33eb9d070 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 79530778b..8455bad44 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 48ff5832e..459b4a316 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 306bbd947..bbb9692f2 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 8bd11f55d..294798eef 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 cac1f7c4c..bc9ead434 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 c32d53752..16e791dbb 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 08815d447..826a73bc9 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 8fc726600..7c9d92a12 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 3d2062730..c87ddb9a0 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 <hal/hal_bsp.h>
@@ -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 8384d2322..53fe12429 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 <hal/hal_bsp.h>
@@ -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 6cbf95d1f..5c1073f0b 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 <hal/hal_bsp.h>
@@ -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 d9f07db3b..9880d7947 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 cd3157d16..9020ccb2c 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 506de0807..0de8f1c9c 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 <hal/hal_bsp.h>
@@ -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 59a2d9567..91336da09 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 297b2b0a3..02cd545d1 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 7f276cfb0..13db4f60e 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 6e289b1c2..8c2caaf08 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 723916cb7..66bfe5bcb 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 3bb0c712c..2e53db04b 100644
--- a/hw/bsp/puckjs/src/hal_bsp.c
+++ b/hw/bsp/puckjs/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 a2a8ea8e0..9cb5ffec1 100644
--- a/hw/bsp/rb-blend2/src/hal_bsp.c
+++ b/hw/bsp/rb-blend2/src/hal_bsp.c
@@ -20,6 +20,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 00c026e28..2d0e4aff0 100644
--- a/hw/bsp/rb-nano2/src/hal_bsp.c
+++ b/hw/bsp/rb-nano2/src/hal_bsp.c
@@ -20,6 +20,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 51c56b320..82c75c797 100644
--- a/hw/bsp/reel_board/src/hal_bsp.c
+++ b/hw/bsp/reel_board/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 837f0559e..337a199fc 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 <stddef.h>
 #include <assert.h>
 #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 0d28425fc..eee167cfd 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 b7a8681fe..14fde03b1 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 0c6d5c9f3..638e5f792 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 9fc921c1d..3741c7ec2 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 5bb0d5bd8..444b36676 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 245530961..505580ae8 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -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 4c32cda3e..ce0f4e1f0 100644
--- a/hw/bsp/telee02/src/hal_bsp.c
+++ b/hw/bsp/telee02/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 26bcf4981..43f06bf26 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 <stddef.h>
 #include <assert.h>
 #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/hal_bsp.c b/hw/bsp/usbmkw41z/src/hal_bsp.c
index fab0afbb6..ac743407c 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 7a2eee7bc..63119e4d8 100644
--- a/hw/bsp/vbluno51/src/hal_bsp.c
+++ b/hw/bsp/vbluno51/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 3bb0c712c..2e53db04b 100644
--- a/hw/bsp/vbluno52/src/hal_bsp.c
+++ b/hw/bsp/vbluno52/src/hal_bsp.c
@@ -21,6 +21,7 @@
 #include <stddef.h>
 #include <assert.h>
 #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 826f462fb..1dc95719b 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 <hal/hal_bsp.h>
 #include <hal/hal_flash_int.h>
@@ -169,6 +170,8 @@ hal_bsp_init(void)
 void
 hal_bsp_deinit(void)
 {
+    Cortex_DisableAll();
+
     RCC->AHB1ENR = 0x00000100;
     RCC->AHB2ENR = 0x00000000;
     RCC->AHB3ENR = 0x80000000;


(mynewt-core) 06/10: hw/mcu/MKW41Z4: Move NVIC_Relocate to hal_system_init

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit e996583745021ceed2cb6728ffe30d5346a87d72
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri Oct 4 12:23:20 2024 +0200

    hw/mcu/MKW41Z4: Move NVIC_Relocate to hal_system_init
    
    NVIC_Relocate call was placed in NXP generated file.
    Now it is moved to hal_system_init function that
    is way it's done in mynewt
    
    Startup code for usbmkw41z now calls hal_system_init
    as is the case for all mynewt platforms
    
    Signed-off-by: Jerzy Kasenberg <je...@codecoup.pl>
---
 .../src/arch/cortex_m0/gcc_startup_mkw41z.s        |  2 ++
 hw/mcu/nxp/mkw41z/src/hal_system_init.c            | 28 ++++++++++++++++++++++
 hw/mcu/nxp/mkw41z/src/system_MKW41Z4.c             |  2 --
 3 files changed, 30 insertions(+), 2 deletions(-)

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 e80a85ffc..73c15a58b 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/mcu/nxp/mkw41z/src/hal_system_init.c b/hw/mcu/nxp/mkw41z/src/hal_system_init.c
new file mode 100644
index 000000000..2d6348b83
--- /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 <mynewt_cm.h>
+
+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 77d87b947..aebc7fe63 100644
--- a/hw/mcu/nxp/mkw41z/src/system_MKW41Z4.c
+++ b/hw/mcu/nxp/mkw41z/src/system_MKW41Z4.c
@@ -67,7 +67,6 @@
 
 #include <stdint.h>
 #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();
 }
 
 /* ----------------------------------------------------------------------------


(mynewt-core) 07/10: hw/mcu/MK8xF: Use autogenerated linker script

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 5e45350445aadb85fe681259c86d1f555871aa04
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri Oct 4 12:30:53 2024 +0200

    hw/mcu/MK8xF: Use autogenerated linker script
    
    This switches to autogenerated linker scripts for CortexM.
    
    Signed-off-by: Jerzy Kasenberg <je...@codecoup.pl>
---
 .rat-excludes                                      |   1 -
 hw/bsp/frdm-k82f/bsp.yml                           |   5 +-
 hw/bsp/frdm-k82f/frdm-k82_debug.cmd                |  22 ---
 hw/bsp/frdm-k82f/frdm-k82_download.cmd             |  22 ---
 hw/bsp/frdm-k82f/pkg.yml                           |   1 +
 hw/bsp/frdm-k82f/src/hal_bsp.c                     |  34 +---
 hw/bsp/frdm-k82f/syscfg.yml                        |   5 +-
 .../kinetis/MK8xF/MK82F/src/system_MK82F25615.c    | 212 ---------------------
 hw/mcu/nxp/kinetis/MK8xF/include/mcu/mcu_vectors.h |  24 +++
 .../MK8xF/include/mcu/vectors/mk82f25615_vectors.h | 143 ++++++++++++++
 hw/mcu/nxp/kinetis/src/hal_system_init.c           |  28 +++
 hw/mcu/nxp/mcux-sdk/pkg.yml                        |   1 +
 12 files changed, 202 insertions(+), 296 deletions(-)

diff --git a/.rat-excludes b/.rat-excludes
index 6c490eda3..ffe4164e4 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/frdm-k82f/bsp.yml b/hw/bsp/frdm-k82f/bsp.yml
index 24bf0a5e6..3bcc59fc2 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 96f0b2605..000000000
--- 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 96f0b2605..000000000
--- 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 8f3b7974b..fbf96dc0a 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 973d5ba24..618d66020 100644
--- a/hw/bsp/frdm-k82f/src/hal_bsp.c
+++ b/hw/bsp/frdm-k82f/src/hal_bsp.c
@@ -23,6 +23,7 @@
 #include <sys/types.h>
 #include <stdio.h>
 #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 3cb11043d..4292a94a0 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/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 82ac6e8d6..000000000
--- 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 <stdint.h>
-#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/mcu_vectors.h b/hw/mcu/nxp/kinetis/MK8xF/include/mcu/mcu_vectors.h
new file mode 100644
index 000000000..34020b928
--- /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 000000000..d0a455c71
--- /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 000000000..2d6348b83
--- /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 <mynewt_cm.h>
+
+void
+hal_system_init(void)
+{
+    /* Relocate the vector table */
+    NVIC_Relocate();
+}
diff --git a/hw/mcu/nxp/mcux-sdk/pkg.yml b/hw/mcu/nxp/mcux-sdk/pkg.yml
index f4ba93120..953abeede 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"


(mynewt-core) 05/10: hw/mcu/stm32: Cleanup hal_system_init

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 5472f775c19a054851a0fd28f4fb023605665d95
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri Oct 4 11:52:43 2024 +0200

    hw/mcu/stm32: Cleanup hal_system_init
    
    After NVIC_Relocate() was moved to different header
    all hal_system_init needs additional include
    
    Some leftover code was also cleaned.
    
    Signed-off-by: Jerzy Kasenberg <je...@codecoup.pl>
---
 hw/mcu/stm/stm32f0xx/src/hal_system_init.c              |  1 +
 hw/mcu/stm/stm32f1xx/src/hal_system_init.c              |  5 +----
 hw/mcu/stm/stm32f3xx/src/hal_system_init.c              | 11 ++++-------
 hw/mcu/stm/stm32f4xx/src/hal_system_init.c              |  5 +----
 hw/mcu/stm/stm32f7xx/src/hal_system_init.c              |  6 +-----
 hw/mcu/stm/stm32g0xx/src/hal_system_init.c              |  9 +--------
 hw/mcu/stm/stm32g4xx/src/hal_system_init.c              |  7 +++----
 hw/mcu/stm/stm32h7xx/src/hal_system_init.c              |  5 +----
 hw/mcu/stm/stm32l0xx/src/hal_system_init.c              |  5 +----
 .../stm/{stm32h7xx => stm32l1xx}/src/hal_system_init.c  | 17 +----------------
 hw/mcu/stm/stm32l1xx/src/system_stm32l1xx.c             |  3 ---
 hw/mcu/stm/stm32l4xx/src/hal_system_init.c              |  8 ++++----
 hw/mcu/stm/stm32u5xx/src/hal_system_init.c              |  5 +----
 hw/mcu/stm/stm32wbxx/src/hal_system_init.c              |  5 +----
 14 files changed, 21 insertions(+), 71 deletions(-)

diff --git a/hw/mcu/stm/stm32f0xx/src/hal_system_init.c b/hw/mcu/stm/stm32f0xx/src/hal_system_init.c
index 4206b8da9..33d46fdfe 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 <hal/hal_system.h>
+#include "mynewt_cm.h"
 
 void SystemClock_Config(void);
 
diff --git a/hw/mcu/stm/stm32f1xx/src/hal_system_init.c b/hw/mcu/stm/stm32f1xx/src/hal_system_init.c
index 0610072d1..3f8e63b4c 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 <hal/hal_system.h>
-
-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/src/hal_system_init.c b/hw/mcu/stm/stm32f3xx/src/hal_system_init.c
index 0c8b67a20..3f8e63b4c 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 <hal/hal_system.h>
-
-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/src/hal_system_init.c b/hw/mcu/stm/stm32f4xx/src/hal_system_init.c
index 96db76808..d819c47e7 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 <hal/hal_system.h>
-
-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/src/hal_system_init.c b/hw/mcu/stm/stm32f7xx/src/hal_system_init.c
index 01e408b45..522a2a11c 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 <hal/hal_system.h>
-
-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/src/hal_system_init.c b/hw/mcu/stm/stm32g0xx/src/hal_system_init.c
index dc995be19..bff9728fa 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 <hal/hal_system.h>
 
-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/src/hal_system_init.c b/hw/mcu/stm/stm32g4xx/src/hal_system_init.c
index 414a4daf0..eb8a213af 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 <hal/hal_system.h>
 
-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/src/hal_system_init.c b/hw/mcu/stm/stm32h7xx/src/hal_system_init.c
index 46d6e4bbc..8bd31e745 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 <hal/hal_system.h>
 
-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/src/hal_system_init.c b/hw/mcu/stm/stm32l0xx/src/hal_system_init.c
index a784b41fe..8e97f8e59 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 <hal/hal_system.h>
 
-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/stm32h7xx/src/hal_system_init.c b/hw/mcu/stm/stm32l1xx/src/hal_system_init.c
similarity index 71%
copy from hw/mcu/stm/stm32h7xx/src/hal_system_init.c
copy to hw/mcu/stm/stm32l1xx/src/hal_system_init.c
index 46d6e4bbc..866afa6a1 100644
--- a/hw/mcu/stm/stm32h7xx/src/hal_system_init.c
+++ b/hw/mcu/stm/stm32l1xx/src/hal_system_init.c
@@ -18,25 +18,10 @@
  */
 
 #include "os/mynewt.h"
-#include "mcu/stm32_hal.h"
-#include <hal/hal_system.h>
-
-extern char __vector_tbl_reloc__[];
-
-void SystemClock_Config(void);
+#include "mynewt_cm.h"
 
 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();
 }
-
diff --git a/hw/mcu/stm/stm32l1xx/src/system_stm32l1xx.c b/hw/mcu/stm/stm32l1xx/src/system_stm32l1xx.c
index 0d24392c7..3d43dc258 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/src/hal_system_init.c b/hw/mcu/stm/stm32l4xx/src/hal_system_init.c
index 5a1935b18..ac16557ab 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 <hal/hal_system.h>
 
-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/src/hal_system_init.c b/hw/mcu/stm/stm32u5xx/src/hal_system_init.c
index 46d6e4bbc..8bd31e745 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 <hal/hal_system.h>
 
-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/src/hal_system_init.c b/hw/mcu/stm/stm32wbxx/src/hal_system_init.c
index b848c4c90..ef678d2dd 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 <hal/hal_system.h>
 
-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();
 


(mynewt-core) 02/10: hw/cmsis: Add NVIC_DisableAll and Cortex_DisableAll

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 51938d337fdad58a414615c4957061df94959cc8
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Wed Oct 2 09:29:43 2024 +0200

    hw/cmsis: Add NVIC_DisableAll and Cortex_DisableAll
    
    New function NVIC_DisableAll() disables all interrupts
    on NVIC.
    
    Cortex_DisableAll() disables all interrupts and SysTick
    
    Those function are intended to be called from hal_bsp_deinit
    to disable interrupts before application code
    reconfigures them from what boot loader set up.
    
    Signed-off-by: Jerzy Kasenberg <je...@codecoup.pl>
---
 hw/cmsis-core/include/{mynewt_nvic.h => mynewt_cm.h} | 18 +++++++++++-------
 hw/cmsis-core/include/mynewt_nvic.h                  | 11 +++++++++++
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/hw/cmsis-core/include/mynewt_nvic.h b/hw/cmsis-core/include/mynewt_cm.h
similarity index 77%
copy from hw/cmsis-core/include/mynewt_nvic.h
copy to hw/cmsis-core/include/mynewt_cm.h
index d861225af..4e65a6908 100644
--- a/hw/cmsis-core/include/mynewt_nvic.h
+++ b/hw/cmsis-core/include/mynewt_cm.h
@@ -17,14 +17,18 @@
  * under the License.
  */
 
-#ifndef MYNEWT_NVIC_H
-#define MYNEWT_NVIC_H
+#ifndef MYNEWT_CM_H
+#define MYNEWT_CM_H
 
-#include <mcu/cmsis_nvic.h>
-#include <os/util.h>
+#include <mynewt_nvic.h>
 
-void NVIC_Relocate(void);
-void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
-uint32_t NVIC_GetVector(IRQn_Type IRQn);
+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
index d861225af..cd58ca953 100644
--- a/hw/cmsis-core/include/mynewt_nvic.h
+++ b/hw/cmsis-core/include/mynewt_nvic.h
@@ -27,4 +27,15 @@ 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


(mynewt-core) 01/10: hw/cmsis: Cleanup NVIC related prototypes

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit c88a97c489454f6198b5d227a72b6f35431f4066
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Wed Oct 2 09:26:14 2024 +0200

    hw/cmsis: Cleanup NVIC related prototypes
    
    NVIC_Relocate, NVIC_SetVector, NVIC_GetVector prototypes
    were defined in a lot of places.
    Now they are put in one header.
    
    Signed-off-by: Jerzy Kasenberg <je...@codecoup.pl>
---
 .../include/mynewt_nvic.h}                         | 28 ++++------------------
 hw/mcu/ambiq/apollo2/include/mcu/cmsis_nvic.h      |  4 ----
 hw/mcu/ambiq/apollo3/include/mcu/cmsis_nvic.h      |  4 ----
 hw/mcu/atmel/samd21xx/include/mcu/cmsis_nvic.h     |  4 ----
 hw/mcu/dialog/da1469x/include/mcu/cmsis_nvic.h     |  4 ----
 hw/mcu/nordic/nrf51xxx/include/mcu/cmsis_nvic.h    |  4 ----
 hw/mcu/nordic/nrf52xxx/include/mcu/cmsis_nvic.h    |  4 ----
 hw/mcu/nordic/nrf5340/include/mcu/cmsis_nvic.h     |  4 ----
 hw/mcu/nordic/nrf5340_net/include/mcu/cmsis_nvic.h |  4 ----
 hw/mcu/nordic/nrf91xx/include/mcu/cmsis_nvic.h     |  4 ----
 hw/mcu/nxp/kinetis/MK8xF/include/mcu/cmsis_nvic.h  |  4 ----
 hw/mcu/nxp/lpc55xx/include/mcu/cmsis_nvic.h        |  4 ----
 hw/mcu/nxp/mkw41z/include/mcu/cmsis_nvic.h         |  4 ----
 hw/mcu/stm/stm32f0xx/include/mcu/cmsis_nvic.h      |  4 ----
 hw/mcu/stm/stm32f1xx/include/mcu/cmsis_nvic.h      |  4 ----
 hw/mcu/stm/stm32f3xx/include/mcu/cmsis_nvic.h      |  4 ----
 hw/mcu/stm/stm32f4xx/include/mcu/cmsis_nvic.h      |  4 ----
 hw/mcu/stm/stm32f7xx/include/mcu/cmsis_nvic.h      |  4 ----
 hw/mcu/stm/stm32g0xx/include/mcu/cmsis_nvic.h      |  4 ----
 hw/mcu/stm/stm32g4xx/include/mcu/cmsis_nvic.h      |  4 ----
 hw/mcu/stm/stm32h7xx/include/mcu/cmsis_nvic.h      |  4 ----
 hw/mcu/stm/stm32l0xx/include/mcu/cmsis_nvic.h      |  4 ----
 hw/mcu/stm/stm32l1xx/include/mcu/cmsis_nvic.h      |  4 ----
 hw/mcu/stm/stm32l4xx/include/mcu/cmsis_nvic.h      |  4 ----
 hw/mcu/stm/stm32u5xx/include/mcu/cmsis_nvic.h      |  4 ----
 hw/mcu/stm/stm32wbxx/include/mcu/cmsis_nvic.h      |  4 ----
 26 files changed, 5 insertions(+), 123 deletions(-)

diff --git a/hw/mcu/atmel/samd21xx/include/mcu/cmsis_nvic.h b/hw/cmsis-core/include/mynewt_nvic.h
similarity index 67%
copy from hw/mcu/atmel/samd21xx/include/mcu/cmsis_nvic.h
copy to hw/cmsis-core/include/mynewt_nvic.h
index 4b8909b61..d861225af 100644
--- a/hw/mcu/atmel/samd21xx/include/mcu/cmsis_nvic.h
+++ b/hw/cmsis-core/include/mynewt_nvic.h
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -17,32 +17,14 @@
  * under the License.
  */
 
-/* mbed Microcontroller Library - cmsis_nvic
- * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
- *
- * CMSIS-style functionality to support dynamic vectors
- */
-
-#ifndef __CMSIS_NVIC_H__
-#define __CMSIS_NVIC_H__
-
-#include <stdint.h>
-
-#define NVIC_NUM_VECTORS      (16 + 29)   // CORE + MCU Peripherals
-#define NVIC_USER_IRQ_OFFSET  16
+#ifndef MYNEWT_NVIC_H
+#define MYNEWT_NVIC_H
 
-#include <mcu/cortex_m0.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <mcu/cmsis_nvic.h>
+#include <os/util.h>
 
 void NVIC_Relocate(void);
 void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
 uint32_t NVIC_GetVector(IRQn_Type IRQn);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif
diff --git a/hw/mcu/ambiq/apollo2/include/mcu/cmsis_nvic.h b/hw/mcu/ambiq/apollo2/include/mcu/cmsis_nvic.h
index 1e8fec1d8..ee509ac6d 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/apollo3/include/mcu/cmsis_nvic.h b/hw/mcu/ambiq/apollo3/include/mcu/cmsis_nvic.h
index a7398f992..f1d4bd71c 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/atmel/samd21xx/include/mcu/cmsis_nvic.h b/hw/mcu/atmel/samd21xx/include/mcu/cmsis_nvic.h
index 4b8909b61..788b65c0e 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 04298ac14..a298498dd 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 5d2ae8304..cd1b74911 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/nrf52xxx/include/mcu/cmsis_nvic.h b/hw/mcu/nordic/nrf52xxx/include/mcu/cmsis_nvic.h
index 11a812d33..363be0275 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/nrf5340/include/mcu/cmsis_nvic.h b/hw/mcu/nordic/nrf5340/include/mcu/cmsis_nvic.h
index 94e9e986a..aa0694057 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_net/include/mcu/cmsis_nvic.h b/hw/mcu/nordic/nrf5340_net/include/mcu/cmsis_nvic.h
index 0c26de040..fd0d8811a 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/nrf91xx/include/mcu/cmsis_nvic.h b/hw/mcu/nordic/nrf91xx/include/mcu/cmsis_nvic.h
index 26656353f..de60957ed 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/nxp/kinetis/MK8xF/include/mcu/cmsis_nvic.h b/hw/mcu/nxp/kinetis/MK8xF/include/mcu/cmsis_nvic.h
index ed3ca6005..61147286f 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/lpc55xx/include/mcu/cmsis_nvic.h b/hw/mcu/nxp/lpc55xx/include/mcu/cmsis_nvic.h
index 4b6b98124..785852202 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/mkw41z/include/mcu/cmsis_nvic.h b/hw/mcu/nxp/mkw41z/include/mcu/cmsis_nvic.h
index c6d951930..918adf9e0 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/stm/stm32f0xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32f0xx/include/mcu/cmsis_nvic.h
index e7b89009c..3f0b2a01b 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/stm32f1xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32f1xx/include/mcu/cmsis_nvic.h
index a1b36b9eb..fc3880c16 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/stm32f3xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32f3xx/include/mcu/cmsis_nvic.h
index ceb3f8651..93c50b770 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/stm32f4xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32f4xx/include/mcu/cmsis_nvic.h
index 0a74b2ae1..04663a563 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/stm32f7xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32f7xx/include/mcu/cmsis_nvic.h
index 040d9cf16..cf130a2f7 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/stm32g0xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32g0xx/include/mcu/cmsis_nvic.h
index cd25c74c2..551bb023d 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/stm32g4xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32g4xx/include/mcu/cmsis_nvic.h
index a9d900394..366e1f137 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/stm32h7xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32h7xx/include/mcu/cmsis_nvic.h
index 7f11693ae..53b1c35d8 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/stm32l0xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32l0xx/include/mcu/cmsis_nvic.h
index 8b6225805..1c53b9581 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/stm32l1xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32l1xx/include/mcu/cmsis_nvic.h
index 5526559db..93fe85a88 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/stm32l4xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32l4xx/include/mcu/cmsis_nvic.h
index dbf2cc2e7..0f1de3caa 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/stm32u5xx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32u5xx/include/mcu/cmsis_nvic.h
index d92bc2d8b..9e1ab7c20 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/stm32wbxx/include/mcu/cmsis_nvic.h b/hw/mcu/stm/stm32wbxx/include/mcu/cmsis_nvic.h
index 8e268d346..aafebedbf 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


(mynewt-core) 04/10: mcu/nrf: Move NVIC_Relocate to hal_system_init

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 25bfdb1be129ba6707a036ed51c52e4459f50f1a
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri Oct 4 11:40:57 2024 +0200

    mcu/nrf: Move NVIC_Relocate to hal_system_init
    
    Function NVIC_Relocate() was called in SystemInit() which
    is in file from Nordic.
    
    Now call is moved to mynewt specific function hal_system_init
    that is called just after SystemInit finishes.
    This is done to leave file from external source as close to
    origin as possible in case of future update.
    
    Signed-off-by: Jerzy Kasenberg <je...@codecoup.pl>
---
 hw/mcu/nordic/nrf51xxx/src/hal_system.c            | 3 +++
 hw/mcu/nordic/nrf51xxx/src/system_nrf51.c          | 2 --
 hw/mcu/nordic/nrf52xxx/src/hal_system.c            | 2 ++
 hw/mcu/nordic/nrf52xxx/src/system_nrf52.c          | 2 --
 hw/mcu/nordic/nrf5340/src/hal_system.c             | 3 +++
 hw/mcu/nordic/nrf5340/src/system_nrf5340.c         | 2 --
 hw/mcu/nordic/nrf5340_net/src/hal_system.c         | 3 +++
 hw/mcu/nordic/nrf5340_net/src/system_nrf5340_net.c | 2 --
 hw/mcu/nordic/nrf91xx/src/hal_system.c             | 3 +++
 hw/mcu/nordic/nrf91xx/src/system_nrf9160.c         | 2 --
 10 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/hw/mcu/nordic/nrf51xxx/src/hal_system.c b/hw/mcu/nordic/nrf51xxx/src/hal_system.c
index 03e2eb489..884067ebe 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 <mcu/cortex_m0.h>
+#include "mynewt_cm.h"
 #include "hal/hal_system.h"
 #include <nrf51.h>
 #include <nrf51_bitfields.h>
@@ -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 c90ed6f01..55e8de81e 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/src/hal_system.c b/hw/mcu/nordic/nrf52xxx/src/hal_system.c
index 497c7b6a9..cd8e63d39 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 c236e0b73..5046afd04 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/src/hal_system.c b/hw/mcu/nordic/nrf5340/src/hal_system.c
index a1e863f32..ff9305d07 100644
--- a/hw/mcu/nordic/nrf5340/src/hal_system.c
+++ b/hw/mcu/nordic/nrf5340/src/hal_system.c
@@ -22,6 +22,7 @@
 #include <mcu/nrf5340_clock.h>
 #include <hal/hal_system.h>
 #include <hal/hal_debug.h>
+#include "mynewt_cm.h"
 #include <nrf.h>
 #include <nrfx_config.h>
 #include <hal/nrf_oscillators.h>
@@ -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 bf01a9f45..ef8ad0d11 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/src/hal_system.c b/hw/mcu/nordic/nrf5340_net/src/hal_system.c
index d7d1f3cb5..71322cf56 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 <mcu/nrf5340_net_clock.h>
 #include <hal/hal_system.h>
 #include <hal/hal_debug.h>
+#include <mynewt_cm.h>
 #include <nrf.h>
 
 /**
@@ -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 2888f0e0c..bde6bf804 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/src/hal_system.c b/hw/mcu/nordic/nrf91xx/src/hal_system.c
index 66e24e87d..f370ffb04 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 8100a955f..615c27335 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();
 }
 
 


(mynewt-core) 08/10: hw/mcu/apollo: Move NVIC_Relocate to hal_system_init

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit ffbe8b8aeb203278aa0708b18f131d047ebf5f87
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri Oct 4 12:39:29 2024 +0200

    hw/mcu/apollo: Move NVIC_Relocate to hal_system_init
    
    NVIC_Relocate call was placed in Ambiq generated file.
    Now it is moved to hal_system_init function that
    is way it's done in mynewt
    
    hal_bsp_deinit() disable NVIC interrupts as well.
    
    Signed-off-by: Jerzy Kasenberg <je...@codecoup.pl>
---
 hw/bsp/apollo2_evb/src/hal_bsp.c             | 2 ++
 hw/bsp/apollo2_evb/src/system_apollo2.c      | 2 --
 hw/bsp/apollo3_evb/src/hal_bsp.c             | 2 ++
 hw/bsp/apollo3_evb/src/system_apollo3.c      | 2 --
 hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h | 1 +
 hw/mcu/ambiq/apollo2/src/hal_system.c        | 1 +
 hw/mcu/ambiq/apollo3/include/mcu/cortex_m4.h | 1 +
 hw/mcu/ambiq/apollo3/src/hal_system.c        | 1 +
 8 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/hw/bsp/apollo2_evb/src/hal_bsp.c b/hw/bsp/apollo2_evb/src/hal_bsp.c
index 3c29955c7..a349e8a19 100644
--- a/hw/bsp/apollo2_evb/src/hal_bsp.c
+++ b/hw/bsp/apollo2_evb/src/hal_bsp.c
@@ -24,6 +24,7 @@
 #include <bsp/bsp.h>
 #include <hal/hal_spi.h>
 #include <mcu/hal_apollo2.h>
+#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 034a4d3b0..56b72d073 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 d49ac016c..78fa1bcf8 100644
--- a/hw/bsp/apollo3_evb/src/hal_bsp.c
+++ b/hw/bsp/apollo3_evb/src/hal_bsp.c
@@ -22,6 +22,7 @@
 #include <assert.h>
 
 #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 2ae2b45e8..89965ef42 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/mcu/ambiq/apollo2/include/mcu/cortex_m4.h b/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h
index d9779873d..b1cfb8c03 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 43058d81b..31e05a4b3 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/cortex_m4.h b/hw/mcu/ambiq/apollo3/include/mcu/cortex_m4.h
index d006e34d1..4b1d638df 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 770f030d6..e811c69ef 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


(mynewt-core) 10/10: hw/mcu/samd21xx: Update repo version

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit d6534df12f7a0913e9225debd2011b9211a14405
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Mon Nov 4 19:34:22 2024 +0100

    hw/mcu/samd21xx: Update repo version
    
    External repository switched to master branch for now.
    
    Signed-off-by: Jerzy Kasenberg <je...@gmail.com>
---
 hw/mcu/atmel/samd21xx/ext/pkg.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/mcu/atmel/samd21xx/ext/pkg.yml b/hw/mcu/atmel/samd21xx/ext/pkg.yml
index 4590209c5..9dd157d56 100644
--- a/hw/mcu/atmel/samd21xx/ext/pkg.yml
+++ b/hw/mcu/atmel/samd21xx/ext/pkg.yml
@@ -23,7 +23,7 @@ pkg.type: sdk
 
 repository.atmel-samd21xx:
     type: github
-    vers: mynewt_1_10_0_tag-commit
+    vers: 0.0.0
     branch: master
     user: runtimeco
     repo: mynewt_arduino_zero