summaryrefslogtreecommitdiff
path: root/arch/riscv32/soc/pulpino/vector.S
blob: 2de5ccb41c915b5a500dcbd7f02bf5118bf98442 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * Copyright (c) 2016 Jean-Paul Etienne <fractalclone@gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#define _ASMLANGUAGE

#include <toolchain.h>

/* imports */
GTEXT(__reset)
GTEXT(__irq_wrapper)

/*
 * following pulpino datasheet, addr 0x00000000 - 0x00000058 are not used
 * in IVT. Hence, set them to nop.
 *
 * Call __irq_wrapper to handle all interrupts/exceptions/faults/ECALL
 *
 * ECALL is used to handle context switching of threads, as well as
 * IRQ offloading (when enabled).
 *
 * Interrupt Line 23: I2C IRQ 0x0000005C
 * Interrupt Line 24: UART IRQ 0x00000060
 * Interrupt Line 25: GPIO IRQ 0x00000064
 * Interrupt Line 26: SPI Master 0 0x00000068
 * Interrupt Line 27: SPI Master 1 0x0000006C
 * Interrupt Line 28: Timer A Overflow 0x00000070
 * Interrupt Line 29: Timer A Output Cmp 0x00000074
 * Interrupt Line 30: Timer B Overflow 0x00000078
 * Interrupt Line 31: Timer B Output Cmp 0x0000007C
 *
 * RESET 0x00000080 - call __reset

 * Illegal Instruction Exception 0x00000084
 * ECALL Instruction 0x00000088
 * Invalid Memory Access 0x0000008C
 */
SECTION_FUNC(vectors, vinit)
	.option norvc;

	/* nop addr 0x00000000 - 0x00000058 */
	.org 0x00
	.rept 23
	nop
	.endr

	/* Call __irq_wrapper for all interrupts */
	.org 0x5C
	.rept 9
	jal x0, __irq_wrapper
	.endr

	/* Call __reset for reset vector */
	.org 0x80
	jal x0, __reset

	/* Illegal instruction */
	jal x0, __irq_wrapper

	/* ECALL (system call) */
	jal x0, __irq_wrapper

	/* Invalid memory access */
	jal x0, __irq_wrapper