Fix clearing of SRAM when clocks reset
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2923 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
c53d951183
commit
53bedad161
@ -254,6 +254,9 @@
|
||||
|
||||
/* Default MMU flags for RAM memory, IO, vector region */
|
||||
|
||||
#define MMU_ROMFLAGS \
|
||||
(PMD_TYPE_SECT|PMD_BIT4|PMD_SECT_AP_READ)
|
||||
|
||||
#define MMU_MEMFLAGS \
|
||||
(PMD_TYPE_SECT|PMD_SECT_WB|PMD_BIT4|PMD_SECT_AP_WRITE|PMD_SECT_AP_READ)
|
||||
|
||||
@ -282,6 +285,47 @@
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/* Get the current value of the CP15 C1 control register */
|
||||
|
||||
static inline unsigned int get_cp15c1(void)
|
||||
{
|
||||
unsigned int retval;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"\tmrc p15, 0, %0, c1, c0"
|
||||
: "=r" (retval)
|
||||
:
|
||||
: "memory");
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Get the current value of the CP15 C2 page table pointer register */
|
||||
|
||||
static inline unsigned int get_cp15c2(void)
|
||||
{
|
||||
unsigned int retval;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"\tmrc p15, 0, %0, c2, c0"
|
||||
: "=r" (retval)
|
||||
:
|
||||
: "memory");
|
||||
return retval;
|
||||
}
|
||||
/* Get the current value of the CP15 C3 domain access register */
|
||||
|
||||
static inline unsigned int get_cp15c3(void)
|
||||
{
|
||||
unsigned int retval;
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"\tmrc p15, 0, %0, c3, c0"
|
||||
: "=r" (retval)
|
||||
:
|
||||
: "memory");
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* ARMv4/ARMv5 operation: Invalidate TLB
|
||||
* ARM926EJ-S operation: Invalidate set-associative
|
||||
* Data: Should be zero
|
||||
|
@ -285,6 +285,18 @@ static void up_vectormapping(void)
|
||||
|
||||
static void up_copyvectorblock(void)
|
||||
{
|
||||
uint32_t *src;
|
||||
uint32_t *end;
|
||||
uint32_t *dest;
|
||||
|
||||
/* If we are using vectors in low memory but RAM in that area has been marked
|
||||
* read only, then temparily mark the mapping write-able (non-buffered).
|
||||
*/
|
||||
|
||||
#if !defined(CONFIG_ARCH_ROMPGTABLE) && defined(CONFIG_ARCH_LOWVECTORS) && defined(CONFIG_PAGING)
|
||||
up_vectorpermissions(MMU_L2_VECTRWFLAGS);
|
||||
#endif
|
||||
|
||||
/* Copy the vectors into ISRAM at the address that will be mapped to the vector
|
||||
* address:
|
||||
*
|
||||
@ -293,15 +305,21 @@ static void up_copyvectorblock(void)
|
||||
* 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_VSRAM;
|
||||
src = (uint32_t*)&_vector_start;
|
||||
end = (uint32_t*)&_vector_end;
|
||||
dest = (uint32_t*)LPC313X_VECTOR_VSRAM;
|
||||
|
||||
while (src < end)
|
||||
{
|
||||
*dest++ = *src++;
|
||||
}
|
||||
|
||||
/* Make the vectors read-only, cacheable again */
|
||||
|
||||
#if !defined(CONFIG_ARCH_ROMPGTABLE) && defined(CONFIG_ARCH_LOWVECTORS) && defined(CONFIG_PAGING)
|
||||
up_vectorpermissions(MMU_L2_VECTROFLAGS);
|
||||
#endif
|
||||
|
||||
/* 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.
|
||||
@ -331,14 +349,6 @@ void up_boot(void)
|
||||
#ifndef CONFIG_ARCH_ROMPGTABLE
|
||||
up_setupmappings();
|
||||
|
||||
/* If we are using vectors in low memory but RAM in that area has been marked
|
||||
* read only, then temparily mark the mapping write-able (non-buffered).
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_ARCH_LOWVECTORS) && defined(CONFIG_PAGING)
|
||||
up_vectorpermissions(MMU_L2_VECTRWFLAGS);
|
||||
#endif
|
||||
|
||||
/* Provide a special mapping for the IRAM interrupt vector positioned in high
|
||||
* memory.
|
||||
*/
|
||||
@ -354,12 +364,6 @@ void up_boot(void)
|
||||
|
||||
up_copyvectorblock();
|
||||
|
||||
/* Make the vectors read-only, cacheable again */
|
||||
|
||||
#if !defined(CONFIG_ARCH_ROMPGTABLE) && defined(CONFIG_ARCH_LOWVECTORS) && defined(CONFIG_PAGING)
|
||||
up_vectorpermissions(MMU_L2_VECTROFLAGS);
|
||||
#endif
|
||||
|
||||
/* Reset all clocks */
|
||||
|
||||
lpc313x_resetclks();
|
||||
@ -381,6 +385,16 @@ void up_boot(void)
|
||||
|
||||
lpc313x_lowsetup();
|
||||
|
||||
/* NOTE: Something in the operation of lpc313x_resetclks() causes the first
|
||||
* 6 words of memory to be zeroed, wiping out the interrupt vectors. However,
|
||||
* moving the vector initialization until after the clock setup seems to hang
|
||||
* the system (and I can't step though the clock setup to find why without
|
||||
* losing my JTAG connection). So, the simplest work-around is to simply
|
||||
* initialize the vectors twice.
|
||||
*/
|
||||
|
||||
up_copyvectorblock();
|
||||
|
||||
/* Perform early serial initialization if we are going to use the serial driver */
|
||||
|
||||
#ifdef CONFIG_USE_EARLYSERIALINIT
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/lpc313x/lpc313x_lowputc.c
|
||||
*
|
||||
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -339,10 +339,6 @@ void lpc313x_lowsetup(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_lowputc
|
||||
*
|
||||
|
@ -183,7 +183,7 @@
|
||||
|
||||
/* Section MMU Flags */
|
||||
|
||||
#define LPC313X_SHADOWSPACE_MMUFLAGS MMU_MEMFLAGS
|
||||
#define LPC313X_SHADOWSPACE_MMUFLAGS MMU_ROMFLAGS
|
||||
#define LPC313X_INTSRAM_MMUFLAGS MMU_MEMFLAGS
|
||||
#define LPC313X_INTSROM_MMUFLAGS MMU_MEMFLAGS
|
||||
#define LPC313X_APB01_MMUFLAGS MMU_IOFLAGS
|
||||
|
Loading…
Reference in New Issue
Block a user