Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NVIC_DisableAll and Cortex_DisableAll functions #3318

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

kasjer
Copy link
Contributor

@kasjer kasjer commented Oct 4, 2024

Function NVIC_DisableAll() disable all interrupts on NVIC controller.
Cortex_DisableAll() disables all NVIC interrupts and stops SytTick that also can generate interrupt.

Call to Cortex_DisableAll() is added to all hal_bsp_deinit() functions that are executed before control is passed from the bootloader ot the application.

In some cases hal_bsp_deinit was added.

hal_system_init() was added to platforms that did not have this function.
Now hal_system_init() calls NVIC_Relocate() (previously NVIC_Relocate was often called from SystemInit() that is usually provided by MCU manufacturer. So mynewt had copies of those files with local modifications that made it harder to maintain in case of upgrade.

Same prototypes

void NVIC_Relocate(void);
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
uint32_t NVIC_GetVector(IRQn_Type IRQn);

were placed in many headers and now are put in just one.

NXP MK8xF now uses common startup code with auto-generated linker script like ST and Nordic chips.

Signed-off-by: Jerzy Kasenberg [email protected]

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 <[email protected]>
@github-actions github-actions bot added Nordic Nordic related STM STM32 related BSP size/m labels Oct 4, 2024
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
This switches to autogenerated linker scripts for CortexM.

Signed-off-by: Jerzy Kasenberg <[email protected]>
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]>
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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BSP Nordic Nordic related size/m STM STM32 related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant