arch/arm/samv7: add ARCH_RAMVECTORS support

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko 2022-12-17 00:29:44 +02:00 committed by Xiang Xiao
parent e28e4fd320
commit cc0ee12092
3 changed files with 25 additions and 4 deletions

View file

@ -34,7 +34,9 @@
#include <arch/armv7-m/nvicpri.h>
#include "nvic.h"
#include "ram_vectors.h"
#ifdef CONFIG_ARCH_RAMVECTORS
# include "ram_vectors.h"
#endif
#include "arm_internal.h"
#ifdef CONFIG_SAMV7_GPIO_IRQ
@ -81,7 +83,7 @@ static void sam_dumpnvic(const char *msg, int irq)
irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
irqinfo(" INTCTRL: %08x VECTAB: %08x\n",
getreg32(NVIC_INTCTRL), getreg32(NVIC_VECTAB));
getreg32(NVIC_INTCTRL), getreg32(NVIC_VECTAB));
#if 0
irqinfo(" SYSH ENABLE MEMFAULT: %08x BUSFAULT: %08x USGFAULT: %08x "
"SYSTICK: %08x\n",
@ -359,6 +361,13 @@ void up_irqinitialize(void)
*/
arm_ramvec_initialize();
/* At this moment both I- and D-Caches have been already enabled in
* __start so we need to flush RAM vectors table to memory.
*/
up_clean_dcache((uintptr_t)g_ram_vectors,
(uintptr_t)g_ram_vectors + sizeof(g_ram_vectors));
#endif
/* Set all interrupts (and exceptions) to the default priority */

View file

@ -88,6 +88,12 @@ SECTIONS
_eronly = ABSOLUTE(.);
/* The RAM vector table (if present) should lie at the beginning of SRAM */
.ram_vectors : {
*(.ram_vectors)
} > sram
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
@ -97,7 +103,7 @@ SECTIONS
_edata = ABSOLUTE(.);
} > sram AT > flash
.ramfunc ALIGN(4): {
.ramfunc : ALIGN(4) {
_sramfuncs = ABSOLUTE(.);
*(.ramfunc .ramfunc.*)
_eramfuncs = ABSOLUTE(.);

View file

@ -63,6 +63,12 @@ SECTIONS
_eronly = ABSOLUTE(.);
/* The RAM vector table (if present) should lie at the beginning of SRAM */
.ram_vectors : {
*(.ram_vectors)
} > ksram
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
@ -72,7 +78,7 @@ SECTIONS
_edata = ABSOLUTE(.);
} > ksram AT > kflash
.ramfunc ALIGN(4): {
.ramfunc : ALIGN(4) {
_sramfuncs = ABSOLUTE(.);
*(.ramfunc .ramfunc.*)
_eramfuncs = ABSOLUTE(.);