summaryrefslogtreecommitdiff
path: root/bsp/asm9260t/jlink/asm9260t.gdb
blob: 4edde54a8a160f3be531ad257d6caa0c07800da6 (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
#------------------------------------------------
# SDRAM initialization script for the ASM9260T
#------------------------------------------------

define __setup_PLL
	echo "Enabling PLL for CPU" \n
	
	# outl(1<<2, REG_SET(HW_AHBCLKCTRL0));
	set *0x80040024 = 0x00000004
	# outl(1<<8, REG_SET(HW_AHBCLKCTRL1));
	set *0x80040034 = 0x00000100
	# outl(3<<9, REG_SET(HW_AHBCLKCTRL0));
	set *0x80040024 = 0x00000600
	# outl(inl(HW_PDRUNCFG)&0xFFFFFFFA, HW_PDRUNCFG);
	set *0x80040238 = 0x00000770
	# outl(2, HW_CPUCLKDIV);
	set *0x8004017C = 0x00000002
	# outl(2, HW_SYSAHBCLKDIV);
	set *0x80040180 = 0x00000002
	# outl(480, HW_SYSPLLCTRL);
	set *0x80040100 = 0x000001E0
	# __delay(50)
	set $i = 0
	while $i != 500
		set $i += 1
	end
	# outl(1, HW_MAINCLKSEL);
	set *0x80040120 = 0x00000001
	# outl(0, HW_MAINCLKUEN);
	set *0x80040124 = 0x00000000
	# outl(1, HW_MAINCLKUEN);
	set *0x80040124 = 0x00000001
end

define __setup_SDRAM
  echo "Enabling on-chip SDRAM" \n

  # outl((1<<6), REG_SET(HW_AHBCLKCTRL0));
  set *0x80040024 = 0x00000040
  # outl(0x00001188, HW_EMI_SCONR);
  set *0x80700000 = 0x00001188
  # outl(0x000a0500, HW_EMI_CTRL);
  set *0x8004034c = 0x000a0500
  # outl(0x20000000, HW_EMI_SCSLR2_LOW);
  set *0x8070001c = 0x20000000
  # outl(0x0000000c, HW_EMI_SMSKR2);
  set *0x8070005c = 0x0000000c
  # outl(0x024996d9, HW_EMI_STMG0R);
  set *0x80700004 = 0x024996d9
  # outl(0x00542b4f, HW_EMI_SMTMGR_SET0);
  set *0x80700094 = 0x00542b4f
  # outl(0x00003288, HW_EMI_SCTLR);
  set *0x8070000c = 0x00003288
end

# Step1: Connect to the J-Link gdb server
define reset
	#target remote localhost:2331
	monitor reset

	# Step2: Reset peripheral  (RSTC_CR)
	echo "------- Prepare for debug ASM9260T -------" \n
	__setup_PLL
	__setup_SDRAM

	# Step3: Load file(eg. getting-started project)
	load

	mon reg pc=0x20000000
	#info reg
end