S3C2440之开发环境搭建(jtag)

再次总结下mini2440的开发环境的搭建.
一 开发板介绍

先介绍下开发版:

img

详细介绍请查看官网:http://www.arm9.net/mini2440-feature.asp

二 openjtag开发环境

如果我们要调试裸板和uboot等,最好的方式是通过openjtag来调试,
一是容易下载代码到板子,而是我们可以通过gdb调试程序.
当然如果通过sd卡也能启动,只是并不适合学习和调试.
以下是实际当中openjtag的连接图:

img

1)驱动和相关软件安装:

需要安装的有:libusb-dev libftdi-dev openocd telnet

用到的命令有:dmesg lsusb

通过dmesg查看是否检测到硬件:

[ 2172.600041] usb 6-1: new full-speed USB device number 5 using uhci_hcd [ 2172.787177] usb 6-1: New USB device found, idVendor=1457, idProduct=5118 [ 2172.787181] usb 6-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 2172.787183] usb 6-1: Product: USB<=>JTAG&RS232 [ 2172.787185] usb 6-1: Manufacturer: www.100ask.net [ 2172.795240] usb 6-1: Ignoring serial port reserved for JTAG [ 2172.799302] ftdi_sio 6-1:1.1: FTDI USB Serial Device converter detected [ 2172.799351] usb 6-1: Detected FT2232C [ 2172.801290] usb 6-1: FTDI USB Serial Device converter now attached to ttyUSB0
其次lsusb有以下显示,说明驱动已经安装. Bus 006 Device 005: ID 1457:5118 First International Computer, Inc. OpenMoko Neo1973 Debug board (V2+)
2)以下是通过openocd连接板子 1. 启动openocd. img openocd.cfg (2.05 KB, 下载次数: 1)

注意启动openocd 直接执行即可 不要用-f *.cfg的方式, 例如:

$sudo openocd

Open On-Chip Debugger 0.10.0

Licensed under GNU GPL v2

For bug reports, read

http://openocd.org/doc/doxygen/bugs.html

force hard breakpoints

Info : auto-selecting first available session transport “jtag”. To override use ‘transport select ‘.

trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain connect_deassert_srst

adapter speed: 6000 kHz

Info : clock speed 6000 kHz

Info : JTAG tap: s3c2440.cpu tap/device found: 0x0032409d (mfg: 0x04e (Samsung), part: 0x0324, ver: 0x0)

Info : Embedded ICE version 2

Info : s3c2440.cpu: hardware has 2 breakpoint/watchpoint units

2.用telnet连上openocd烧写uboot:

$telnet 127.0.0.1 4444

Trying 127.0.0.1…

Connected to 127.0.0.1.

Escape character is ‘^]’.

Open On-Chip Debugger

> reset; halt

JTAG tap: s3c2440.cpu tap/device found: 0x0032409d (mfg: 0x04e (Samsung), part: 0x0324, ver: 0x0)

NOTE! DCC downloads have not been enabled, defaulting to slow memory writes. Type ‘help dcc’.

NOTE! Severe performance degradation without fast memory access enabled. Type ‘help fast’.

target halted in ARM state due to debug-request, current mode: Supervisor

cpsr: 0x800000d3 pc: 0x00000058

MMU: disabled, D-Cache: disabled, I-Cache: disabled

> nand probe 0

NAND flash device ‘NAND 256MiB 3.3V 8-bit (Samsung)’ found

> nand erase 0 0 0x100000

s3c2440_read_block_data: reading data: 0x1473650, 0x7fffa313c8d0, 6

s3c2440_read_block_data: reading data: 0x1473650, 0x7fffa313c8d0, 6

s3c2440_read_block_data: reading data: 0x1473650, 0x7fffa313c8d0, 6

s3c2440_read_block_data: reading data: 0x1473650, 0x7fffa313c8d0, 6

s3c2440_read_block_data: reading data: 0x1473650, 0x7fffa313c8d0, 6

s3c2440_read_block_data: reading data: 0x1473650, 0x7fffa313c8d0, 6

s3c2440_read_block_data: reading data: 0x1473650, 0x7fffa313c8d0, 6

s3c2440_read_block_data: reading data: 0x1473650, 0x7fffa313c8d0, 6

erased blocks 0 to 7 on NAND flash device #0 ‘NAND 256MiB 3.3V 8-bit’

> nand write 0 u-boot.bin 0

wrote file u-boot.bin to NAND flash 0 up to offset 0x00039800 in 123.920341s (1.823 KiB/s)

​ 很多时候会出现写不成功的情况,你可以在写完用nand dump看一下写成功没有,没有的话再写一遍就OK了。

3.测试u-boot

烧写成功后为了简单测试,我们可以先退出openocd

然后重启板子通过minicom进入u-boot

​ Welcome to minicom 2.7
​ OPTIONS: I18n Compiled on Mar 14 2018, 09:40:14. Port /dev/ttyUSB0, 11:45:28
Press CTRL-A Z for help on special keys
U-Boot 2010.03 (7月 29 2017 - 15:00:02)
modified by tekkamanninja (tekkamanninja@163.com) Love Linux forever!!
I2C: ready DRAM: 64 MB Flash: 2 MB NAND: 256 MiB *** Warning - bad CRC or NAND, using default environment
In: serial Out: serial Err: serial USB slave is enable! Net: dm9000 Hit any key to stop autoboot: 0 ##### FriendlyARM U-Boot(2012-07) for 2440 ##### [f] Format the nand flash [v] Download u-boot.bin [k] Download Linux kernel [y] Download root yaffs2 image [a] Download Absolute User Application ~~ Set the boot parameter of Linux~~~~ Boot Linux~~~~ [r] Reboot~~~~ [q] Quit to shell~~~~ Enter your Selection:~~


S3C2440之开发环境搭建(jtag)
https://dnsnat.gitee.io/EMBEDDED/mini2440/S3C2440之开发环境搭建(jtag).html
作者
dnsnat
发布于
2022年3月22日
许可协议