1/******************************************************************************* 2 * 3 * Filename: arm_init.s 4 * 5 * Initialization for C-environment and basic operation. Adapted from 6 * ATMEL cstartup.s. 7 * 8 * Revision information: 9 * 10 * 20AUG2004 kb_admin initial creation 11 * 12JAN2005 kb_admin updated for 16KB eeprom 12 * Atmel stack prevents loading full size at once 13 * 14 * BEGIN_KBDD_BLOCK 15 * No warranty, expressed or implied, is included with this software. It is 16 * provided "AS IS" and no warranty of any kind including statutory or aspects 17 * relating to merchantability or fitness for any purpose is provided. All 18 * intellectual property rights of others is maintained with the respective 19 * owners. This software is not copyrighted and is intended for reference 20 * only. 21 * END_BLOCK 22 *
| 1/******************************************************************************* 2 * 3 * Filename: arm_init.s 4 * 5 * Initialization for C-environment and basic operation. Adapted from 6 * ATMEL cstartup.s. 7 * 8 * Revision information: 9 * 10 * 20AUG2004 kb_admin initial creation 11 * 12JAN2005 kb_admin updated for 16KB eeprom 12 * Atmel stack prevents loading full size at once 13 * 14 * BEGIN_KBDD_BLOCK 15 * No warranty, expressed or implied, is included with this software. It is 16 * provided "AS IS" and no warranty of any kind including statutory or aspects 17 * relating to merchantability or fitness for any purpose is provided. All 18 * intellectual property rights of others is maintained with the respective 19 * owners. This software is not copyrighted and is intended for reference 20 * only. 21 * END_BLOCK 22 *
|
23 * $FreeBSD: head/sys/boot/arm/at91/libat91/arm_init.S 164323 2006-11-16 00:53:28Z imp $
| 23 * $FreeBSD: head/sys/boot/arm/at91/libat91/arm_init.S 165397 2006-12-20 18:16:49Z imp $
|
24 ******************************************************************************/ 25 26 .equ TWI_EEPROM_SIZE, 0x3000 27 .equ ARM_MODE_USER, 0x10 28 .equ ARM_MODE_FIQ, 0x11 29 .equ ARM_MODE_IRQ, 0x12 30 .equ ARM_MODE_SVC, 0x13 31 .equ ARM_MODE_ABORT, 0x17 32 .equ ARM_MODE_UNDEF, 0x1B 33 .equ ARM_MODE_SYS, 0x1F 34 .equ I_BIT, 0x80 35 .equ F_BIT, 0x40 36 .equ T_BIT, 0x20 37 38/* 39 * Stack definitions 40 * 41 * Start near top of internal RAM. 42 */ 43 .equ END_INT_SRAM, 0x4000 44 .equ SVC_STACK_START, (END_INT_SRAM - 0x4) 45 .equ SVC_STACK_USE, 0x21800000 46 47start: 48 49/* vectors - must reside at address 0 */ 50/* the format of this table is defined in the datasheet */ 51 B InitReset @; reset 52undefvec: 53 B undefvec @; Undefined Instruction 54swivec: 55 B swivec @; Software Interrupt 56pabtvec: 57 B pabtvec @; Prefetch Abort 58dabtvec: 59 B dabtvec @; Data Abort 60rsvdvec: 61#ifdef BOOT_IIC 62 .long (TWI_EEPROM_SIZE >> 9) 63#else
| 24 ******************************************************************************/ 25 26 .equ TWI_EEPROM_SIZE, 0x3000 27 .equ ARM_MODE_USER, 0x10 28 .equ ARM_MODE_FIQ, 0x11 29 .equ ARM_MODE_IRQ, 0x12 30 .equ ARM_MODE_SVC, 0x13 31 .equ ARM_MODE_ABORT, 0x17 32 .equ ARM_MODE_UNDEF, 0x1B 33 .equ ARM_MODE_SYS, 0x1F 34 .equ I_BIT, 0x80 35 .equ F_BIT, 0x40 36 .equ T_BIT, 0x20 37 38/* 39 * Stack definitions 40 * 41 * Start near top of internal RAM. 42 */ 43 .equ END_INT_SRAM, 0x4000 44 .equ SVC_STACK_START, (END_INT_SRAM - 0x4) 45 .equ SVC_STACK_USE, 0x21800000 46 47start: 48 49/* vectors - must reside at address 0 */ 50/* the format of this table is defined in the datasheet */ 51 B InitReset @; reset 52undefvec: 53 B undefvec @; Undefined Instruction 54swivec: 55 B swivec @; Software Interrupt 56pabtvec: 57 B pabtvec @; Prefetch Abort 58dabtvec: 59 B dabtvec @; Data Abort 60rsvdvec: 61#ifdef BOOT_IIC 62 .long (TWI_EEPROM_SIZE >> 9) 63#else
|
| 64#ifdef BOOT_BWCT 65 .long ((528 << 17) | (13 << 13) | (12 * 2)) 66#else
|
64 .long ((1056 << 17) | (13 << 13) | (12 * 2)) 65#endif
| 67 .long ((1056 << 17) | (13 << 13) | (12 * 2)) 68#endif
|
| 69#endif
|
66irqvec: 67 ldr pc, [pc,#-0xF20] @; IRQ : read the AIC 68fiqvec: 69 B fiqvec @; FIQ 70 71InitReset: 72 73/* Set stack and init for SVC */ 74 ldr r1, = SVC_STACK_START 75 mov sp, r1 @; Init stack SYS 76 77 msr cpsr_c, #(ARM_MODE_SVC | I_BIT | F_BIT) 78 mov sp, r1 @ ; Init stack SYS 79 80/* Perform system initialization */ 81 82 .extern _init 83 bl _init 84#ifndef BOOT_BOOT0 85 ldr r1, = SVC_STACK_USE 86 mov sp, r1 @ ; Move the stack to SDRAM 87#endif 88 89/* Start execution at main */ 90 .extern main 91_main: 92__main: 93 bl main 94/* main should not return. If it does, spin forever */ 95infiniteLoop: 96 b infiniteLoop 97 98#ifdef BOOT_COMMANDS 99/* the following section is used to store boot commands in */ 100/* non-volatile memory. */ 101 102 .global BootCommandSection 103BootCommandSection: 104#ifdef SUPPORT_LINUX 105 .string "Bootloader for KB9202 Evaluation Board." 106 .string "c 0x20210000 0x10100000 0x80000 " 107 .string "m 0 0 0 0 0 0 " 108 .string "t 0x20000100 console=ttyS0,115200 root=/dev/ram rw initrd=0x20210000,654933" 109 .string "e 0x10000000 " 110 .string " " 111#else 112#if 1 113 .string "m 42 53 44 0 0 1" 114 .string "ip 206 168 13 194" 115 .string "server_ip 206 168 13 207" 116 .string "tftp 0x20000000 kernel.bin" 117 .string "e 0x20000000" 118#else 119 .string "m 42 53 44 0 0 1" 120 .string "k 0x20000000" 121 .string "e 0x20000000" 122#endif 123 .word 0 124#endif 125#endif
| 70irqvec: 71 ldr pc, [pc,#-0xF20] @; IRQ : read the AIC 72fiqvec: 73 B fiqvec @; FIQ 74 75InitReset: 76 77/* Set stack and init for SVC */ 78 ldr r1, = SVC_STACK_START 79 mov sp, r1 @; Init stack SYS 80 81 msr cpsr_c, #(ARM_MODE_SVC | I_BIT | F_BIT) 82 mov sp, r1 @ ; Init stack SYS 83 84/* Perform system initialization */ 85 86 .extern _init 87 bl _init 88#ifndef BOOT_BOOT0 89 ldr r1, = SVC_STACK_USE 90 mov sp, r1 @ ; Move the stack to SDRAM 91#endif 92 93/* Start execution at main */ 94 .extern main 95_main: 96__main: 97 bl main 98/* main should not return. If it does, spin forever */ 99infiniteLoop: 100 b infiniteLoop 101 102#ifdef BOOT_COMMANDS 103/* the following section is used to store boot commands in */ 104/* non-volatile memory. */ 105 106 .global BootCommandSection 107BootCommandSection: 108#ifdef SUPPORT_LINUX 109 .string "Bootloader for KB9202 Evaluation Board." 110 .string "c 0x20210000 0x10100000 0x80000 " 111 .string "m 0 0 0 0 0 0 " 112 .string "t 0x20000100 console=ttyS0,115200 root=/dev/ram rw initrd=0x20210000,654933" 113 .string "e 0x10000000 " 114 .string " " 115#else 116#if 1 117 .string "m 42 53 44 0 0 1" 118 .string "ip 206 168 13 194" 119 .string "server_ip 206 168 13 207" 120 .string "tftp 0x20000000 kernel.bin" 121 .string "e 0x20000000" 122#else 123 .string "m 42 53 44 0 0 1" 124 .string "k 0x20000000" 125 .string "e 0x20000000" 126#endif 127 .word 0 128#endif 129#endif
|