技术标签: [S3C6410] input c delay mobile initialization [ARM] command
要调试裸板,有两种初始化方法,一个是用烧好的uboot初始化,再有就是直接用JLink+GDBServer初始化。代码参考了网上的资料,根据手头的OK6410开发板做了修改。整体代码如下:
# Connect to the J-Link GDBServer
target remote localhost:2331
# Set JTAG speed to 30 kHz
monitor endian little
monitor speed 30
# Reset the target
monitor reset
monitor sleep 10
#
# CPU core initialization
#
# Set the processor to service mode
monitor reg cpsr = 0xd3
# Config MMU
# Flush v3/v4 cache
monitor cp15 7, 7, 0, 0 = 0x0
monitor cp15 8, 7, 0, 0 = 0x0
# Disable MMU stuff and caches
monitor cp15 1, 0, 0, 0 =0x1002
# Peri port setup
monitor cp15 15, 2, 0, 4 = 0x70000013
# Disable watchdog
monitor MemU32 0x7e004000 = 0x00000000
monitor sleep 10
# Disable interrupt
monitor MemU32 0x71200014 = 0xffffffff
monitor MemU32 0x71300014 = 0xffffffff
monitor MemU32 0x7120000C = 0x00000000
monitor MemU32 0x7130000C = 0x00000000
monitor MemU32 0x71200F00 = 0x00000000
monitor MemU32 0x71300F00 = 0x00000000
# Set clock
monitor MemU32 0x7e00f900 = 0x000080de
monitor MemU32 0x7e00f000 = 0x0000ffff
monitor MemU32 0x7e00f004 = 0x0000ffff
monitor MemU32 0x7e00f008 = 0x0000ffff
monitor MemU32 0x7e00f028 = 0x00300000
monitor MemU32 0x7e00f020 = 0x01043310
monitor MemU32 0x7e00f00C = 0x810a0301
monitor MemU32 0x7e00f010 = 0x810a0301
monitor MemU32 0x7e00f014 = 0x80200102
monitor MemU32 0x7e00f018 = 0x00000000
monitor MemU32 0x7e00f01c = 0x00000007
monitor sleep 1
# UART Init
monitor MemU32 0x7f008000 = 0x00220022
monitor memU32 0x7f008020 = 0x00002222
monitor memU32 0x7f005008 = 0x00000000
monitor memU32 0x7f00500c = 0x00000000
monitor memU32 0x7f005000 = 0x00000003
monitor memU32 0x7f005004 = 0x00000e45monitor memU32 0x7f005028 = 0x00000033
monitor memU32 0x7f00502c = 0x0000dfdd
monitor memU32 0x7f005020 = 0x4f4f4f4f
monitor memU32 0x7f005020 = 0x4b4b4b4b
# Config Mobile DDR SDRAM
monitor MemU32 0x7e00f120 = 0x0000000d
monitor MemU32 0x7e001004 = 0x00000004
monitor MemU32 0x7e001010 = 0x0000040f
monitor MemU32 0x7e001014 = 0x00000006
monitor MemU32 0x7e001018 = 0x00000001
monitor MemU32 0x7e00101c = 0x00000002
monitor MemU32 0x7e001020 = 0x00000006
monitor MemU32 0x7e001024 = 0x0000000a
monitor MemU32 0x7e001028 = 0x0000000c
monitor MemU32 0x7e00102c = 0x0000010b
monitor MemU32 0x7e001030 = 0x0000000c
monitor MemU32 0x7e001034 = 0x00000002
monitor MemU32 0x7e001038 = 0x00000002
monitor MemU32 0x7e00103c = 0x00000002
monitor MemU32 0x7e001040 = 0x00000002
monitor MemU32 0x7e001044 = 0x00000010
monitor MemU32 0x7e001048 = 0x00000010
monitor MemU32 0x7e00100C = 0x0001001a
monitor MemU32 0x7e00104C = 0x00000b45
monitor MemU32 0x7e001200 = 0x000150f0
monitor MemU32 0x7e001304 = 0x00000000
monitor MemU32 0x7e001008 = 0x000c0000
monitor MemU32 0x7e001008 = 0x00000000
monitor MemU32 0x7e001008 = 0x00040000
monitor MemU32 0x7e001008 = 0x00040000
monitor MemU32 0x7e001008 = 0x000a0000
monitor MemU32 0x7e001008 = 0x00080032
monitor MemU32 0x7e001004 = 0x00000000
# Setup GDB for faster downloads
#set remote memory-write-packet-size 1024
set remote memory-write-packet-size 4096
set remote memory-write-packet-size fixed
monitor speed 12000
break start_armboot
load
continue
下载逐行说明:
Monitor reg cpsr = 0xd3
这一行是把cpu置为管理模式,并且设置中断掩码I F T M4 M3 M2 M1 M0,对应于0xd3为0xB11010011, I、F置位设置中断及快速中断掩码, T清位,说明当前为ARM模式下, M置为0xB10011,为管理模式。
monitor MemU32 0x7e004000 = 0x00000000
这一行失能看门狗,该寄存器说明如下:
Watchdog timer [5] 0=Disable, 1=Enable
Clock select [4:3] 00:16 01:32 10:64 11:128
Interrupt generation [2] 0=Disable, 1=EnableReset enable/disable [0]
Monitor MemU32 0x71200014 = 0xFFFFFFFF
Monitor MemU32 0x71300014 = 0xFFFFFFFF
设置VIC0INTENCLEAR及VIC1IntENCLEAR寄存器,该寄存器写0无作用,写1会disable相应的中断:
Clears corresponding bits in the VICINTENABLE Register:0 = no effect1 = interrupt disabled in VICINTENABLE Register.There is one bit of the register for each interrupt source.
网上其它资料都是往里写0,应该是个错误。
Monitor MemU32 0x7120000C = 0x00000000
Monitor MemU32 0x7130000C = 0x00000000
设置所有中断为IRQ,而不是FIQ,该寄存器写0为IRQ,写1为FIQ:
Selects type of interrupt for interrupt request:0 = IRQ interrupt (reset)1 = FIQ interruptThere is one bit of the register for each interrupt source
Monitor MemU32 0x71200F00 = 0x00000000
Monitor MemU32 0x71300F00 = 0x00000000
设置VIC0ADDRERSS及VIC1ADDRESS寄存器,清除当前pending的中断:
Contains the address of the currently active ISR, with reset value0x00000000.A read of this register returns the address of the ISR and sets thecurrent interrupt as being serviced. A read must only be performedwhile there is an active interrupt.A write of any value to this register clears the current interrupt. Awrite must only be performed at the end of an interrupt serviceroutine.
Monitor MemU32 0x7e00f900 = 0x000080de
设置OTHERS寄存器为Synchronous mode,网上资料没有设置sync,要试验一下
Monitor MemU32 0x7e00f000 = 0x0000ffff
Monitor MemU32 0x7e00f004 = 0x0000ffff
Monitor MemU32 0x7e00f008 = 0x0000ffff
设置APLL_LOCK、MPLL_LOCK及EPLL_LOCK寄存器,都设为最大间隔
Monitor MemU32 0x7e00f028 = 0x00300000
设置CLK_DIV2寄存器,主要是设置UART_RATIO:
UART_RATIO [19:16]
UART clock divider ratio
CLKUART = CLKUARTIN / (UART_RATIO + 1)
这里的设置是CLKUART = CLKUARTIN / 4
Monitor MemU32 0x7e00f020 = 0x01043310
设置CLK_DIV0寄存器, 设置的值如下
PCLK_RATIO [15:12] 0x3
HCLKX2_RATIO [11:9] 0x1
HCLK_RATIO [8] 0x1
MPLL_RATIO [4] 0x1
APLL_RATIO [3:0] 0x0
根据如下的计算公式
PCLK = HCLKX2 / (PCLK_RATIO + 1)
HCLKX2 = HCLKX2IN / (HCLKX2_RATIO + 1)
HCLK = HCLKX2 / (HCLK_RATIO + 1)
DOUTMPLL = MOUTMPLL / (MPLL_RATIO + 1)
ARMCLK = DOUTAPLL / (ARM_RATIO + 1)
得到的计算结果
PCLK = HCLKX2 / 4
HCLKX2 = HCLKX2IN / 2
HCLK = HCLKX2 / 2
DOUTMPLL = MOUTMPLL / 2
ARMCLK = DOUTAPLL
Monitor MemU32 0x7e00f00c = 0x810a0301
Monitor MemU32 0x7e00f010 = 0x810a0301
设置APLL_CON及MPLL_CON寄存器,
计算公式为
FOUT = MDIV X FIN / (PDIV X 2SDIV)
对于APLL_CON寄存器:
Enable [31] 0x1
MDIV [25:16] 0x10a(266)
PDIV [13:8] 0x3
SDIV [2:0] 0x1
则FOUT = 266 X 12 / (3 X 2) = 532
对于MPLL_CON寄存器是一样的,也是532
Monitor MemU32 0x7e00f014 = 0x80200102
Monitor MemU32 0x7300f018 = 0x00000000
设置EPLL_CON0寄存器
Enable [31] 0x1
MDIV [23:16] 0x20
PDIV [13:8] 0x1
SDIV [2:0] 0x2
设置EPLL_CON1寄存器
KDIV [15:0] 0x0
根据计算公式:FOUT = (MDIV + KDIV / 216) X FIN / (PDIV X 2SDIV)
可以计算得到FOUT = 32 X 12 / (1 X 4) = 96
Monitor MemU32 0x7e00f01c = 0x00000007
设置CLK_SRC寄存器
UART_SEL [13] 0x0 using MOUT epll
EPLL_SEL [2] 0x1 using FOUT epll
MPLL_SEL [1] 0x1 using FOUT mpll
APLL_SEL [0] 0x1 using FOUT apll
Monitor MemU32 0x7f008000 = 0x00220022
设置GPACON寄存器
GPA0 [3:0] 0x2 UART RXD[0]
GPA1 [7:4] 0x2 UART TXD[0]
GPA2 [11:8] 0x0 Input
GPA3 [15:12] 0x0 Input
GPA4 [19:16] 0x2 UART RXD[1]
GPA5 [23:20] 0x2 UART TXD[1]
Monitor MemU32 0x7f008020 = 0x00002222
设置GPBCON寄存器
GPB0 UART_RXD[2]
GPB1 UART TXD[2]
GPB2 UART RXD[3]
GPB3 UART TXD[3]
Monitor memU32 0x7f005008 = 0x00000000
设置UFCON0寄存器:
FIFO disable
Monitor memU32 0x7f00500c = 0x00000000
设置UMCON0寄存器:
Modem interrupt Disable
Monitor MemU32 0x7f005000 = 0x00000003
设置ULCON0寄存器
Word Length 8-bit
One shop bit per frame
No parity Mode Normal mode operation
Monitor MemU32 0x7f005004 = 0x00000e45
设置UCON0寄存器
Clock selection EXT_UCLK1: DIV_VAL=(EXT_UCLK1/(bps x16))-1
Tx Interrupt Type: Level
Rx Interrupt Type: Pulse
Rx Time Out Enable: disable
Rx Error status interrupt enable: enable
Loop-back Mode: normal operation
Send break signal: normal transmit
Transmit Mode: Interrupt request or polling mode
Receive Mode: Interrupt request or polling mode
monitor memU32 0x7f005028 = 0x00000033
Div integer part is 0x33 (51)
Monitor memU32 0x7f00502c = 0x0000dfdd
设置UDIVSLOT0寄存器
0.83 * 16 = 13.3 = 13 so 0xdfdd
Monitor memU32 0x7f005020 = 0x4f4f4f4f
Monitor memU32 0x7f005020 = 0x4b4b4b4b
设置UTXH0寄存器,发送数据
Monitor MemU32 0x7300f120 = 0x0000000d
设置MEM_SYS_CFG寄存器:
Xm0CSn2 = NFCON CS0,
Xm0CSn3 = NFCON CS1
monitor MemU32 0x7e001004 = 0x00000004
设置P1MEMCCMD寄存器: command: Configure
Monitor MemU32 0x7e001010 = 0x0000040f
设置P1REFRESH寄存器: Refresh period = (((HCLK/1000*DDR_tREFRESH)-1)/1000) = 1037
Monitor MemU32 0x7e001014 = 0x00000006
设置P1CASLAT寄存器: CAS Latency [3:1] 0x3
Monitor MemU32 0x7e001018 = 0x00000001
设置P1T_DQSS寄存器: T_DQSS [1:0] 0x1
Monitor MemU32 0x7e00101c = 0x00000002
设置P1T_MRD寄存器: T_MRD [6:0] 0x2
Monitor MemU32 0x7e001020 = 0x00000006
设置P1T_RAS寄存器:
T_RAS [3:0] 0x6T_RAS = (((HCLK / 1000 * DDR_tRAS) -1) / 1000000 + 1) = 6.98
Monitor MemU32 0x7e001024 = 0x0000000a
设置P1T_RC寄存器
T_RC [3:0] 0xa T_RC = (((HCLK / 1000 * DDR_tRC) -1) / 1000000 + 1) = 10.04
Monitor MemU32 0x7e001028 = 0x0000000c
设置P1T_RCD寄存器
Scheduled_RCD [5:3] 0x1 T_RCD [2:0] 0x4 T_RCD = (((HCLK / 1000 * DDR_tRCD) – 1) / 1000000 + 1) = 4.05
Monitor MemU32 0x7e00102c = 0x0000010b
设置PnT_RFC寄存器
Scheduled_RFC [9:5] T_RFC [4:0]
T_RFC = (((HCLK / 1000 * DDR_tRFC) – 1) / 1000000 + 1) = 11.6
Monitor MemU32 0x7e001030 = 0x0000000c
设置P1T_RP寄存器
Scheduled_RP [5:3]
T_RP [2:0] T_RP = (((HCLK / 1000 * DDR_tRP) -1) / 1000000 + 1) = 4.05
Monitor MemU32 0x7e001034 = 0x00000002
设置P1T_RRD寄存器
T_RRD [3:0] T_RRD = (((HCLK / 1000 * DDR_tRRD) – 1) / 1000000 + 1) = 2.99
Monitor MemU32 0x7e001038 = 0x00000002
设置P1T_WR寄存器
T_WR [2:0] T_WR = (((HCLK / 1000 * DDR_tWR) – 1) / 1000000 + 1) = 2.99
Monitor MemU32 0x7e00103c = 0x00000002
设置P1T_WTR寄存器
T_WTR [2:0] 0x2
Monitor MemU32 0x7e001040 = 0x00000002
设置P1T_XP寄存器
T_XP [7:0] 0x2
Monitor MemU32 0x7e001044 = 0x00000010
设置P1T_XSR寄存器
T_XSR [7:0] T_XSR = (((HCLK / 1000 * DDR_tXSR) – 1) / 1000000 + 1) = 16.9
Monitor MemU32 0x7e001048 = 0x00000010
设置P1T_ESR寄存器
T_ESR [7:0]T_ESR = t_XSR
Monitor MemU32 0x7e00100c = 0x0001001a
设置P1MEMCFG寄存器
Active chips [22:21] 0x0 1chip
Qos master bits [20:18] 0x0 ARID[3:0]
Memory burst [17:15] 0x2 Burst 4
Stop mem clock [14] 0x0 Auto power down [13] 0x0
Power down prd [12:7] 0x0 AP bit [6] 0x0
Row bits [5:3] 0x3 14bits
Column bits [2:0] 0x2 10bits
Monitor MemU32 0x7e00104c = 0x00000b45
设置P1MEMCFG2寄存器
Read delay [12:11] 0x1
Read delay 1 cycle(usually for mobile DDR SDRAM)
Memory type [10:8] 0x3 Mobile DDR SDRAM
Memory width [7:6] 0x1 32-bit
Cke_init [3] 0x0
DQM init [2] 0x1
A_gt_m_sync [1] 0x0
Sync [0] 0x1
Monitor MemU32 0x7e001200 = 0x000150f0
设置P1_chip_0_cfg寄存器
BRC_RBC [16] 0x1 Bank-Row-Column organization
Address match [15:8] 0x50 (80)
Address mask [7:0] 0xf0
Monitor MemU32 0x7e001304 = 0x00000000
设置P1_user_cfg寄存器
DQS3 input chain delay selection [14:12] 0 minimum delay chain is used.
DQS2 input chain delay selection [10:8] 0x0
DQS1 input chain delay selection [6:4] 0x0
DQS0 input chain delay selection [2:0] 0x0
Monitor MemU32 0x7e001008 = 0x000c0000
设置P1 DIRECTCMD 寄存器
Chip number [21:20] 0x0
Memory command [19:18] 0x3 NOP
Monitor MemU32 0x7e001008 = 0x00000000
Precharge all
Monitor MemU32 0x7e001008 = 0x00040000
Auto refresh (need two times)
Monitor MemU32 0x7e001008 = 0x000a0000
Memory command [19:18] 0x2
Modereg or extended modereg
Bank address [17:16] 0x2
Monitor MemU32 0x7e001008 = 0x00080032
CAS 3,
Burst Length 4
monitor MemU32 0x7e001004 = 0x00000000
Go
文章浏览阅读2w次,点赞7次,收藏51次。四个步骤1.创建C++ Win32项目动态库dll 2.在Win32项目动态库中添加 外部依赖项 lib头文件和lib库3.导出C接口4.c#调用c++动态库开始你的表演...①创建一个空白的解决方案,在解决方案中添加 Visual C++ , Win32 项目空白解决方案的创建:添加Visual C++ , Win32 项目这......_c#调用lib
文章浏览阅读4.6k次。苹方字体是苹果系统上的黑体,挺好看的。注重颜值的网站都会使用,例如知乎:font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, W..._ubuntu pingfang
文章浏览阅读159次。表单表单概述表单标签表单域按钮控件demo表单标签表单标签基本语法结构<form action="处理数据程序的url地址“ method=”get|post“ name="表单名称”></form><!--action,当提交表单时,向何处发送表单中的数据,地址可以是相对地址也可以是绝对地址--><!--method将表单中的数据传送给服务器处理,get方式直接显示在url地址中,数据可以被缓存,且长度有限制;而post方式数据隐藏传输,_html表单的处理程序有那些
文章浏览阅读1.2k次。使用说明:开启Google的登陆二步验证(即Google Authenticator服务)后用户登陆时需要输入额外由手机客户端生成的一次性密码。实现Google Authenticator功能需要服务器端和客户端的支持。服务器端负责密钥的生成、验证一次性密码是否正确。客户端记录密钥后生成一次性密码。下载谷歌验证类库文件放到项目合适位置(我这边放在项目Vender下面)https://github.com/PHPGangsta/GoogleAuthenticatorPHP代码示例://引入谷_php otp 验证器
文章浏览阅读4.3k次,点赞5次,收藏11次。matplotlib.plot画图横坐标混乱及间隔处理_matplotlib更改横轴间距
文章浏览阅读2.2k次。①Storage driver 处理各镜像层及容器层的处理细节,实现了多层数据的堆叠,为用户 提供了多层数据合并后的统一视图②所有 Storage driver 都使用可堆叠图像层和写时复制(CoW)策略③docker info 命令可查看当系统上的 storage driver主要用于测试目的,不建议用于生成环境。_docker 保存容器
文章浏览阅读834次,点赞27次,收藏13次。网络拓扑结构是指计算机网络中各组件(如计算机、服务器、打印机、路由器、交换机等设备)及其连接线路在物理布局或逻辑构型上的排列形式。这种布局不仅描述了设备间的实际物理连接方式,也决定了数据在网络中流动的路径和方式。不同的网络拓扑结构影响着网络的性能、可靠性、可扩展性及管理维护的难易程度。_网络拓扑csdn
文章浏览阅读1.8k次,点赞5次,收藏8次。IOS系统Date的坑要创建一个指定时间的new Date对象时,通常的做法是:new Date("2020-09-21 11:11:00")这行代码在 PC 端和安卓端都是正常的,而在 iOS 端则会提示 Invalid Date 无效日期。在IOS年月日中间的横岗许换成斜杠,也就是new Date("2020/09/21 11:11:00")通常为了兼容IOS的这个坑,需要做一些额外的特殊处理,笔者在开发的时候经常会忘了兼容IOS系统。所以就想试着重写Date函数,一劳永逸,避免每次ne_date.prototype 将所有 ios
文章浏览阅读5.3k次。方法一:用PLSQL Developer工具。 1 在PLSQL Developer的sql window里输入select * from test for update; 2 按F8执行 3 打开锁, 再按一下加号. 鼠标点到第一列的列头,使全列成选中状态,然后粘贴,最后commit提交即可。(前提..._excel导入pl/sql
文章浏览阅读83次。Git常用命令速查手册1、初始化仓库git init2、将文件添加到仓库git add 文件名 # 将工作区的某个文件添加到暂存区 git add -u # 添加所有被tracked文件中被修改或删除的文件信息到暂存区,不处理untracked的文件git add -A # 添加所有被tracked文件中被修改或删除的文件信息到暂存区,包括untracked的文件...
文章浏览阅读202次。分享119个ASP.NET源码总有一个是你想要的_千博二手车源码v2023 build 1120
文章浏览阅读1.8k次。版权声明:转载请注明出处 http://blog.csdn.net/irean_lau。目录(?)[+]1、缺省构造函数。2、缺省拷贝构造函数。3、 缺省析构函数。4、缺省赋值运算符。5、缺省取址运算符。6、 缺省取址运算符 const。[cpp] view plain copy_空类默认产生哪些类成员函数