安裝yargarto 版本eabi編譯鏈 http://www.yagarto.de/
安裝JAVA虛擬機 JRE 就足夠了。
下載 eclipse 的 C/C++ 版本
下載 zylin 插件,在 eclipse 的 Help --> Install New Software 中
添加地址
http://opensource.zylin.com/zylincdt/ 就可以了。
按照提示安裝之後
debug --> debug configuration 中可以看到 zylin 了
打開文件:file---->new--->c project
看到這樣的界面
寫入project name 以及問價路徑location 點next
debug和release建議都選上,點next
給出gcc的路徑和前綴點finish
我的工程在虛擬機下面已經make了所以不需要make,如果你沒有make,應該project--->build all 既可以make,建議吧自動編譯去掉;我在build all 時會報錯
d:/gnu_tools_arm_embedded/4.9/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): In function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
collect2.exe: error: ld returned 1 exit status
make: *** [debug] Error 1
暫時還沒找到原因;誰知道原因請告訴我;反正我是已經編譯過的就沒有找原因了;
再是debug
run------>debug configurations
點 Zylin Embedded debug(native) ,因爲使用的是 yagarto工具鏈
新建一個 New Launch configuration 改名爲項目的名字。、
C/C++ Application 選擇生產的elf文件。
Debugger 頁選擇gdb具體的路徑,例如
D:\yagarto\bin\arm-none-eabi-gdb.exe
GDB command file 選擇需要的 gdb啓動腳本,可以參考jlink的幫助文檔,用現成的修改一下就行了。
其他不需要設置了。
如果不在GDB command file也可以在commands頁中的'initializd' commands 中直接寫入gdb啓動腳本!
三星2440可以使用內部的4K SRAM練習,如果初始化腳本加入初始化SDRAM控制器的話,
就可以直接下載到SDRAM上面調試了,非常方便。
先運行JLINK的 J_Link GDB Server,然後就可以通過eclipse 調試了。
我的gdbinit腳本
# connect to the J-Link gdb servertarget 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 (to be done by user)
#
# Set the processor mode
monitor reg cpsr = 0xd3
#config MMU 配置MMU
#flush v3/v4 cache
monitor cp15 7, 7, 0, 0 = 0x0
#/* flush v4 TLB 協處理器*/
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 kangear 關閉看門狗
monitor MemU32 0x53000000 = 0x00000000
monitor sleep 10
#disable interrupt kangear 關閉中斷
monitor MemU32 0x4A000008 = 0xffffffff
monitor MemU32 0x4A00001C = 0x7fff
#set clock
#initialize system clocks --- locktime register
monitor MemU32 0x4C000000 = 0xFF000000
#initialize system clocks --- clock-divn register
monitor MemU32 0x4C000014 = 0x5 #CLKDVIN_400_148
#initialize system clocks --- mpll register
monitor MemU32 0x4C000004 = 0x7f021 #default clock
#config sdram
monitor MemU32 0x53000000 0x00000000
monitor MemU32 0x4A000008 0xFFFFFFFF
monitor MemU32 0x4A00001C 0x000007FF
monitor MemU32 0x53000000 0x00000000
monitor MemU32 0x56000050 0x000055AA
monitor MemU32 0x4C000014 0x00000007
monitor MemU32 0x4C000000 0x00FFFFFF
monitor MemU32 0x4C000004 0x00061012
monitor MemU32 0x4C000008 0x00040042
monitor MemU32 0x48000000 0x22111120
monitor MemU32 0x48000004 0x00002F50
monitor MemU32 0x48000008 0x00000700
monitor MemU32 0x4800000C 0x00000700
monitor MemU32 0x48000010 0x00000700
monitor MemU32 0x48000014 0x00000700
monitor MemU32 0x48000018 0x0007FFFC
monitor MemU32 0x4800001C 0x00018005
monitor MemU32 0x48000020 0x00018005
monitor MemU32 0x48000024 0x008E0459
monitor MemU32 0x48000028 0x00000032
monitor MemU32 0x4800002C 0x00000030
monitor MemU32 0x48000030 0x00000030
# Setup GDB for faster downloads
#set remote memory-write-packet-size 1024
monitor speed auto
break _start
load