From b047b393eecb0b9aeebb056ef5ee585a99940ba8 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Fri, 23 Aug 2019 00:34:40 +0800
Subject: [PATCH] Rename sama5d4_loader and update new sam-ba script

---
 /dev/null                                 |    0 
 tools/sama5d4_loader/nandflash-system.qml |   21 +++++++++++++++++++++
 tools/sama5d4_loader/nandflash-system.bat |    2 ++
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/tools/sama5d4_loader/nandflash-system.bat b/tools/sama5d4_loader/nandflash-system.bat
new file mode 100644
index 0000000..4856f09
--- /dev/null
+++ b/tools/sama5d4_loader/nandflash-system.bat
@@ -0,0 +1,2 @@
+sam-ba -x nandflash-system.qml > logfile.log 2>&1
+notepad logfile.log
diff --git a/tools/sama5d4_loader/nandflash-system.qml b/tools/sama5d4_loader/nandflash-system.qml
new file mode 100644
index 0000000..367e6d5
--- /dev/null
+++ b/tools/sama5d4_loader/nandflash-system.qml
@@ -0,0 +1,21 @@
+import SAMBA 3.2
+import SAMBA.Connection.Serial 3.2
+import SAMBA.Device.SAMA5D4 3.2
+
+SerialConnection {
+
+	device: SAMA5D4Xplained {
+	}
+
+	onConnectionOpened: {
+		initializeApplet("lowlevel")
+		initializeApplet("nandflash")
+
+		applet.erase(0, applet.memorySize)
+
+		applet.write(0x000000, "./images/bootstrap-sama5d4.bin", true)
+		applet.write(0x040000, "./images/u-boot-sama5d4.bin")
+		applet.write(0x100000, "./images/linuxrom-sama5d4.itb")
+		applet.write(0x800000, "./images/rootfs-sama5d4.ubi")
+	}
+}
\ No newline at end of file
diff --git a/tools/sama5d4_xplained_loader/ReadMe.txt b/tools/sama5d4_xplained_loader/ReadMe.txt
deleted file mode 100644
index 0972044..0000000
--- a/tools/sama5d4_xplained_loader/ReadMe.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-This project used to autoload bootstrap, u-boot, linux, rootfs image files in folder images into Nandflash by xxx.bat, and it's configured in xxx.qml.
-
-Load Files in images folder:
-   
-MT29F4G08: PageSize=2K(0x800) BlockSize=2(Planes)*64Pages=256K(0x40000)   Total: 256M(0x1000,0000)
-+-------------------------------------------------------------------------------------------------------
-         ImageName           ImageSize       LoadAddress        Size
-  bootstrap-sama5d4.bin       0x313C          0x000000        0x040000(256K)     
-   u-boot-sama5d4.bin         0x4A37C         0x040000        0x0C0000(512K)
-   u-boot-env(backup)         0x20000         0x0C0000        0x040000(256K)
-
-  linuxrom-sama5d4.bin        0x4A51E8        0x100000        0x700000(7M)
-   rootfs-sama5d4.ubi         0x4240000       0x800000        0xc800000(200M)
-     Apps Partition           48M             0xD000000       0x3000000(48M)
-
-	
\ No newline at end of file
diff --git a/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.bat b/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.bat
deleted file mode 100644
index 982912b..0000000
--- a/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-sam-ba -x demo_linux_nandflash_system.qml > logfile.log 2>&1
-notepad logfile.log
diff --git a/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.qml b/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.qml
deleted file mode 100644
index 7133bf0..0000000
--- a/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.qml
+++ /dev/null
@@ -1,76 +0,0 @@
-import SAMBA 3.2
-import SAMBA.Connection.Serial 3.2
-import SAMBA.Device.SAMA5D4 3.2
-
-SerialConnection {
-
-	device: SAMA5D4Xplained {
-		config {
-			nandflash {
-				header: 0xc1e04e07
-			}
-		}
-	}
-
-	function initNand() {
-		/* Placeholder: Nothing to do */
-	}
-
-	function getEraseSize(size) {
-		/* get smallest erase block size supported by applet */
-		var eraseSize
-		for (var i = 0; i <= 32; i++) {
-			eraseSize = 1 << i
-			if ((applet.eraseSupport & eraseSize) !== 0)
-				break;
-		}
-		eraseSize *= applet.pageSize
-
-		/* round up file size to erase block size */
-		return (size + eraseSize - 1) & ~(eraseSize - 1)
-	}
-
-	function eraseWrite(offset, filename, bootfile) {
-		/* get file size */
-		var file = File.open(filename, false)
-		var size = file.size()
-		file.close()
-
-		applet.erase(offset, getEraseSize(size))
-		applet.write(offset, filename, bootfile)
-	}
-
-	onConnectionOpened: {
-		var bootstrapFileName = "images/bootstrap-sama5d4.bin"
-		var ubootFileName = "images/u-boot-sama5d4.bin"
-		var linuxFileNmae = "images/linuxrom-sama5d4.itb"
-		var rootfsFileNmae = "images/rootfs-sama5d4.ubi"
-		
-		print("-I- === Initilize low level (system clocks) ===")
-		initializeApplet("lowlevel")
-
-		print("-I- === Initialize extram ===")
-		initializeApplet("extram")
-
-		print("-I- === Initialize nandflash access ===")
-		initializeApplet("nandflash")
-		
-		print("-I- === Erase nandflash access ===")
-		//applet.erase(0, 0x100000)
-		applet.erase()
-	
-		print("-I- === Load AT91Bootstrap  ===")
-		eraseWrite(0x000000, bootstrapFileName, true)
-
-		print("-I- === Load u-boot   ===")
-		eraseWrite(0x040000, ubootFileName)
-
-		print("-I- === Load linux kernel image  ===")
-		applet.write(0x100000, linuxFileNmae)
-
-		print("-I- === Load UBI rootfs image  ===")
-		applet.write(0x800000, rootfsFileNmae)
-
-		print("-I- === Done. ===")
-	}
-}
diff --git a/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.qmlc b/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.qmlc
deleted file mode 100644
index a33fabc..0000000
--- a/tools/sama5d4_xplained_loader/demo_linux_nandflash_system.qmlc
+++ /dev/null
Binary files differ

--
Gitblit v1.9.1