Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mkdir ~/tmp-mor1kx-multicore
- cd ~/tmp-mor1kx-multicore
- # Set your installation prefix
- export PREFIX=$HOME/or1k-toolchain
- # PRE-pend new or1k-toolchain to PATH
- export PATH=$PREFIX/bin:$PATH
- # Checkout toolchain repositories
- cd ~/tmp-mor1kx-multicore
- git clone -b multicore https://github.com/wallento/or1k-src
- git clone -b multicore https://github.com/wallento/or1k-gcc
- # Build binutils, first round
- mkdir bld-src-stage1
- cd bld-src-stage1
- ../or1k-src/configure --target=or1k-elf --prefix=$PREFIX --enable-shared --disable-itcl --disable-tk --disable-tcl --disable-winsup --disable-gdbtk --disable-libgui --disable-rda --disable-sid --disable-sim --disable-gdb --with-sysroot --disable-newlib --disable-libgloss
- make
- make install
- cd ..
- # Build gcc, first round
- mkdir bld-gcc-stage1
- cd bld-gcc-stage1
- ../or1k-gcc/configure --target=or1k-elf --prefix=$PREFIX --enable-languages=c --disable-shared --disable-libssp
- make
- make install
- cd ..
- # Build binutils and newlib, second round (now with gcc)
- mkdir bld-src-stage2
- cd bld-src-stage2
- ../or1k-src/configure --target=or1k-elf --prefix=$PREFIX --enable-shared --disable-itcl --disable-tk --disable-tcl --disable-winsup --disable-gdbtk --disable-libgui --disable-rda --disable-sid --enable-sim --disable-or1ksim --enable-gdb --with-sysroot --enable-newlib --enable-libgloss
- make
- make install
- cd ..
- # Build gcc, second round
- mkdir bld-gcc-stage2
- cd bld-gcc-stage2
- ../or1k-gcc/configure --target=or1k-elf --prefix=$PREFIX --enable-languages=c,c++ --disable-shared --disable-libssp --with-newlib
- make
- make install
- cd ..
- ##
- # Now you have or1k-elf-gcc with -mnewlib and -mmulticore
- ##
- # Get FuseSoC if you don't have it
- # For Modelsim on a 64-bit machine you need my version
- git clone https://github.com/wallento/fusesoc.git
- cd fusesoc
- autoreconf -i
- ./configure && make
- cd ..
- # Get modified ORPSoC
- git clone -b multicore-demo https://github.com/wallento/orpsoc-cores.git
- # Build demo
- mkdir demo
- cd demo
- echo "[main]
- cores_root=../orpsoc-cores/cores
- systems_root=../orpsoc-cores/systems" > fusesoc.conf
- # Before we build the hardware, we want to build the software to run
- mkdir sw
- cd sw
- wget http://pastebin.com/download.php?i=1dyUnygK -O hello.c
- or1k-elf-gcc -Wall -o hello.elf hello.c -mnewlib -mmulticore
- cd ..
- # Build fusesoc and run demo (modelsim)
- export MODEL_TECH=$(dirname $(which vsim))
- ../fusesoc/bin/fusesoc sim --sim=modelsim mor1kx-dualcore --elf-load=$PWD/sw/hello.elf
- # Build fusesoc and run demo (verilator)
- ../fusesoc/bin/fusesoc sim --sim=verilator mor1kx-dualcore --elf-load=$PWD/sw/hello.elf
- # The software is run and output should be like (modelsim):
- # Program header 0: addr 0x00000000, size 0x000125E0
- # Program header 1: addr 0x000145E0, size 0x00000EE8
- # elf-loader: /home/gu45zin/tmp-mor1kx-multicore/demo/sw/hello.elf was loaded
- # Loading 21810 words
- # orpsoc_tb.dut.mor1kx0.bus_gen.ibus_bridge: Wishbone bus IF is B3_REGISTERED_FEEDBACK
- # orpsoc_tb.dut.mor1kx0.bus_gen.dbus_bridge: Wishbone bus IF is B3_REGISTERED_FEEDBACK
- # orpsoc_tb.dut.mor1kx1.bus_gen.ibus_bridge: Wishbone bus IF is B3_REGISTERED_FEEDBACK
- # orpsoc_tb.dut.mor1kx1.bus_gen.dbus_bridge: Wishbone bus IF is B3_REGISTERED_FEEDBACK
- # [0, 278955.00 ns] Hello World from core 1 of 2!
- # [1, 281775.00 ns] Hello World from core 2 of 2!
- # [0, 320055.00 ns] malloced: 0x167d8
- # [1, 322655.00 ns] malloced: 0x168e0
- # [0, 349615.00 ns] wait for timer
- # [1, 353235.00 ns] wait for timer
- # [1, 866565.00 ns] Timer exception
- # [1, 880685.00 ns] done
- # [0, 1362795.00 ns] Timer exception
- # [0, 1376925.00 ns] done
- # By the different timer runtime you can see how they differently were set by the software
- # including the parts in the or1k-support-reentrancy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement