You are on page 1of 21

ITR GmbH Manual Development of eCos Applications using Eclipse Page 1/21

Manual

eCos on Zynq

Evaluation Board










ITR GmbH Manual Development of eCos Applications using Eclipse Page 2/21
eCos on Zynq Evaluation Board

I. Write prebuild image to QSPI Flash

1. Connect J-Link JTAG to J58 on Zynq Evaluation Board.

2. Set SW10 switch to 1-1 position.

3. Set QSPI boot mode on your Zynq Evaluation Board. (Jumper Settings from
J21, J20, J22, J25, J26 as follows or DIP Switch SW16 Setting: 1,2,3 and 5 are
switched to the right and 4 is switched to the left)



4. Connect Mini USB cable to J17 on Zynq Evaluation Board from one side and to
PC from other side. (install CP2103 chip driver if necessary)

5. Open COM port terminal (e.g. Putty) and open COM Port which is assigned to
this CP2103 driver.

6. Start GDB Server and power on Zynq Evaluation Board. (Please use the GDB
Server Version which support Cortex-A8 CPU, e.g. J-Link ARM V4.53e
versoin).


ITR GmbH Manual Development of eCos Applications using Eclipse Page 3/21


It should find Cortex-A8 target, set the necessary settings as figure:

Uncheck Cache reads
Check Init regs on start

7. You can find following files in folder:

.gdbinit
boot.bin
redboot.elf
arm-none-eabi-gdb.exe

Start arm-none-eabi-gdb.exe, you will see the next log:


ITR GmbH Manual Development of eCos Applications using Eclipse Page 4/21


8. And the next log in terminal:



9. With fconfig command to setup ip address, netmask, gateway, server ip and
save configuration to flash.

User BOOTP for network configuration: false
Update RedBoot non-volatile configuration - continue (y/n)? y

10. Need to reboot Redboot, so close GDB Server and arm-none-eabi-gdb.exe,
then repeat 6~8 steps.


ITR GmbH Manual Development of eCos Applications using Eclipse Page 5/21
11. New ip address and server ip are already applied. So we can use TFTP to
download bootloader. Connect Ethernet cable to the Ethernet interface of the
development board. launch TFTP Server (e.g. Tftpd32) and configure it.

In Settings Menu: on the GLOBAL tab uncheck all options except for TFTP
Server:


on the TFTP tab select your Base Directory:



12. Copy boot.bin to the TFTP Base Directory.

13. Use RedBoot command to load boot.bin file


ITR GmbH Manual Development of eCos Applications using Eclipse Page 6/21
RedBoot> load -r -b 0x01000000 boot.bin

14. Need to prepare FIS table

RedBoot> fis init
Press y when it prompts

15. Write boot.bin file into QSPI flash

RedBoot> fis write f 0x00000000 b 0x01000000 l 0x00040000

16. Power off board and disconnect JTAG.

17. Power on board and you will see RedBoot prompt in COM console.

18. Also you can boot FPGA side with TFTP

RedBoot> load -r -b 0x01000000 fpga.bin
RedBoot> fpga_load b 0x01000000 l 0x3dbafc



Please pay attention to the DDR3 address. Address should be accessible from all
masters. Also for FPGA, this address should be aligned by 16MB boundary.

Note:


ITR GmbH Manual Development of eCos Applications using Eclipse Page 7/21
If you find error while starting arm-none-eabi-gdb.exe in step 7, that means the
flash was written by somehow before, you need to erase it to run step 7 correctly.

Insert SD Card which contains the pre-built images for the Xilinx ZC702
platform and set the SD Card boot mode for board. (Jumper Settings: set J22
the same as J25 or DIP Switch SW16 Setting: 1,2 and 5 are switched to the
right and 3, 4 are switched to the left)

Power on board and if you see any output in terminal then hit any key to
stop autoboot, and you will see the pele-boot prompt.

Use sf command to erase flash

pele-boot> sf probe 0 0 0
pele-boot> sf erase 0 0x200000

After finish power off the board and repeat from step 6 to continue.

Once boot.bin was written in QSPI flash and the IP was configured, you can
power on the board to get redboot prompt. Then you can ignore from step 6 to
step10 for updating new boot.bin file.



























ITR GmbH Manual Development of eCos Applications using Eclipse Page 8/21
II. Build RedBoot for Zynq Eveluation Board

Assumed eCosTools-install.exe was installed in host PC.

1. Open eCos Configuration Tool:

At the first time running eCos Configuration Tool a message box will appear to
let you set the repository path:


Click Browse to find the eCos repository:


ITR GmbH Manual Development of eCos Applications using Eclipse Page 9/21

Click OK you can see the eCos Configuration Tools like below:

2. Inside eCos Configuration Tool, open redboot_zynq.ecc in folder
\Source\target.

3. Make sure the Build Tools Path (Tools>Paths>Build Tools), User Tools
Path (Tools>Paths>User Tools) are configured correctly:




ITR GmbH Manual Development of eCos Applications using Eclipse Page 10/21


4. Run Build > Generate build tree.

5. Run Build > Library to build RedBoot.

6. After finish, you will find redboot.elf in folder
\Source\target\redboot_zynq_install\bin.

7. In folder you can find the script file gen.bat for generating boot.bin file and
the prebuilt redboot.elf file.



8. Copy your built redboot.elf to replace prebuilt redboot.elf and launch gen.bat
to build the new boot.bin file.

9. Use the new boot.bin to rewrite QSPI flash. (See section I. Write prebuild
image to QSPI Flash).


ITR GmbH Manual Development of eCos Applications using Eclipse Page 11/21
III. Build eCos internal tests, boot it and write it to flash memory

1. Open eCos Configuration Tool and open zynq_eval_default_config.ecc in
folder \Source\target.



2. Run Build > Generate build tree.

3. Run Build > Tests to build Tests.

4. After finish, you will find tm_basic in folder
\Source\target\zynq_eval_default_config_install\tests\kernel\current\tests.

5. Connect Ethernet cable to the Ethernet interface of the development board.

6. Launch Tftpd32 and configure the TFTP-server. (see section I. Write prebuild
image to QSPI Flash step 11).

7. Copy your built tm_basic to TFTP Base Directory.

8. Power on board, In RedBoot prompt run the load command:

RedBoot> load tm_basic


ITR GmbH Manual Development of eCos Applications using Eclipse Page 12/21


9. Use go command to start tm_baisc application:

RedBoot> go

tm_basic needs about 30-40 sec for starting, because big BSS area (about 900 MB)
in DDR3 SDRAM.

If you want to write tm_basic into flash and let it runs by startup, please ignore
step 9 and run step 10.

10. To write tm_basic into flash, after step 8, use fis create command:

RedBoot> fis create b 0x02000000 l 0x14000 f 0x00200000 e 0x02000040
tm_basic

11. After that run fconfig to set up run script:

RedBoot> fconfig
Run script at boot: true
Enter script, terminate with empty line
>> fis list
>> fis load tm_basic
>> go
>>
Boot script timeout

ITR GmbH Manual Development of eCos Applications using Eclipse Page 13/21


12. After finish, reboot the board and it will run RedBoot and tm_basic
automatically.








































ITR GmbH Manual Development of eCos Applications using Eclipse Page 14/21
IV. Build eCos application, run it and debug it with IDE.

1. Open eCos Configuration Tool and open zynq_eval_default_config.ecc in
folder \Source\target.

2. Run Build > Generate build tree.

3. Run Build > Library to build eCos Library.

Please wait while the eCos Configuration Tool builds eCos Library. This will
take some minutes to complete.

4. Open eclipse IDE.

5. Create new eCos C project. First choose File>New> eCos C Project as
shown in the picture:


Choose Hello World ANSI C eCos Project in the Project type. The toolchain
we use is ARM GCC. Type the name of the project to the Project name field
and select a location for the project:

ITR GmbH Manual Development of eCos Applications using Eclipse Page 15/21

Click Next.
In Basic Settings wizard, click on button Browse to find the eCos installation
directory (from step 3):

Click Next then Finish to complete creating a new project.

ITR GmbH Manual Development of eCos Applications using Eclipse Page 16/21

6. Configure Build Environment.

Highlight Project and Select Project > Properties > C/C++ Build >
Environment:

Modify the variable with the name ECOS_INSTDIR, which was created from
step 3 (e.g. C:\eCos On Zynq\Source\target\zynq_eval_default_config_install,
please use if the path has spaces). Click Apply and OK to save
Configuration.

ITR GmbH Manual Development of eCos Applications using Eclipse Page 17/21
7. To build or clean Project, use the corresponding commands as follows:


8. Configure debugger. Select Window > Open Perspective > Debug, the
configuration can be reached by clicking on the down arrow at the "insect"
button. That brings up the pull-down menu:

And select "Debug Configuration...":


The next window will look like:

ITR GmbH Manual Development of eCos Applications using Eclipse Page 18/21


Double click on "ARM eCos Debugger" to create a configuration of selected
type. On the field Name keep Hello Debug. On the C/C++ Application
field keep Debug\Hello. On the Project field keep Hello to debug the
test application. The Debug Configuration dialog will look like:

Main tab:

Debugger tab:

ITR GmbH Manual Development of eCos Applications using Eclipse Page 19/21

Now move to the "Startup" tab. Select User Defined Hardware in Hardware
combo box, open .gdbinit file with editor and copy the bootscript content, paste
the copied bootscript in text field, remove the last two lines of the content:
load redboot.elf
continue
click Apply to save settings.



ITR GmbH Manual Development of eCos Applications using Eclipse Page 20/21


9. Connect J-Link JTAG to J58 on Zynq Evaluation Board. Set SW10 switch to
1-1 position. Jumper Settings: set J21, J20, J22, J25, J26 down or DIP Switch
SW16 Setting: 1, 2, 3, 4 and 5 are switched to the right. Open J-Link GDB
Server via JTAG for debug connection, power on the board.


ITR GmbH Manual Development of eCos Applications using Eclipse Page 21/21
10. After log output shows Waiting for GDB connection, click Debug on
Debug Configuration window to run the debugger.

Set breakpoint anywhere, Click Resume (F8) to start the debugging.