head 1.3; access; symbols; locks; strict; comment @# @; 1.3 date 2008.08.21.21.12.59; author oharboe; state dead; branches; next 1.2; commitid 240b48adda574567; 1.2 date 2008.02.21.19.17.10; author oharboe; state Exp; branches; next 1.1; commitid 743147bdce1f4567; 1.1 date 2008.01.02.21.53.14; author oharboe; state Exp; branches; next ; commitid 5c22477c05084567; desc @@ 1.3 log @merging in some docs to zpu_arch.html @ text @

Getting started - a ZPU hello world program

The ZPU comes with a standard GCC toolchain and an instruction set simulator. This allows compiling, running & debugging simple test programs. The Simulator has some very basic peripherals defined: counter, timer interrupt and a debug output port.

Installing

  1. Install Cygwin. http://www.cygwin.com
  2. Install Java
  3. Start Cygwin bash
  4. cd zpu/sw
  5. sh setup.sh
  6. /tmp/zpu/install/bin now has the .exe files for the GCC toolchain & GDB
  7. Optionally you may set up PATH variables to point to /tmp/zpu/install/bin
    source env.sh

Hello world example

The ZPU toolchain comes with newlib & libstdc++ support which means that many C/C++ programs can be compiled without modification.

cd zpu/sw/helloworld
../install/bin/zpu-elf-gcc -phi hello.c -o hello.elf

Running the hello world example in GDB

  1. cd zpu/sw/helloworld
  2. Launch the simulator from a seperate bash shell:

    java -classpath ../simulator/zpusim.jar -Xmx512m com.zylin.zpu.simulator.Phi 4444

  3. Launch GDB:

    ../install/bin/zpu-elf-gdb hello.elf

  4. Connect to target, load and run application:

    (gdb) target remote localhost:4444
    (gdb) load
    (gdb) continue

    @ 1.2 log @ * zpu/zpu/sw/index.html. Changed it a bit to make installation easier. @ text @@ 1.1 log @Initial import from www.ecosforge.net @ text @d12 4 a15 4

  5. unzip tools/zputoolchain.zip
  6. zpu/sw/install/bin now has the .exe files for the GCC toolchain & GDB
  7. You may want to add install/bin from zputoolchain.zip to PATH.
    export PATH=$PATH:<unzipdir>/install/bin @