Changes between Version 6 and Version 7 of Arch/Soclib/Tutorial
- Timestamp:
- Mar 24, 2010, 11:19:01 AM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Arch/Soclib/Tutorial
v6 v7 10 10 Other processors are available with different platforms. 11 11 12 In order to begin easy, we'll use only the Arm-v6k ISS model available in SoCLib in this 13 tutorial. Changing the Arm to a Mips or a PowerPC is left as an exercise to the reader. 14 12 15 == The SoCLib platform == 13 16 … … 16 19 other relationships between the large set of available configuration tokens. 17 20 18 The example below explains how to setup a SoCLib hardware simulator with 4 RISC processor (Mips, Arm or PowerPC).21 The example below explains how to setup a SoCLib hardware simulator with 4 RISC processors. 19 22 20 23 [[BR]][[BR]][[Image(arch.png,nolink)]][[BR]][[BR]] … … 31 34 32 35 Even if it is available in newer revisions, this tutorial has been tested 33 and is expected to work well at revision 1 269,36 and is expected to work well at revision 1488, 34 37 please try with this one if you have troubles with the last revision. 35 38 36 39 {{{ 37 svn co -r 1 269https://www.mutekh.org/svn/mutekh/trunk/mutekh40 svn co -r 1488 https://www.mutekh.org/svn/mutekh/trunk/mutekh 38 41 }}} 39 42 40 43 === Writing the example source code === 41 44 42 Note: This example is available directly from [source:trunk/mutekh/examples/hello@1 269examples/hello] directory in source tree.45 Note: This example is available directly from [source:trunk/mutekh/examples/hello@1488 examples/hello] directory in source tree. 43 46 44 47 * Writing the source code in `hello.c` … … 77 80 The MutekH configuration for the hello application is in the [source:trunk/mutekh/examples/hello/config examples/hello/config] file. 78 81 79 This file only holds information about the application (here a simple pthread application) and relies upon files in the [source:trunk/mutekh/examples/common@1 269examples/common] directory for the platform definitions.82 This file only holds information about the application (here a simple pthread application) and relies upon files in the [source:trunk/mutekh/examples/common@1488 examples/common] directory for the platform definitions. 80 83 81 84 Have a look to the BuildSystem page for more information about configuration system and configuration file format. … … 85 88 === Platform description === 86 89 87 The MutekH software uses hardware enumeration to get details about available hardware in the platform, so the `CONFIG_ARCH_DEVICE_TREE` token is defined in the [source:trunk/mutekh/examples/common/platforms-soclib.conf@1 269examples/common/platforms-soclib.conf] configuration file. It will let the kernel get the platform layout description from a FlattenedDeviceTree which will be built into the kernel.90 The MutekH software uses hardware enumeration to get details about available hardware in the platform, so the `CONFIG_ARCH_DEVICE_TREE` token is defined in the [source:trunk/mutekh/examples/common/platforms-soclib.conf@1488 examples/common/platforms-soclib.conf] configuration file. It will let the kernel get the platform layout description from a FlattenedDeviceTree which will be built into the kernel. 88 91 89 The build system also compiles the correct FlattenedDeviceTree from the platform name, see [source:trunk/mutekh/examples/common/Makefile@1 269examples/common/Makefile].92 The build system also compiles the correct FlattenedDeviceTree from the platform name, see [source:trunk/mutekh/examples/common/Makefile@1488 examples/common/Makefile]. 90 93 91 94 The used FlattenedDeviceTree source file are in 92 [source:trunk/mutekh/examples/common/ examples/common/]: 93 [source:trunk/mutekh/examples/common/pf_soclib_tutorial_ppc.dts pf_soclib_tutorial_ppc.dts], 94 [source:trunk/mutekh/examples/common/pf_soclib_tutorial_arm.dts pf_soclib_tutorial_arm.dts], 95 [source:trunk/mutekh/examples/common/pf_soclib_tutorial_mips.dts pf_soclib_tutorial_mips.dts]. 95 [source:trunk/mutekh/examples/common/@1488 examples/common/]: 96 [source:trunk/mutekh/examples/common/pf_soclib_tutorial_arm.dts@1488 pf_soclib_tutorial_arm.dts]. 96 97 97 === Configuring the application along with MutekH ===98 === Configuring and compiling the application along with MutekH === 98 99 99 The MutekH kernel and the application may be built out of the source tree. 100 Change to the MutekH source directory. We are going to build a MutekH Kernel 101 with our hello application inside. We need to pass the following variables 102 to the build system: 100 103 101 Change to the SoCLib platform directory and apply the following steps to experiment 102 with out of tree compilation. You have to setup the following variables: 103 104 `MUTEKH_DIR`:: 105 Path to MutekH source tree 106 `APP`:: 107 Path to application source 108 `CONFIG`:: 104 `CONF`:: 109 105 MutekH configuration file name 110 106 `BUILD`:: 111 107 MutekH build option list (target architecture, cpu type, …) 112 108 113 These variables are already set in the `config.mk` file to target the hello demo application. 109 {{{ 110 .../mutekh/ $ make CONF=examples/hello/config BUILD=soclib-arm:pf-tutorial 114 111 115 Inside `config.mk`, you'll also find a `CPU` variable that determines which CPU to use in the simulator platform. 112 … 116 113 117 See the comments in `config.mk` for more information. 114 COPY ldscript 115 LD out hello-soclib-arm.out 116 BUILD DIR .../mutekh/obj-hello-soclib-arm 117 KERNEL hello-soclib-arm.out 118 .../mutekh/ $ 119 }}} 118 120 119 === Compiling the application along with MutekH===121 === Compiling the the simulator === 120 122 121 ==== Compiling application along with the simulator ==== 122 123 To compile the kernel with the application, just run `make` with the path to MutekH source directory from the SoCLib platform directory. 124 This single make invocation feature is specific to the this SoCLib platform. 123 Now we can compile the hardware simulator which will simulate the platform we are running 124 the kernel on. Go to the platform directory, in SoCLib source tree, and run make: 125 125 126 126 {{{ 127 $ cd soclib/soclib/platform/topcells/caba-vgmn-mutekh_soclib_tutorial 128 $ make MUTEKH_DIR=/path/to/mutekh 127 … $ cd soclib/soclib/platform/topcells/caba-vgmn-mutekh_soclib_tutorial 128 caba-vgmn-mutekh_soclib_tutorial $ make 129 mkisofs -f -R -V volname -o block0.iso iso_contents 130 Total translation table size: 0 131 Total rockridge attributes bytes: 2901 132 Total directory bytes: 16384 133 Path table size(bytes): 126 134 Max brk space used 0 135 195 extents written (0 MB) 136 soclib-cc -P -p platform_desc -o system.x 137 [-----------------------------------------=------------------------------------------------=] 0 left 138 caba-vgmn-mutekh_soclib_tutorial $ 129 139 }}} 130 140 131 This will build the MutekH kernel along with the application, and the suited simulator. 132 133 ==== Separate compilation ==== 134 135 You may also compile MutekH and application first and then the standalone SoCLib simulator: 141 Now you have a simulator binary named `system.x`: 136 142 137 143 {{{ 138 $ cd mutekh/ 139 $ make CONF=examples/hello/config BUILD=soclib-arm:pf-tutorial 140 $ cd soclib/soclib/platform/topcells/caba-vgmn-mutekh_soclib_tutorial 141 $ make system.x 144 caba-vgmn-mutekh_soclib_tutorial $ ls 145 Makefile README arch.fig block0.iso default_caba:-0x7c4e9665_38f32183__top.o iso_contents platform_desc system.x top.cpp 146 caba-vgmn-mutekh_soclib_tutorial $ 142 147 }}} 143 148 144 149 == Execution == 145 150 146 Simply run the simulator with optional MutekH binaryfile:151 Simply run the simulator passing it the MutekH binary kenrel file: 147 152 {{{ 148 $ ./system.x149 153 $ ./system.x path/to/mutekh/hello-soclib-arm.out 150 154 }}} 155 156 [[Image(output.png, nolink)]] 151 157 152 158 You may want to refer to other articles and documents available from the main page to go further with MutekH.