Changes between Version 22 and Version 23 of QuickStartSoclib
- Timestamp:
- Feb 17, 2010, 8:16:35 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
QuickStartSoclib
v22 v23 1 1 = MutekH quick start guide for SoCLib platform = 2 2 3 This guide explain how to run MutekH on a [wiki:Arch/Soclib SoCLib] hardware simulator. This is allow easy experimentation with advanced multi-processor programming. 3 SoCLib simulator allow easy experimentation with advanced multi-processor programming. 4 5 This guide explains how to run MutekH on a [wiki:Arch/Soclib SoCLib] hardware simulator with native processor heterogeneity support. 6 7 The SoCLib simulator used here is easy to use but has a complex internal design due to dynamic processors model instanciation. 8 This is really convenient if you want to experiment with different processors without modifying the simulator. This simulator allows processor heterogeneity. 9 10 If you are interested in learning SoCLib hardware simulator, or plan to use SoCLib to model your own platform, you have better reading the [wiki:Arch/Soclib/Tutorial MutekH/SocCLib tutorial] first. 4 11 5 12 You are '''highly encouraged''' to first follow the [wiki:QuickStartUnix MutekH as Unix process quick start guide] which introduce more basic concepts. 6 7 MutekH for SoCLib can be compiled for Mips, Arm, PowerPC processors. Other processors are available with different platforms.8 13 9 14 == The SoCLib platform == … … 13 18 other relationships between the large set of available configuration tokens. 14 19 15 The example below explains how to setup a SoCLib hardware simulator with 4 RISC processor (Mips, Arm or PowerPC).16 17 [[BR]][[BR]][[Image(arch_4proc.gif,nolink)]][[BR]][[BR]]18 19 20 === Getting SoCLib === 20 21 21 We now need to have a working SoCLib install. SoCLib installation is explained here: https://www.soclib.fr/trac/dev/wiki/InstallationNotes 22 We now need to have a working SoCLib install. SoCLib installation is explained here: soclib:InstallationNotes 23 24 Moreover, you'll need the MutekH source tree and its prerequisites. See InstallationNotes 22 25 23 26 === SoCLib platform description === … … 31 34 32 35 {{{ 33 svn co -r 1024https://www-asim.lip6.fr/svn/mutekh/trunk/mutekh36 svn co https://www-asim.lip6.fr/svn/mutekh/trunk/mutekh 34 37 }}} 35 38 36 39 === Writing the example source code === 37 40 38 Note: This example is available directly from {{{examples/hello}}} directory in source tree: [source:trunk/mutekh/examples/hello] 41 Note: This example is available directly from {{{examples/hello_het}}} directory in source tree: [source:trunk/mutekh/examples/hello_het] 42 43 What you need to do: 39 44 40 45 - Writing the source code in `hello.c` 41 {{{42 #include <pthread.h>43 44 pthread_mutex_t m;45 pthread_t a, b;46 47 void *f(void *param)48 {49 while (1)50 {51 pthread_mutex_lock(&m);52 printf("(%i) %s", cpu_id(), param);53 pthread_mutex_unlock(&m);54 pthread_yield();55 }56 }57 int main()58 {59 pthread_mutex_init(&m, NULL);60 pthread_create(&a, NULL, f, "Hello ");61 pthread_create(&b, NULL, f, "World\n");62 }63 }}}64 65 46 - Writing the `Makefile` 66 {{{ 67 objs = hello.o 68 }}} 47 - Writing the `platform-mips+arm.dts` to describe hardware, see [FlattenedDeviceTree Flattened device trees]. 69 48 70 49 === Getting the cross-compilers === … … 74 53 $ tools/crossgen.mk 75 54 $ tools/crossgen.mk all TARGET=mipsel-unknown-elf 55 $ tools/crossgen.mk all TARGET=arm-unknown-elf 76 56 }}} 77 57 78 58 === Writing the MutekH configuration === 79 59 80 The MutekH configuration for the 4 Mips processors platform is in the [source:trunk/mutekh/examples/hello/config_soclib_mipsel] file.60 The MutekH configuration for heterogeneous Mips/Arm processors platform is in the [source:trunk/mutekh/examples/hello_het/config] file. 81 61 82 62 Have a look to the BuildSystem page for more information about configuration system and configuration file format. … … 87 67 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 configuration file. It will let the kernel get the platform layout description from a FlattenedDeviceTree which will be built-in. 88 68 89 Therefore, we have to provide the platform description FlattenedDeviceTree and add it to the Makefile to have it compiled in. 90 The `hello/Makefile` file must contain: 69 === Compiling the application along with MutekH === 91 70 92 71 {{{ 93 objs = hello.o platform-mips.o 94 }}} 95 96 The current FlattenedDeviceTree source file is [source:trunk/mutekh/examples/hello/platform-mips.dts]. 97 98 === Compiling the application along with MutekH === 99 100 The MutekH kernel and the application may be built out of the source tree. 101 102 Change to the SoCLib platform directory and apply the following steps to experiment 103 with out of tree compilation. You have to setup the following variables: 104 105 `MUTEKH_DIR`:: 106 Path to MutekH source tree 107 `APP`:: 108 Path to application source 109 `CONFIG`:: 110 MutekH configuration file name 111 112 {{{ 113 $ cd soclib/soclib/platform/topcells/caba-vgmn-mutekh_tutorial 114 $ make MUTEKH_DIR=~/mutekh/ APP=~/mutekh/examples/hello CONFIG=config_soclib_mipsel all 72 $ cd path/to/mutekh 73 $ make kernel-het CONF=examples/hello_het/config BUILD=arm:mipsel 115 74 }}} 116 75 117 76 This will build the MutekH kernel along with the application. 118 You can still build MutekH separately as explained in the first part.The simulator can then be built using:77 The simulator can then be built using: 119 78 120 79 {{{ 121 $ cd soclib/soclib/platform/topcells/caba-vgmn-mutekh_tutorial80 $ cd path/to/soclib/soclib/platform/topcells/caba-vgmn-mutekh_tutorial 122 81 $ make system.x 123 82 }}} … … 127 86 The simulator needs the MutekH executable file name and the processor type and the number of processors of this type: 128 87 {{{ 129 $ ./system.x mutekh/kernel-soclib-mips.out:mips32:4 88 $ cd path/to/soclib/soclib/platform/topcells/caba-vgmn-mutekh_tutorial 89 $ ./system.x mips32el:2 path/to/mutekh/kernel-mipsel.het.out arm:2 path/to/mutekh/kernel-arm.het.out 130 90 }}} 131 91