Advertisement
wallento

Build mor1kx multicore demo

Apr 28th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.71 KB | None | 0 0
  1. mkdir ~/tmp-mor1kx-multicore
  2.  
  3. cd ~/tmp-mor1kx-multicore
  4.  
  5. # Set your installation prefix
  6. export PREFIX=$HOME/or1k-toolchain
  7.  
  8. # PRE-pend new or1k-toolchain to PATH
  9. export PATH=$PREFIX/bin:$PATH
  10.  
  11. # Checkout toolchain repositories
  12. cd ~/tmp-mor1kx-multicore
  13. git clone -b multicore https://github.com/wallento/or1k-src
  14. git clone -b multicore https://github.com/wallento/or1k-gcc
  15.  
  16. # Build binutils, first round
  17. mkdir bld-src-stage1
  18. cd bld-src-stage1
  19. ../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
  20. make
  21. make install
  22. cd ..
  23.  
  24. # Build gcc, first round
  25. mkdir bld-gcc-stage1
  26. cd bld-gcc-stage1
  27. ../or1k-gcc/configure --target=or1k-elf --prefix=$PREFIX --enable-languages=c --disable-shared --disable-libssp
  28. make
  29. make install
  30. cd ..
  31.  
  32. # Build binutils and newlib, second round (now with gcc)
  33. mkdir bld-src-stage2
  34. cd bld-src-stage2
  35. ../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
  36. make
  37. make install
  38. cd ..
  39.  
  40. # Build gcc, second round
  41. mkdir bld-gcc-stage2
  42. cd bld-gcc-stage2
  43. ../or1k-gcc/configure --target=or1k-elf --prefix=$PREFIX --enable-languages=c,c++ --disable-shared --disable-libssp --with-newlib
  44. make
  45. make install
  46. cd ..
  47.  
  48. ##
  49. # Now you have or1k-elf-gcc with -mnewlib and -mmulticore
  50. ##
  51.  
  52. # Get FuseSoC if you don't have it
  53. # For Modelsim on a 64-bit machine you need my version
  54. git clone https://github.com/wallento/fusesoc.git
  55. cd fusesoc
  56. autoreconf -i
  57. ./configure && make
  58. cd ..
  59.  
  60. # Get modified ORPSoC
  61. git clone -b multicore-demo https://github.com/wallento/orpsoc-cores.git
  62.  
  63. # Build demo
  64. mkdir demo
  65. cd demo
  66. echo "[main]
  67. cores_root=../orpsoc-cores/cores
  68. systems_root=../orpsoc-cores/systems" > fusesoc.conf
  69.  
  70. # Before we build the hardware, we want to build the software to run
  71. mkdir sw
  72. cd sw
  73. wget http://pastebin.com/download.php?i=1dyUnygK -O hello.c
  74. or1k-elf-gcc -Wall -o hello.elf hello.c -mnewlib -mmulticore
  75. cd ..
  76.  
  77. # Build fusesoc and run demo (modelsim)
  78. export MODEL_TECH=$(dirname $(which vsim))
  79. ../fusesoc/bin/fusesoc sim --sim=modelsim mor1kx-dualcore --elf-load=$PWD/sw/hello.elf
  80.  
  81. # Build fusesoc and run demo (verilator)
  82. ../fusesoc/bin/fusesoc sim --sim=verilator mor1kx-dualcore --elf-load=$PWD/sw/hello.elf
  83.  
  84. # The software is run and output should be like (modelsim):
  85. # Program header 0: addr 0x00000000, size 0x000125E0
  86. # Program header 1: addr 0x000145E0, size 0x00000EE8
  87. # elf-loader: /home/gu45zin/tmp-mor1kx-multicore/demo/sw/hello.elf was loaded
  88. # Loading       21810 words
  89. # orpsoc_tb.dut.mor1kx0.bus_gen.ibus_bridge: Wishbone bus IF is B3_REGISTERED_FEEDBACK
  90. # orpsoc_tb.dut.mor1kx0.bus_gen.dbus_bridge: Wishbone bus IF is B3_REGISTERED_FEEDBACK
  91. # orpsoc_tb.dut.mor1kx1.bus_gen.ibus_bridge: Wishbone bus IF is B3_REGISTERED_FEEDBACK
  92. # orpsoc_tb.dut.mor1kx1.bus_gen.dbus_bridge: Wishbone bus IF is B3_REGISTERED_FEEDBACK
  93. # [0, 278955.00 ns] Hello World from core 1 of 2!
  94. # [1, 281775.00 ns] Hello World from core 2 of 2!
  95. # [0, 320055.00 ns] malloced: 0x167d8
  96. # [1, 322655.00 ns] malloced: 0x168e0
  97. # [0, 349615.00 ns] wait for timer
  98. # [1, 353235.00 ns] wait for timer
  99. # [1, 866565.00 ns] Timer exception
  100. # [1, 880685.00 ns] done
  101. # [0, 1362795.00 ns] Timer exception
  102. # [0, 1376925.00 ns] done
  103.  
  104. # By the different timer runtime you can see how they differently were set by the software
  105. # including the parts in the or1k-support-reentrancy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement