From fa8669b0092240642af78e84c0e89f596444fdad Mon Sep 17 00:00:00 2001
From: tao_z <tzj0429@163.com>
Date: Sun, 29 May 2022 12:05:33 +0800
Subject: [PATCH] 修改vettable为flash,并更新ld文件
---
xl6600_flash.ld | 4 +---
Application/source/fbl_ap.c | 16 +++++-----------
2 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/Application/source/fbl_ap.c b/Application/source/fbl_ap.c
index 784deb3..d8c94d2 100644
--- a/Application/source/fbl_ap.c
+++ b/Application/source/fbl_ap.c
@@ -3,7 +3,7 @@
#include "xl_nvic.h"
#include <string.h>
__IO uint8_t ProgramRequest[8] __attribute__((section(".noinit_bootReqFlag_ram")));
-__IO uint32_t VectorTable[99] __attribute__((section(".RAMVectorTable")));
+// __IO uint32_t VectorTable[99] __attribute__((section(".RAMVectorTable")));
void FblSetFblProgramRequestFlag(void)
{
@@ -40,17 +40,11 @@
{
void (*pAppFun)(void);
uint32_t JumpAddr;
- JumpAddr = (void (*)(void))(*((uint32_t *)((APPLSTART_OFFSET + (uint32_t)4))));
- pAppFun = (void (*)(void))JumpAddr;
+ JumpAddr = (*((__IO uint32_t *)((APPLSTART_OFFSET + (uint32_t)4))));
+ pAppFun = (void (*)(void))(JumpAddr);
__set_MSP(*(__IO uint32_t *)APPLSTART_OFFSET);
- /* Copy application vector table to RAM */
- (void)memcpy((void *)VectorTable, (void *)APPLSTART_OFFSET, sizeof(VectorTable));
-
- __asm volatile("cpsid i"); // disable all interrupt
Ostick_ReInit();
- /* Relocate vector table in SRAM at the adress 0x20000000 */
- NVIC_SetVectorTable(NVIC_VectTab_RAM, 0); // set vector table at start of ram ((uint32_t)0x20000000)
-
- (*pAppFun)(); // jump
+ NVIC_SetVectorTable(NVIC_VectTab_FLASH, APPLSTART_OFFSET);
+ pAppFun(); // jump
}
diff --git a/xl6600_flash.ld b/xl6600_flash.ld
index 072b2d4..5f92114 100644
--- a/xl6600_flash.ld
+++ b/xl6600_flash.ld
@@ -43,8 +43,7 @@
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K
CRAM (xrw) : ORIGIN = 0x1FFFE800, LENGTH = 6K
DRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 18K
- RAM_VECT_TBL (xrw) : ORIGIN = 0x20000000, LENGTH = 0x200
- FALSH_DRIVER_RAM (xrw):ORIGIN = 0x20000200, LENGTH = 0x100
+ FALSH_DRIVER_RAM (xrw):ORIGIN = 0x20000000, LENGTH = 0x100
BOOTFLAG (xrw) : ORIGIN = 0x20000300, LENGTH = 0x100
FLASH_BOOT (rx) : ORIGIN = 0x0000000, LENGTH = 48K
@@ -65,7 +64,6 @@
. = ALIGN(8);
} >BOOTFLAG
- .RAMVectorTable : {KEEP(*(.RAMVectorTable))} > RAM_VECT_TBL
.flashdriver_ram : {KEEP(*(.flashdriver_ram))} > FALSH_DRIVER_RAM
--
Gitblit v1.8.0