From b62bf38e67060b929bbf443977339f244ef1438c Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 24 Feb 2010 02:28:51 +0000 Subject: Fix init of vector table git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2540 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/src/lpc313x/lpc313x_boot.c | 17 +++++++++++++++- nuttx/arch/arm/src/lpc313x/lpc313x_memorymap.h | 28 +++++++++++++++++--------- nuttx/arch/arm/src/lpc313x/lpc313x_resetclks.c | 2 +- 3 files changed, 35 insertions(+), 12 deletions(-) (limited to 'nuttx') diff --git a/nuttx/arch/arm/src/lpc313x/lpc313x_boot.c b/nuttx/arch/arm/src/lpc313x/lpc313x_boot.c index 5fe8a34d2..cc4a89f44 100755 --- a/nuttx/arch/arm/src/lpc313x/lpc313x_boot.c +++ b/nuttx/arch/arm/src/lpc313x/lpc313x_boot.c @@ -238,14 +238,29 @@ static void up_vectormapping(void) static void up_copyvectorblock(void) { + /* Copy the vectors into ISRAM at the address that will be mapped to the vector + * address: + * + * LPC313X_VECTOR_PADDR - Unmapped, physical address of vector table in SRAM + * LPC313X_VECTOR_VSRAM - Virtual address of vector table in SRAM + * LPC313X_VECTOR_VADDR - Virtual address of vector table (0x00000000 or 0xffff0000) + */ + uint32_t *src = (uint32_t*)&_vector_start; uint32_t *end = (uint32_t*)&_vector_end; - uint32_t *dest = (uint32_t*)LPC313X_VECTOR_VADDR; + uint32_t *dest = (uint32_t*)LPC313X_VECTOR_VSRAM; while (src < end) { *dest++ = *src++; } + + /* Then set the LPC313x shadow register, LPC313X_SYSCREG_ARM926SHADOWPTR, so that + * the vector table is mapped to address 0x0000:0000 - NOTE: that there is not yet + * full support for the vector table at address 0xffff0000. + */ + + putreg32(LPC313X_VECTOR_PADDR, LPC313X_SYSCREG_ARM926SHADOWPTR); } /************************************************************************************ diff --git a/nuttx/arch/arm/src/lpc313x/lpc313x_memorymap.h b/nuttx/arch/arm/src/lpc313x/lpc313x_memorymap.h index 5f1ac4cd4..4401a3df0 100755 --- a/nuttx/arch/arm/src/lpc313x/lpc313x_memorymap.h +++ b/nuttx/arch/arm/src/lpc313x/lpc313x_memorymap.h @@ -318,21 +318,29 @@ #define PGTABLE_COARSE_ALLOC (PGTABLE_COARSE_END_VADDR-PGTABLE_COARSE_BASE_VADDR) #define PGTABLE_NCOARSE_TABLES (PGTABLE_COARSE_SIZE / PGTBALE_COARSE_TABLE_ALLOC) -/* Determine the base address of the vector table */ +/* Determine the base address of the vector table: + * + * LPC313X_VECTOR_PADDR - Unmapped, physical address of vector table in SRAM + * LPC313X_VECTOR_VSRAM - Virtual address of vector table in SRAM + * LPC313X_VECTOR_VADDR - Virtual address of vector table (0x00000000 or 0xffff0000) + */ -#define VECTOR_TABLE_SIZE 0x00010000 +#define VECTOR_TABLE_SIZE 0x00010000 #ifdef CONFIG_ARCH_LOWVECTORS /* Vectors located at 0x0000:0000 */ -# define LPC313X_VECTOR_PADDR LPC313X_SHADOWSPACE_PSECTION -# define LPC313X_VECTOR_VADDR 0x00000000 -# define LPC313X_VECTOR_VCOARSE 0x00000000 -#else /* Vectors located at 0xffff:0000 */ +# define LPC313X_VECTOR_PADDR LPC313X_INTSRAM0_PADDR +# define LPC313X_VECTOR_VSRAM LPC313X_INTSRAM0_VADDR +# define LPC313X_VECTOR_VADDR 0x00000000 +# define LPC313X_VECTOR_VCOARSE 0x00000000 +#else /* Vectors located at 0xffff:0000 -- this probably does not work */ # if CONFIG_ARCH_CHIP_LPC3131 -# define LPC313X_VECTOR_PADDR (LPC313X_INTSRAM1_PADDR+LPC313X_INTSRAM1_SIZE-VECTOR_TABLE_SIZE) +# define LPC313X_VECTOR_PADDR (LPC313X_INTSRAM1_PADDR+LPC313X_INTSRAM1_SIZE-VECTOR_TABLE_SIZE) +# define LPC313X_VECTOR_VSRAM (LPC313X_INTSRAM1_VADDR+LPC313X_INTSRAM1_SIZE-VECTOR_TABLE_SIZE) # else -# define LPC313X_VECTOR_PADDR (LPC313X_INTSRAM0_PADDR+LPC313X_INTSRAM0_SIZE-VECTOR_TABLE_SIZE) +# define LPC313X_VECTOR_PADDR (LPC313X_INTSRAM0_PADDR+LPC313X_INTSRAM0_SIZE-VECTOR_TABLE_SIZE) +# define LPC313X_VECTOR_VSRAM (LPC313X_INTSRAM0_VADDR+LPC313X_INTSRAM0_SIZE-VECTOR_TABLE_SIZE) # endif -# define LPC313X_VECTOR_VADDR 0xffff0000 -# define LPC313X_VECTOR_VCOARSE 0xfff00000 +# define LPC313X_VECTOR_VADDR 0xffff0000 +# define LPC313X_VECTOR_VCOARSE 0xfff00000 #endif /************************************************************************************ diff --git a/nuttx/arch/arm/src/lpc313x/lpc313x_resetclks.c b/nuttx/arch/arm/src/lpc313x/lpc313x_resetclks.c index 822e3a647..382e2da09 100755 --- a/nuttx/arch/arm/src/lpc313x/lpc313x_resetclks.c +++ b/nuttx/arch/arm/src/lpc313x/lpc313x_resetclks.c @@ -94,7 +94,7 @@ void lpc313x_resetclks(void) bcrndx = lp313x_bcrndx((enum lpc313x_domainid_e)i); if (bcrndx != BCRNDX_INVALID) { - /* Yes.. isable all BCRs */ + /* Yes.. disable all BCRs */ putreg32(0, LPC313X_CGU_BCR(bcrndx)); } -- cgit v1.2.3