使用eclipse与Jlink调试S3C2440 2410

来源:互联网 发布:淘宝美人药妆激素 编辑:程序博客网 时间:2024/06/05 21:17


1.首先安装Jlink驱动

2.安装GNU ARM toolchain工具链

推荐使用YAGARTO Tools emb4fun Tools, which can be foundhere.

安装完成后可以在命令行执行:

C:\make --version

GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i686-pc-mingw32

If there is no answer, probably "make-utils" was not installed or is not in your PATH.



然后下载

YAGARTO   here.

安装完成后可以在命令行执行:

C:\>arm-none-eabi-gcc --version

The result should look like:

arm-none-eabi-gcc (GCC) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If there is no answer, probably the GNU ARM toolchain was not installed or is not in your PATH.


For a complete C/C++ development system we need the following components:

1. GDB Server2. GNU ARM toolchain3. Integrated Development Environment

The GNU ARM Bare Metal Toolchain (arm-none-eabi) will be used for building applications for the ARM architecture without any operation systems like Linux. If you want to build applications for Linux, search for a arm-linux-eabi toolchain.

This tutorial here will cover how to setup your YAGARTO toolchain, and how to compile your first ARM program. The tutorial is for the YAGARTO toolchain, but should work with other toolchains (arm-none-eabi) likeGNU Tools for ARM Embedded Processors too.

Later I will describe how to expand the toolchain by Eclipse.

^ top 

Download and install the tools

Do not install the tools or the toolchain in a directory which contain spaces like "C:/Program Files/". In this case the programs will not work!

If you do not have the utilities like make, sh, rm, cp and mkdir, I recomended to use these tools from the latestYAGARTO Tools emb4fun Tools installer, which can be found here.

Start the installer, at the "Choose Components" page you can accept the defaults:

Press the "Next >" button and follow the instruction of the installer.

Now we want to make a short test if these tools are all available. Therefore open a command prompt and type:

C:\make --version

GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i686-pc-mingw32

If there is no answer, probably "make-utils" was not installed or is not in your PATH.

^ top 

Download and install the toolchain

If you do not already have downloaded the YAGARTO toolchain, you can download the installerhere.

Start the installer, at the "Choose Components" page you can accept the defaults:

Press the "Next >" button and follow the instruction from the installer.

Now we want to make a short test if the compiler is available. Therefore open a command
prompt and type:

C:\>arm-none-eabi-gcc --version

The result should look like:

arm-none-eabi-gcc (GCC) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If there is no answer, probably the GNU ARM toolchain was not installed or is not in your PATH.



3安装JRE与eclipse

The next section is a pretty large one. Go ahead and take a quick break. Visite the facilities or brew a fresh pot of tea. When you get back, we will start with Eclipse.

Click on the shortcut which you have created in the step before:

After the start of Eclipse you should see the following splash screen:

If not, you have a problem with the Java Runtime Environment. After a while Eclipse want to know where to store your projects:


I will use C:\workspace for the Eclipse workspace. Enter your directory and press "OK". Now the following "Welcome" window will appear:

(Click inside the picture to expand)

Now we must install the C/C++ Development Tooling - CDT. Therefore use "Help-> InstallNew Software...":

The next window will be show up:

Press the "Add..." button and fill in the Repository information. Use " CDT" for the "Name" and "http://download.eclipse.org/tools/cdt/releases/indigo" for the "Location"Now the Eclipse window should look like:

Press "OK" (it could takes a while) and you must now select the feature you want to install.
Select "CDT Main Features":

  • C/C++ Development Tools

And from the "CDT Optional Features" select:

  • C/C++ GCC Cross Compiler Support
  • C/C++ GDB Hardware Debugging
  • C99 LR Parser

The window should look like:

Press "Next" and "Next" again. Now you must accept the license agreements. Therefore select this options, and press "Finish". Now it can takes some time while the new software will be installed:

After the software update you must restart Eclipse now:

Press the "Restart Now" button and wait while Eclipse will be restarted. After the restart you will see the start screen again:

Now click at the "Workbench" icon at the right upper edge of the window, and the next window will look like:

(Click inside the picture to expand)

This is the "Resource Perspective", but we need to open the "C/C++ Perspective". Use "Window / Open Perspective / Other ..."

(Click inside the picture to expand)

The next window will be opened:

Select "C/C++" and press the "OK" button. Now the "C/C++" and
"Resource Perspective" are part of the window:

(Click inside the picture to expand)

We only need the "C/C++ Perspective" and may close the Resource one. Therefore right click at the Resource icon and close the Perspective:

(Click inside the picture to expand)

Now the window should look like:

(Click inside the picture to expand)

What's next? Now let's start with a small example. Therefore I have created these examples for it.Download the example you need and expand the zip file in your temp directory.

I will show you the next steps with the SAM7X256Test example. For this purpose, I expanded it in the following directory:

C:\temp\SAM7X256Test

To create an Eclipse project use: "File / New / C Project"

(Click inside the picture to expand)

The next window will be show up:

Here you will see that the "Location" is your workspace directory you created some steps above. Type in the "Project name" (I will use SAM7X256Test) and Select "Makefile project" and "Cross GCC", after this press the "Finish" button. Now the Eclipse window should look like:

(Click inside the picture to expand)

You just created your first Eclipse project. You now need to configure it. Use the "Projet" menu and remove the checkmark at "Build Automatically":

Use the "Project" menu again and select "Properties":

A new window will be opened:

(Click inside the picture to expand)

use now the "Discovery Options" under "C/C++ Build" page and change the "Compiler invocation command" to "arm-none-eabi-gcc":

(Click inside the picture to expand)

Press the "Apply" button. Now change to "Settings" deselect "Elf Parser" and select the "GNU Elf Parser":

(Click inside the picture to expand)

Press the "OK" button to finish this dialog.

Your project is empty and you must import the project files to Eclipse.
Use the "File / Import..." menu and select the "File System" as input source:

Press the "Next" button to open the "Import" dialog:

But what files? You downloaded one of the examples above and expanded the zip file into a temp directory (I used C:\temp\SAM7X256Test). Select this directory for " From directory" and select all files with the checkmark. Press "Finish" to close the dialog. Your project should now look like:

(Click inside the picture to expand)

Now let's "clean" the project. For this purpose use " Project / Clean... ". Set the options according to the next window:

Remove the checkmark at "Start a build immediately", and press "OK". The "Console" will show the result of the "Clean" command:

(Click inside the picture to expand)

By the way, you can open any source file by simply double clicking on it. The editor will open up:

(Click inside the picture to expand)

But do not change the file. Now let's build the project using "Project / Build Project":

The project will be build, and the window look like:

(Click inside the picture to expand)

At the same time you will see the result of the build process inside the "Console" window. After a successful build process, an elf file was created:

Now it is time for a break again. When you get back, we will start to install and configure the debugger.


4.安装zylin 插件

在 eclipse 的 Help --> Install New Software 中
添加地址 http://opensource.zylin.com/zylincdt/ 就可以了。
按照提示安装之后
debug --> debug configuration 中可以看到 zylin 了

点 Zylin Embedded debug(native) ,因为使用的是 yagarto工具链
新建一个 New Launch configuration 改名为项目的名字。、
C/C++ Application 选择生产的elf文件。

Debugger 页选择gdb具体的路径,例如
C:\yagarto\bin\arm-none-eabi-gdb.exe
command file 选择需要的 gdb启动脚本,可以参考jlink的帮助文档,用现成的修改一下就行了。
其他不需要设置了。


三星2440可以使用内部的4K SRAM练习,如果初始化脚本加入初始化SDRAM控制器的话,
就可以直接下载到SDRAM上面调试了,非常方便。

先运行JLINK的 J_Link GDB Server,然后就可以通过eclipse 调试了。

我的gdbinit脚本

target remote localhost:2331
monitor reset
monitor halt
monitor speed 8000
monitor endian little
monitor reg cpsr = 0xd3

#WDT
monitor memU32 0x53000000 = 0x00000000      #WTCON
#PLL
monitor memU32 0x4C000000 = 0xFFFFFFFF      #LOCKTIME
monitor memU32 0x4C000004 = 0x0005C011      #MPLLCON
monitor memU32 0x4C000008 = 0x00038022      #UPLLCON
monitor memU32 0x4C00000C = 0x00FFFFF0      #CLKCON
monitor memU32 0x4C000010 = 0x00000004      #CLKSLOW
monitor memU32 0x4C000014 = 0x00000005      #CLKDIVN
monitor memU32 0x4C000018 = 0x00000000      #CAMDIVN
#MEMCTRL
monitor memU32 0x48000000 = 0x22011110      #BWSCON
monitor memU32 0x48000004 = 0x00000700      #BANK0-5
monitor memU32 0x48000008 = 0x00000700      
monitor memU32 0x4800000c = 0x00000700
monitor memU32 0x48000010 = 0x00000700
monitor memU32 0x48000014 = 0x00000700
monitor memU32 0x48000018 = 0x00000700
monitor memU32 0x4800001C = 0x00018005      #BANK6-7
monitor memU32 0x48000020 = 0x00018005
monitor memU32 0x48000024 = 0x008C07A3      #REFRESH
monitor memU32 0x48000028 = 0x000000B1      #BANKSIZE
monitor memU32 0x4800002C = 0x00000030      #MRSRB6-7
monitor memU32 0x48000030 = 0x00000030

break main
load
#continue



参考

:http://www.emb4fun.de/archive/gabmt/index.html

:http://blog.csdn.net/etual/article/details/8238572

0 0
原创粉丝点击