Skip to content

Commit

Permalink
hw/mcu/apollo: Move NVIC_Relocate to hal_system_init
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
kasjer committed Oct 4, 2024
1 parent d84c4f5 commit 491c327
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions hw/bsp/apollo2_evb/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -184,6 +185,7 @@ hal_bsp_init(void)
void
hal_bsp_deinit(void)
{
Cortex_DisableAll();
}

int
Expand Down
2 changes: 0 additions & 2 deletions hw/bsp/apollo2_evb/src/system_apollo2.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,5 @@ SystemInit(void)
CLKGEN->CLKKEY = 0; // Disable write to CCTRL

SystemCoreClockUpdate();

NVIC_Relocate();
}

2 changes: 2 additions & 0 deletions hw/bsp/apollo3_evb/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <assert.h>

#include "os/mynewt.h"
#include "mynewt_cm.h"

#include "flash_map/flash_map.h"

Expand Down Expand Up @@ -70,6 +71,7 @@ hal_bsp_init(void)
void
hal_bsp_deinit(void)
{
Cortex_DisableAll();
}

int
Expand Down
2 changes: 0 additions & 2 deletions hw/bsp/apollo3_evb/src/system_apollo3.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,5 @@ SystemInit(void)
CLKGEN->CLKKEY = 0; // Disable write to CCTRL

SystemCoreClockUpdate();

NVIC_Relocate();
}

1 change: 1 addition & 0 deletions hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define __MCU_CORTEX_M4_H__

#include "mcu/apollo2.h"
#include "mynewt_cm.h"

#ifdef __cplusplus
extern "C" {
Expand Down
1 change: 1 addition & 0 deletions hw/mcu/ambiq/apollo2/src/hal_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ am_hal_mcuctrl_device_t adevinfo;
void
hal_system_init(void)
{
NVIC_Relocate();
}

void
Expand Down
1 change: 1 addition & 0 deletions hw/mcu/ambiq/apollo3/include/mcu/cortex_m4.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define __MCU_CORTEX_M4_H__

#include "mcu/apollo3.h"
#include "mynewt_cm.h"

#ifdef __cplusplus
extern "C" {
Expand Down
1 change: 1 addition & 0 deletions hw/mcu/ambiq/apollo3/src/hal_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
void
hal_system_init(void)
{
NVIC_Relocate();
}

void
Expand Down

0 comments on commit 491c327

Please sign in to comment.