Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:59

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*
0004  * Copyright (C) 2010, 2013 embedded brains GmbH & Co. KG
0005  *
0006  * Redistribution and use in source and binary forms, with or without
0007  * modification, are permitted provided that the following conditions
0008  * are met:
0009  * 1. Redistributions of source code must retain the above copyright
0010  *    notice, this list of conditions and the following disclaimer.
0011  * 2. Redistributions in binary form must reproduce the above copyright
0012  *    notice, this list of conditions and the following disclaimer in the
0013  *    documentation and/or other materials provided with the distribution.
0014  *
0015  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0016  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0017  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0018  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0019  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0020  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0021  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0022  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0023  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0024  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0025  * POSSIBILITY OF SUCH DAMAGE.
0026  */
0027 
0028 #include <rtems/asm.h>
0029 
0030 #include <bspopts.h>
0031 
0032 #include <libcpu/powerpc-utility.h>
0033 
0034     .globl _start
0035     .globl virtex_exc_vector_base
0036 
0037     .section ".bsp_start_text", "ax"
0038 
0039 virtex_exc_vector_base:
0040 
0041     b   _start
0042 
0043     /* Critical Input 0x0100 */
0044     /* Machine Check 0x0200 */
0045     /* Data Storage 0x0300 */
0046     /* Instruction Storage 0x0400 */
0047     /* External 0x0500 */
0048     /* Alignment 0x0600 */
0049     /* Program 0x0700 */
0050     /* FPU Unavailable 0x0800 */
0051     /* System Call 0x0C00 */
0052     /* APU Unavailable 0x0F20 */
0053     /* Programmable-Interval Timer 0x1000 */
0054     /* Fixed-Interval Timer 0x1010 */
0055     /* Watchdog Timer 0x1020 */
0056     /* Data TLB Miss 0x1100 */
0057     /* Instruction TLB Miss 0x1200 */
0058     /* Debug 0x2000 */
0059 .rept 0x2000 / 4 - 1
0060     b   twiddle
0061 .endr
0062 
0063 _start:
0064 
0065     /* Reset time base */
0066     li  r0, 0
0067     mtspr   TBWU, r0
0068     mtspr   TBWL, r0
0069 
0070     /*
0071      * Initialize start stack.  The stacks are statically allocated and
0072      * properly aligned.
0073      */
0074     LA  r1, _ISR_Stack_area_end
0075     subi    r1, r1, PPC_DEFAULT_CACHE_LINE_SIZE
0076     stw r0, 0(r1)
0077 
0078     /* Copy fast text */
0079     LWI r3, bsp_section_fast_text_begin
0080     LWI r4, bsp_section_fast_text_load_begin
0081     LWI r5, bsp_section_fast_text_size
0082     bl  copy
0083 
0084     /* Copy fast data */
0085     LWI r3, bsp_section_fast_data_begin
0086     LWI r4, bsp_section_fast_data_load_begin
0087     LWI r5, bsp_section_fast_data_size
0088     bl  copy
0089 
0090     /* Clear SBSS */
0091     LWI r3, bsp_section_sbss_begin
0092     LWI r4, bsp_section_sbss_size
0093     bl  bsp_start_zero
0094 
0095     /* Clear BSS */
0096     LWI r3, bsp_section_bss_begin
0097     LWI r4, bsp_section_bss_size
0098     bl  bsp_start_zero
0099 
0100     /* Set up EABI and SYSV environment */
0101     bl  __eabi
0102 
0103     /* Clear command line */
0104     li  r3, 0
0105 
0106     bl  boot_card
0107 
0108 twiddle:
0109 
0110     bl  bsp_reset
0111     b   twiddle
0112 
0113 copy:
0114 
0115     cmpw    r3, r4
0116     beqlr
0117     b   memcpy
0118 
0119     /* Reset entry */
0120     .section ".virtex_reset", "ax"
0121 
0122 jump_to_start:
0123 
0124     LWI r3, _start
0125     mtctr   r3
0126     bctr
0127     b   jump_to_start