⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 start.s

📁 arm7,44b0芯片的blob程序,适用于学嵌入式linux的新手.
💻 S
字号:
/* * start.S: blob start code * * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) and *                     Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * *//* * This is the blob start code. The SA-1100 jumps to address 0x00000000 * after a reset. We put a single branch code at this position which jumps * to a safe region to do the actual setup. All other vectors just point * to an endless loop for the moment. * * Documentation: * [1] Intel Corporation, "Intel StrongARM SA-1100 Microprocessor *     Developer's Manual", April 1999 * [2] S. Furber, "ARM System Architecture", Addison Wesley Longman *     Ltd., Essex, England, 1996. * [3] Intel Corporation, "Intel StrongARM SA-1110 Microprocessor *     Advanced Developer's manual, December 1999 */.ident "$Id: start.S,v 1.6 2001/11/15 11:56:20 seletz Exp $"#ifdef HAVE_CONFIG_H# include <blob/config.h>#endif#include <blob/arch.h>.text/* Jump vector table as in table 3.1 in [1] */.globl _start_start:	b	reset	add	pc, pc, #0x0c000000	add	pc, pc, #0x0c000000	add	pc, pc, #0x0c000000	add	pc, pc, #0x0c000000	add	pc, pc, #0x0c000000	add	pc, pc, #0x0c000000	add	pc, pc, #0x0c000000/*************************************************//* some defines to make life easier */	BLOB_START:		.word   BLOB_ABS_BASE_ADDR/*************************************************//* the actual reset code */reset:	/* disable watch dog */	ldr 	r0, =WTCON	ldr	r1, =0x0	str	r1, [r0]	/* enable write buffer, fuul cache enable, stall disable */	ldr	r0, =SYSCFG	ldr	r1, =0x0e	str	r1, [r0]	ldr	r0, =NCACHBE0	ldr	r1, =0xc0002000	str	r1, [r0]/*************************************************/	/* Configuration Port Control Register*/	/* Port A */	ldr	r1, =PCONA	ldr	r0, =0x3ff	str	r0, [r1]	/* Port B */	ldr	r1, =PCONB	ldr	r0, =0x5ff	str	r0, [r1]	ldr	r1, =PDATB	ldr	r0, =0x0	str	r0, [r1]	/* Port C */	ldr	r1, =PCONC	ldr	r0, =0xff55ff15	str	r0, [r1]	ldr	r1, =PDATC	ldr	r0, =0x0	str	r0, [r1]	ldr	r1, =PUPC	ldr	r0, =0xffff	str	r0, [r1]	/* Port D */	ldr	r1, =PCOND	ldr	r0, =0xaaaa	str	r0, [r1]	ldr	r1, =PUPD	ldr	r0, =0xff	str	r0, [r1]	/* Port E */	ldr	r1, =PCONE	ldr	r0, =0x200ab	str	r0, [r1]	ldr	r1, =PDATE	ldr	r0, =0x0	str	r0, [r1]	ldr	r1, =PUPE	ldr	r0, =0xff	str	r0, [r1]	/* Port F */	ldr	r1, =PCONF	ldr	r0, =0x827ea	str	r0, [r1]	ldr	r1, =PDATF	ldr	r0, =0x63	str	r0, [r1]	ldr	r1, =PUPF	ldr	r0, =0x1e3	str	r0, [r1]	/* Port G */	ldr	r1, =PCONG	ldr	r0, =0xaaff	str	r0, [r1]	ldr	r1, =PUPG	ldr	r0, =0x0	str	r0, [r1]	/* SET ETC */	ldr	r1, =SPUCR	ldrb	r0, =0x7	strb	r0, [r1]	ldr	r1, =EXTINT	ldr	r0, =0x422	str	r0, [r1]	ldr	r1,=INTMSK	ldr	r0, =0x03fffeff	str	r0, [r1]	ldr	r1, =INTCON	ldr	r0, =0x05	str	r0, [r1]	/* Set Clock Control Register */	ldr	r1, =LOCKTIME	ldrb	r0, =800	strb	r0, [r1]	ldr	r1, =PLLCON	ldr	r0, =0x34031	str	r0, [r1]	ldr	r1,=CLKCON	ldr	r0, =0x7ff8	str	r0, [r1]/*************************************************/	/* init LED */	bl	ledinit 	/* setup memory */	bl	memsetup/*************************************************/relocate:	adr	r0, _start	/* relocate the second stage loader */	add	r2, r0, #(64 * 1024)	/* blob maximum size is 64kB */	add	r0, r0, #0x400	ldr	r1, BLOB_START	/* r0 = source address	 * r1 = target address	 * r2 = source end address	 */copy_loop:	ldmia	r0!, {r3-r10}	stmia	r1!, {r3-r10}	cmp	r0, r2	ble	copy_loop	adr	r0, real_vectors	add	r2, r0, #1024	ldr	r1, =0x0c000000	add	r1, r1, #0x08vector_copy_loop:	ldmia	r0!, {r3-r10}	stmia	r1!, {r3-r10}	cmp	r0, r2	ble	vector_copy_loop	/* turn off the LED. if it stays off it is an indication that	 * we didn't make it into the C code 	 *//*	bl led_off */	/* blob is copied to ram, so jump to it */	ldr	r0, BLOB_START	mov	pc, r0/*************************************************/real_vectors:	b	reset	b	undefined_instruction	b	software_interrupt	b	prefetch_abort	b	data_abort	b	not_used	b	irq	b	fiq/*************************************************/	undefined_instruction:	mov	r6, #3	b	endless_blinksoftware_interrupt:	mov	r6, #4	b	endless_blinkprefetch_abort:	mov	r6, #5	b	endless_blinkdata_abort:	mov	r6, #6	b	endless_blinknot_used:	/* we *should* never reach this */	mov	r6, #7	b	endless_blinkirq:	ldr	sp, =0x0c200524	stmfd	sp!, {r0-r1}	ldr	r0, =I_ISPC	ldr	r1, =0x100	str	r1, [r0]	/* add 1 to ticks */	ldr	r0, =0x0c200494	ldr	r1, [r0]	add	r1, r1, #0x01	str	r1, [r0]	ldmfd	sp!, {r0-r1}	subs	pc, lr, #0x04fiq:	mov	r6, #9	b	endless_blink/*************************************************/endless_blink:	mov	r5, #0x800000wait0:	subs	r5, r5, #1	bne	wait0	mov	r0, r6	bl	led_blink 	b	endless_blink		

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -