summaryrefslogtreecommitdiff
path: root/nandwrite/init.S
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 19:28:41 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 19:28:41 -0800
commit076ef94d61f349f7cf0fe776e60456d8f232cca5 (patch)
tree6a7dfaaef61ff7ee33bb2036cd14b08583e70223 /nandwrite/init.S
parent84fe89dad95fa18a8950d130a2537db834333bb7 (diff)
downloadlegacy-076ef94d61f349f7cf0fe776e60456d8f232cca5.tar.gz
Diffstat (limited to 'nandwrite/init.S')
-rw-r--r--nandwrite/init.S78
1 files changed, 78 insertions, 0 deletions
diff --git a/nandwrite/init.S b/nandwrite/init.S
new file mode 100644
index 0000000..c542503
--- /dev/null
+++ b/nandwrite/init.S
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <boot/arm.h>
+
+v_reset:
+ b start
+v_undefined:
+ b .
+v_swi:
+ b .
+v_prefetch_abt:
+ b .
+v_data_abt:
+ b .
+v_reserved:
+ b .
+v_irq:
+ b .
+v_fiq:
+ b .
+
+start:
+ /* save registers for main() */
+ mov r7, r0
+ mov r8, r1
+ mov r9, r2
+ mov r10, r3
+
+ /* init stacks */
+ ldr r0, =BOOTLOADER_STACK
+ msr cpsr_c, #(PSR_I | PSR_F | PSR_SVC)
+ mov sp, r0
+
+ /* zero the BSS */
+ ldr r1, =BOOTLOADER_BSS
+ ldr r2, =BOOTLOADER_END
+ mov r0, #0
+1: str r0, [r1], #4
+ cmp r1, r2
+ ble 1b
+
+ bl periph_2gb_open
+
+ /* restore registers for main() */
+ mov r0, r7
+ mov r1, r8
+ mov r2, r9
+ mov r3, r10
+
+ ldr r4, =_main
+ blx r4
+ b .