tcl: move SPDX tag as first line
[fw/openocd] / tcl / cpu / arc / common.tcl
1 # SPDX-License-Identifier: GPL-2.0-or-later
2
3 #  Copyright (C) 2015, 2020 Synopsys, Inc.
4 #  Anton Kolesov <anton.kolesov@synopsys.com>
5 #  Didin Evgeniy <didin@synopsys.com>
6
7 # Things common to all ARCs
8
9 # It is assumed that target is already halted.
10 proc arc_common_reset { {target ""} } {
11         if { $target != "" } {
12                 targets $target
13         }
14
15         halt
16
17         # 1. Interrupts are disabled (STATUS32.IE)
18         # 2. The status register flags are cleared.
19         # All fields, except the H bit, are set to 0 when the processor is Reset.
20
21         arc jtag set-aux-reg 0xA 0x1
22
23         # 3. The loop count, loop start, and loop end registers are cleared.
24         arc jtag set-core-reg 60 0
25         arc jtag set-aux-reg 0x2 0
26         arc jtag set-aux-reg 0x3 0
27
28         # Program execution begins at the address referenced by the four byte reset
29         # vector located at the interrupt vector base address, which is the first
30         # entry (offset 0x00) in the vector table.
31         set int_vector_base [arc jtag get-aux-reg 0x25]
32         set start_pc [read_memory $int_vector_base 32 1]
33         arc jtag set-aux-reg 0x6 $start_pc
34
35         # It is OK to do uncached writes - register cache will be invalidated by
36         # the reset_assert() function.
37 }
38
39 # vim:expandtab: