source: rtems/bsps/riscv/riscv/start/start.S @ 6f5d88a

5
Last change on this file since 6f5d88a was 6f5d88a, checked in by Sebastian Huber <sebastian.huber@…>, on 06/22/18 at 05:06:57

bsp/riscv_generic: Rename to "riscv"

Update #3433.

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/*
2 * Copyright (c) 2015 University of York.
3 * Hesham Almatary <hesham@alumni.york.ac.uk>
4 *
5 * Copyright (c) 2013, The Regents of the University of California (Regents).
6 * All Rights Reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29#include <bsp/linker-symbols.h>
30#include <rtems/score/riscv-utility.h>
31#include <rtems/score/cpu.h>
32#include <rtems/asm.h>
33
34EXTERN(bsp_section_bss_begin)
35EXTERN(bsp_section_bss_end)
36EXTERN(ISR_Handler)
37EXTERN(bsp_section_stack_begin)
38
39PUBLIC(bsp_start_vector_table_begin)
40PUBLIC(bsp_start_vector_table_end)
41PUBLIC(_start)
42
43.section .bsp_start_text, "wax"
44TYPE_FUNC(_start)
45SYM(_start):
46  li x2, 0
47  li x3, 0
48  li x4, 0
49  li x5, 0
50  li x6, 0
51  li x7, 0
52  li x8, 0
53  li x9, 0
54  li x10, 0
55  li x11, 0
56  li x12, 0
57  li x13, 0
58  li x14, 0
59  li x15, 0
60  li x16, 0
61  li x17, 0
62  li x18, 0
63  li x19, 0
64  li x20, 0
65  li x21, 0
66  li x22, 0
67  li x23, 0
68  li x24, 0
69  li x25, 0
70  li x26, 0
71  li x27, 0
72  li x28, 0
73  li x29, 0
74  li x30, 0
75  li x31, 0
76
77  la t0, ISR_Handler
78  csrw mtvec, t0
79
80  /* load stack and frame pointers */
81  la sp, _Configuration_Interrupt_stack_area_end
82
83  /* Clearing .bss */
84  la t0, bsp_section_bss_begin
85  la t1, bsp_section_bss_end
86
87_loop_clear_bss:
88  bge   t0, t1, _end_clear_bss
89  SREG    x0, 0(t0)
90  addi  t0, t0, CPU_SIZEOF_POINTER
91  j     _loop_clear_bss
92_end_clear_bss:
93
94  /* Init FPU unit if it's there */
95  li t0, MSTATUS_FS
96  csrs mstatus, t0
97
98  j boot_card
99
100  .align 4
101bsp_start_vector_table_begin:
102  .word _RISCV_Exception_default /* User int */
103  .word _RISCV_Exception_default /* Supervisor int */
104  .word _RISCV_Exception_default /* Reserved */
105  .word _RISCV_Exception_default /* Machine int */
106  .word _RISCV_Exception_default /* User timer int */
107  .word _RISCV_Exception_default /* Supervisor Timer int */
108  .word _RISCV_Exception_default /* Reserved */
109  .word _RISCV_Exception_default /* Machine Timer int */
110  .word _RISCV_Exception_default /* User external int */
111  .word _RISCV_Exception_default /* Supervisor external int */
112  .word _RISCV_Exception_default /* Reserved */
113  .word _RISCV_Exception_default /* Machine external int */
114  .word _RISCV_Exception_default
115  .word _RISCV_Exception_default
116  .word _RISCV_Exception_default
117  .word _RISCV_Exception_default
118bsp_start_vector_table_end:
Note: See TracBrowser for help on using the repository browser.