2010-08-21

Customize minsoc as an OpenRISC sub-system

GOAL
To create a SoC sub-system based on minsoc and OpenRISC

STEPS
  1. obtain minsoc and OpenRISC from SVN repository
    $ (origin) svn co http://opencores.org/ocsvn/minsoc/minsoc/trunk minsoc
    $ (subsoc) git clone git://github.com/artek/minsoc.git minsoc
    $ svn co http://opencores.org/ocsvn/openrisc/openrisc/trunk openrisc
  2. follow steps for "GNU tool chain with newlib"
    1. build and install or1ksim
      edit /etc/ld.so.conf.d/or32.conf, and add /opt/or1ksim/lib
    2. install required library (MFP, MPFR) for building toolchain
      $ sudo apt-get install libgmp3-dev libmpfr-dev dejagnu expectk
    3. build toolchain with newlib
      $ cd openrisc/gnu-src
      $ sudo ./bld.sh --prefix /opt/or32-elf-new --or1ksim /opt/or1ksim --force
    4. add or32-gcc and or1ksim binary to $PATH
      export PATH=${PATH}:/opt/or32-elf/bin:/opt/or1ksim/bin
  3. refer to "Howto: Porting Newlib" to bring up your own BSP
    • config new target as "NON-REENTRANT", "NOT NAMESPACE CLEAN" to reduce generated code size
    • config new target with "-DSMALL_MEMORY" to reduce page size from 4KB to 128B for malloc
    • edit configure.host:
      or32-*-*)
      # syscall_dir=syscalls
      newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DSMALL_MEMORY"
      ;;

  4. follow the minsoc-HOWTO for simulation
    evince minsoc/doc/howto.pdf
  5. FPGA Impmentation
    1. add minsoc_sub to your toplevel
    2. update "Verilog Include Directories" for minsoc to Synthesis options of ISE
      ../../rtl/minsoc/rtl/verilog/ (for minsoc)
      |../../rtl/minsoc/rtl/verilog/or1200/rtl/verilog/ (for or1200)
      |../../rtl/minsoc/rtl/verilog/uart16550/rtl/verilog/ (for uart16550)
  1. check out openrisc repository from opencores
    svn co http://opencores.org/ocsvn/openrisc/openrisc/trunk openrisc
  2. build up toolchain
    cd toolchain_install_scripts/
    1. sudo ./crossbuild.sh
      build or32 toolchain and install it to /usr/local/
    2. sh MOF_ORSOC_TCHN_v5c_or32-elf.sh
      build toolchain and or1ksim to specified path


CONS
  • or32 ld does not support --gc-sections

2 則留言:

Unknown 提到...

你好,

小弟是新手,目前正在study如何把OpenRISC弄到Spartan3E or Vertex3上跑起來。發現網站上的文件和project相當得多,不知道哪邊有比較統一的step-by-step文件,或者建議看的網站,目前找了幾個網頁講的各自不同,目錄結構也都不盡相同,不知道該follow哪個。

Yishin 提到...

Hi Green,

不好意思,平常很少上 Blog,現在才看到你的留言。

我當時是照 minsoc 的方法做了一遍,先弄一個可以跑 simulation 的環境出來,然後再修改成我想要的樣子 -- subsoc。我沒有做文件,但 source code 有放在 github 上。