1/*
2 * Copyright (c) 2017 Jean-Paul Etienne <fractalclone@gmail.com>
3 * Contributors: 2018 Antmicro <www.antmicro.com>
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#include <toolchain.h>
9
10/* exports */
11GTEXT(__start)
12
13/* imports */
14GTEXT(__initialize)
15GTEXT(__irq_wrapper)
16
17SECTION_FUNC(vectors, __start)
18#if defined(CONFIG_RISCV_GP)
19	/* Initialize global pointer */
20	.option push
21	.option norelax
22	la gp, __global_pointer$
23	.option pop
24#endif
25
26	.option norvc;
27
28	/*
29	 * Set mtvec (Machine Trap-Vector Base-Address Register)
30	 * to __irq_wrapper.
31	 */
32	la t0, __irq_wrapper
33	csrw mtvec, t0
34
35	/* Jump to __reset */
36	tail __reset
37