all: $(IMAGE)
clean:
- rm -f $(IMAGE) boot.o model.lds fdt.dtb
+ rm -f $(IMAGE) boot.o ns.o model.lds fdt.dtb
-$(IMAGE): boot.o model.lds fdt.dtb $(KERNEL) $(FILESYSTEM)
+$(IMAGE): boot.o ns.o model.lds fdt.dtb $(KERNEL) $(FILESYSTEM)
$(LD) -o $@ --script=model.lds
%.o: %.S Makefile
br x4 // branch to the given address
2:
- /*
- * UART initialisation (38400 8N1)
- */
- ldr x4, =UART_BASE // UART base
- mov w5, #0x10 // ibrd
- str w5, [x4, #0x24]
- mov w5, #0xc300
- orr w5, w5, #0x0001 // cr
- str w5, [x4, #0x30]
-
- /*
- * CLCD output site MB
- */
- ldr x4, =SYSREGS_BASE
- ldr w5, =(1 << 31) | (1 << 30) | (7 << 20) | (0 << 16) // START|WRITE|MUXFPGA|SITE_MB
- str wzr, [x4, #0xa0] // V2M_SYS_CFGDATA
- str w5, [x4, #0xa4] // V2M_SYS_CFGCTRL
/*
* Primary CPU
*/
+ bl ns_init_system
ldr x0, =dtb // device tree blob
b kernel
--- /dev/null
+/*
+ * ns.S - code to initialise everything required when first booting non-secure.
+ *
+ * Copyright (C) 2013 ARM Limited. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE.txt file.
+ */
+
+#define PL011_UARTIBRD 0x24
+#define PL011_UARTCR 0x30
+
+#define V2M_SYS_CFGDATA 0xa0
+#define V2M_SYS_CFGCTRL 0xa4
+
+ .text
+ .globl ns_init_system
+
+ns_init_system:
+ /*
+ * UART initialisation (38400 8N1)
+ */
+ ldr x4, =UART_BASE
+ mov w5, #0x10
+ str w5, [x4, #PL011_UARTIBRD]
+ mov w5, #0xc300
+ orr w5, w5, #0x0001
+ str w5, [x4, #PL011_UARTCR]
+
+ /*
+ * CLCD output site MB
+ */
+ ldr x4, =SYSREGS_BASE
+ ldr w5, =(1 << 31) | (1 << 30) | (7 << 20) | (0 << 16) // START|WRITE|MUXFPGA|SITE_MB
+ str wzr, [x4, #V2M_SYS_CFGDATA]
+ str w5, [x4, #V2M_SYS_CFGCTRL]
+
+ ret
+
+ .ltorg
+ .org 0x40