max32xxx.cfg 1.9 KB
Newer Older
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
77
78
79
80
81
82
83
84
85
86
87
# Maxim Integrated max32xxx OpenOCD drver configuration file
# www.maximintegrated.com

source [find mem_helper.tcl]
source [find target/swj-dp.tcl]

# Set the adapter speed
if { [info exists ADAPTER_KHZ] } {
   set _ADAPTER_KHZ $ADAPTER_KHZ
} else {
   set _ADAPTER_KHZ 2000
}
adapter_khz $_ADAPTER_KHZ

# Target configuration
if { [info exists CHIPNAME] } {
   set _CHIPNAME $CHIPNAME
} else {
   set _CHIPNAME max32xxx
}

# Add reserved TAP
if { [using_jtag] && [info exists RSV_TAP] } {
   jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -ignore-version
   jtag newtap rsvtap tap -irlen 4 -irmask 0xf -ircapture 0x1 -ignore-version
} else {
   swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -ignore-version
}


dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
target create $_CHIPNAME.cpu cortex_m -dap $_CHIPNAME.dap

# Setup working area
if { [info exists WORK_START] } {
   set _WORK_START $WORK_START
} else {
   set _WORK_START 0x20005000
}

if { [info exists WORK_SIZE] } {
   set _WORK_SIZE $WORK_SIZE
} else {
   set _WORK_SIZE 0x2000
}

$_CHIPNAME.cpu configure -work-area-phys $_WORK_START -work-area-size $_WORK_SIZE

# Configure flash driver
if { [info exists FLASH_BASE] } {
   set _FLASH_BASE $FLASH_BASE
} else {
   set _FLASH_BASE 0x10000000
}

if { [info exists FLASH_SIZE] } {
   set _FLASH_SIZE $FLASH_SIZE
} else {
   set _FLASH_SIZE 0x10000
}

if { [info exists FLC_BASE] } {
   set _FLC_BASE $FLC_BASE
} else {
   set _FLC_BASE 0x40029000
}

if { [info exists FLASH_SECTOR] } {
   set _FLASH_SECTOR $FLASH_SECTOR
} else {
   set _FLASH_SECTOR 0x2000
}

if { [info exists FLASH_CLK] } {
   set _FLASH_CLK $FLASH_CLK
} else {
   set _FLASH_CLK 96
}

if { [info exists FLASH_BITS] } {
   set _FLASH_BITS $FLASH_BITS
} else {
   set _FLASH_BITS 32
}

flash bank $_CHIPNAME.flash max32xxx $_FLASH_BASE $_FLASH_SIZE 0 0 $_CHIPNAME.cpu \
$_FLC_BASE $_FLASH_SECTOR $_FLASH_CLK $_FLASH_BITS