From 5f895df9f30230375cbbf2320a7c8af00d852fc2 Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Tue, 6 Mar 2012 11:39:13 +0100
Subject: [PATCH 17/19] main: call memtest

---
 main.c |   93 ++++------------------------------------------------------------
 1 file changed, 5 insertions(+), 88 deletions(-)

diff --git a/main.c b/main.c
index 0ea1716..60f3fe7 100644
--- a/main.c
+++ b/main.c
@@ -86,6 +86,8 @@ int main(void)
     extern const char build_time[];
     extern const char git_user[];
     extern const char git_revision[];
+   
+	extern void mem_test(unsigned long ini, unsigned long end);
   
     /*
      * ================== 1st step: Hardware Initialization ================= 
@@ -107,92 +109,7 @@ int main(void)
     load_1wire_info();
 #endif
 
-    dbg_log(1, "Begin to load image...\n\r");
-    /*
-     * ==================== 2nd step: Load from media ==================== 
-     *
-     * Load from Dataflash in RAM 
-     */
-#if defined(CONFIG_DATAFLASH) || defined(CONFIG_DATAFLASH_CARD)
-#if defined(CONFIG_LOAD_LINUX)
-    LoadLinux();
-#elif defined(CONFIG_LOAD_NK) || defined(CONFIG_LOAD_EBOOT)
-    LoadWince();
-#else
-    load_df(AT91C_SPI_PCS_DATAFLASH, IMG_ADDRESS, IMG_SIZE, JUMP_ADDR);
-#endif
-#endif
-
-    /*
-     * Load from Nandflash in RAM 
-     */
-#if defined(CONFIG_NANDFLASH)
-#if defined(CONFIG_LOAD_LINUX)
-    LoadLinux();
-#elif defined(CONFIG_LOAD_NK) || defined(CONFIG_LOAD_EBOOT)
-    LoadWince();
-#else
-    read_nandflash((unsigned char *)JUMP_ADDR, (unsigned long)IMG_ADDRESS,
-                   (int)IMG_SIZE);
-#endif
-#endif
-
-    /*
-     * Load from Norflash in RAM 
-     */
-#ifdef CONFIG_FLASH
-    load_norflash(IMG_ADDRESS, IMG_SIZE, JUMP_ADDR);
-#endif
-
-#if defined(CONFIG_SDCARD)
-#if defined(CONFIG_LOAD_LINUX)
-    LoadLinux();
-#elif defined(CONFIG_LOAD_NK) || defined(CONFIG_LOAD_EBOOT)
-    LoadWince();
-#else
-    load_SDCard();
-#endif
-#endif
-
-    dbg_log(1, "Loading image done.\n\r");
-    /*
-     * ==================== 3rd step:  Process the Image =================== 
-     */
-    /*
-     * Uncompress the image 
-     */
-#ifdef CONFIG_GUNZIP
-    decompress_image((void *)IMG_ADDRESS, (void *)JUMP_ADDR, IMG_SIZE); /* NOT IMPLEMENTED YET */
-    msg_print(MSG_DECOMPRESS);
-#endif
-
-    /*
-     * ==================== 4th step: Start the application =================== 
-     */
-    /*
-     * Set linux arguments 
-     */
-#ifdef CONFIG_LINUX_ARG
-    linux_arg(LINUX_ARG);       /* NOT IMPLEMENTED YET */
-    msg_print(MSG_LINUX);
-#endif                          /* LINUX_ARG */
-
-#ifdef CONFIG_SCLK
-    /* Switch slow clock late so that external oscillator has time to startup */
-    sclk_enable();
-#endif
-
-#ifdef WINCE
-#ifdef CONFIG_LOAD_NK
-    Jump(JUMP_ADDR + 0x1000);
-#else
-    Jump(JUMP_ADDR);
-#endif
-#else                           /* !WINCE */
-#ifdef CONFIG_LOAD_NK
-    return (JUMP_ADDR + 0x1000);
-#else
-    return JUMP_ADDR;
-#endif
-#endif
+    pp_printf("Running application at %p\n", mem_test);
+    mem_test(0x70000000,0x74000000);
+    return 0; /* not reached */
 }
-- 
1.7.9.5

