[BACK]Return to head.S CVS log [TXT][DIR] Up to [local] / prex-old / boot / avr32 / ngw100

File: [local] / prex-old / boot / avr32 / ngw100 / head.S (download)

Revision 1.1, Tue Jul 15 22:48:16 2008 UTC (15 years, 10 months ago) by nbrk
Branch: MAIN
CVS Tags: HEAD

initial port of Prex bootldr to avr32 ngw100 platform.

/*
 * $Id: head.S,v 1.1 2008/07/15 22:48:16 nbrk Exp $
 */
/*-
 * Copyright (c) 2005, Kohsuke Ohtani
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. 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.
 * 3. Neither the name of the author nor the names of any co-contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
 */

/*
 * head.S - low level platform support
 *
 * This file contains the code from crt0.S which is released under
 * public domain by Jeff Frohwein.
 */

/*-
 * Memory ranges:
 *
 * 0x00000000 - 0x00800000 : Parallel FLASH (8MB)
 * 0x10000000 - 0x11ffffff : SDRAM (32MB)
 * 0x24000000 - 0x24007fff : On-chip SRAM (32KB)
 *
 * Note: on ATNGW100 U-Boot uses RAM @0x11fc0000 -> 0x12000000 (last 256K)
 * to hold some variables during bootstrap.
 * Note: we will pass struct boot_info to the kernel in 2K region right
 * below U-Boot stuff.
 * This means that BOOT_STACK should be at (0x11fc0000 - BOOT_INFO_SIZE).
 */

#include <conf/config.h>
#include <platform.h>

#define ENTRY(x) .global x; .align; x##:

	.section ".text","ax"
/*
 * Kernel start point
 */
ENTRY(boot_entry)
	bral	start_vector

/* stack_end:	.word	BOOT_STACK+0xf00 */
stack_end:	.word	BOOT_STACK

start_vector:
	/*
	 * Disable interrupts (just to be sure).
	 */
	mfsr r0, 0	/* read SR */
	mov r1, 1
	or r0, r1	/* set GM bit */
	mtsr 0, r0	/* write back SR */

	/*
	 * Setup bootloader stack.
	 */
	lddpc r1, stack_end
	mov sp, r1

	/* enter bootldr */
	rcall loader_main

/*
 * Start kernel
 */
ENTRY(start_kernel)
	icall	r0

		.section .tail,"ax"
dummy:
	.byte	0xff

.end