Changes to ARMv7-A boot logic to handle the case where we execute out of NOR FLASH
This commit is contained in:
parent
58b59e721f
commit
fec43ffc3b
@ -11,6 +11,18 @@ config SAMA5_NOR_MAIN
|
||||
depends on SAMA5_BOOT_ISRAM
|
||||
---help---
|
||||
nor_main is a tiny program that runs in ISRAM. nor_main will enable
|
||||
NOR flash then jump to the program in NOR flash
|
||||
NOR flash then either (1) jump to the program in NOR flash or (2)
|
||||
wait for you to break in with GDB to debug the NOR program.
|
||||
|
||||
config SAMA5_NOR_START
|
||||
bool "Start NOR program"
|
||||
default n
|
||||
depends on SAMA5_NOR_MAIN
|
||||
---help---
|
||||
The default behavior of the NOR boot program is to initialize the
|
||||
NOR FLASH at CS0, then patiently wait for you to break into the
|
||||
program with GDB. An alternative behvior is enabled with this
|
||||
option: If SAMA5_NOR_START is defined, then it will not wait but
|
||||
will, instead, immediately start the program in NOR FLASH.
|
||||
|
||||
endif
|
||||
|
@ -699,6 +699,20 @@ Configurations
|
||||
STATUS:
|
||||
2013-7-28: This configuration was verified functional.
|
||||
|
||||
norboot:
|
||||
This is a little program to help debug of code in NOR flash. It
|
||||
does the following:
|
||||
|
||||
- It enables and configures NOR FLASH, then
|
||||
- Waits for you to break in with GDB.
|
||||
|
||||
At that point, you can set the PC and begin executing from NOR FLASH
|
||||
under debug control.
|
||||
|
||||
NOTES:
|
||||
1. This program derives from the hello configuration. All of the
|
||||
notes there apply to this configuration as well.
|
||||
|
||||
ostest:
|
||||
This configuration directory, performs a simple OS test using
|
||||
examples/ostest.
|
||||
|
@ -228,8 +228,8 @@ CONFIG_BOOT_RUNFROMFLASH=y
|
||||
CONFIG_RAM_START=0x00304000
|
||||
CONFIG_RAM_VSTART=0x00304000
|
||||
CONFIG_RAM_SIZE=114688
|
||||
CONFIG_FLASH_START=0x1000000
|
||||
CONFIG_FLASH_VSTART=0x1000000
|
||||
CONFIG_FLASH_START=0x10000000
|
||||
CONFIG_FLASH_VSTART=0x10000000
|
||||
CONFIG_FLASH_SIZE=134217728
|
||||
|
||||
#
|
||||
|
@ -73,11 +73,11 @@ ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
|
||||
ifeq ($(WINTOOL),y)
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}"
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/common}"
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-a}"
|
||||
else
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/chip
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/common
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/armv7-m
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/armv7-a
|
||||
endif
|
||||
|
||||
all: libboard$(LIBEXT)
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "sctlr.h"
|
||||
#include "sam_periphclks.h"
|
||||
#include "chip/sam_hsmc.h"
|
||||
|
||||
@ -114,18 +115,33 @@ int nor_main(int argc, char *argv)
|
||||
HSMC_MODE_TDFCYCLES(1);
|
||||
putreg32(regval, SAM_HSMC_MODE(HSMC_CS0));
|
||||
|
||||
/* Disable the caches and the MMU. Disabling the MMU should be safe here
|
||||
* because there is a 1-to-1 identity mapping between the physical and
|
||||
* virtual addressing.
|
||||
*/
|
||||
|
||||
#if 0 /* Causes a crash */
|
||||
printf("Disabling the caches and the MMU\n");
|
||||
regval = cp15_rdsctlr();
|
||||
regval &= ~(SCTLR_M | SCTLR_C | SCTLR_I);
|
||||
cp15_wrsctlr(regval);
|
||||
#endif
|
||||
|
||||
#ifdef SAMA5_NOR_START
|
||||
/* Then jump into NOR flash */
|
||||
|
||||
#if 1
|
||||
printf("Waiting for GDB halt\n");
|
||||
fflush(stdout);
|
||||
for (;;);
|
||||
#else
|
||||
printf("Jumping to NOR flash on CS0\n");
|
||||
fflush(stdout);
|
||||
usleep(500*1000);
|
||||
|
||||
NOR_ENTRY();
|
||||
#else
|
||||
/* Or just wait patiently for the user to break in with GDB. */
|
||||
|
||||
printf("Waiting for GDB halt\n");
|
||||
fflush(stdout);
|
||||
for (;;);
|
||||
#endif
|
||||
|
||||
return 0; /* NOR_ENTRY() should not return */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user