summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ulf Samuelsson <ulf@grond.atmel.com>2010-01-12 22:10:01 +0100
committerGravatar Ulf Samuelsson <ulf@grond.atmel.com>2010-01-12 22:10:01 +0100
commitf87c270d7129f943da272608325c22f5997b337d (patch)
treed450514d679b64e5a51a4d2ccbafc1513fa0d7e2
parent61628ad4c3eea1fdd325f6f49720bb74e1af9382 (diff)
downloadat91bootstrap-f87c270d7129f943da272608325c22f5997b337d.tar.gz
at91bootstrap-f87c270d7129f943da272608325c22f5997b337d.tar.bz2
Add config item to ignore small dataflashes, and allow disabling dataflash recovery (to save code)
-rw-r--r--driver/Config.in.dataflash22
-rw-r--r--driver/dataflash.c7
-rw-r--r--driver/driver_cpp.mk8
3 files changed, 34 insertions, 3 deletions
diff --git a/driver/Config.in.dataflash b/driver/Config.in.dataflash
index 0101f15..445e053 100644
--- a/driver/Config.in.dataflash
+++ b/driver/Config.in.dataflash
@@ -8,6 +8,28 @@ config CONFIG_SPI_CLK
help
Which speed (in Hz) should the SPI run at.
+config CONFIG_SMALL_DATAFLASH
+ bool "Support < 32 Mbit dataflashes"
+ default y
+ depends on CONFIG_DATAFLASH
+ help
+ Deselect this to save some bytes of memory
+ at the expense of flexibility in selecting memory sizes.
+
+config CONFIG_DATAFLASH_RECOVERY
+ bool "Support Dataflash recovery by pressing a button"
+ default y
+ depends on CONFIG_DATAFLASH
+ depends on ALLOW_DATAFLASH_RECOVERY
+ help
+ Let bootstrap disassemble the first 7 double words
+ and check that all, except the reserved vector
+ contains a jump/branch
+
+config ALLOW_DATAFLASH_RECOVERY
+ bool
+ default n
+
# ------- SPI boot source -----------------------------------------------------
choice
diff --git a/driver/dataflash.c b/driver/dataflash.c
index dee8754..b71aacc 100644
--- a/driver/dataflash.c
+++ b/driver/dataflash.c
@@ -415,6 +415,7 @@ static int df_init (AT91PS_DF pDf)
switch (dfcode)
{
+#if defined(CONFIG_SMALL_DATAFLASH)
case AT45DB011D:
pDf->dfDescription.pages_number = 512;
pDf->dfDescription.pages_size = 264;
@@ -443,7 +444,7 @@ static int df_init (AT91PS_DF pDf)
pDf->dfDescription.pages_size = 528;
pDf->dfDescription.page_offset = 10;
break;
-
+#endif
case AT45DB321D:
pDf->dfDescription.pages_number = 8192;
pDf->dfDescription.pages_size = 528;
@@ -538,15 +539,15 @@ int load_df(unsigned int pcs, unsigned int img_addr, unsigned int img_size, unsi
if (df_init(pDf) == FAILURE)
return FAILURE;
-#if defined(AT91SAM9260) || defined(AT91SAM9XE) || defined(AT91SAM9G20)
+#if defined(CONFIG_DATAFLASH_RECOVERY)
/* Test if a button has been pressed or not */
/* Erase Page 0 to avoid infinite loop */
df_recovery(pDf);
#endif
+#if defined(CONFIG_APP_CHECK)
df_continuous_read(pDf, (char *)rxBuffer, 32, img_addr);
df_wait_ready(pDf);
-#if defined(CONFIG_APP_CHECK)
msg_print(MSG_PROMPT);
if (df_is_boot_valid((unsigned char*)rxBuffer) == FAILURE) {
msg_print(MSG_INVALID);
diff --git a/driver/driver_cpp.mk b/driver/driver_cpp.mk
index 14d26db..e41f77e 100644
--- a/driver/driver_cpp.mk
+++ b/driver/driver_cpp.mk
@@ -50,6 +50,14 @@ ifeq ($(CONFIG_DATAFLASH),y)
CPPFLAGS += -DCONFIG_DATAFLASH
endif
+ifeq ($(CONFIG_DATAFLASH_RECOVERY),y)
+CPPFLAGS += -DCONFIG_DATAFLASH_RECOVERY
+endif
+
+ifeq ($(CONFIG_SMALL_DATAFLASH),y)
+CPPFLAGS += -DCONFIG_SMALL_DATAFLASH
+endif
+
ifeq ($(CONFIG_NANDFLASH),y)
CPPFLAGS += -DCONFIG_NANDFLASH
endif