Changes between Version 6 and Version 7 of Arch/Soclib/Tutorial


Ignore:
Timestamp:
Mar 24, 2010, 11:19:01 AM (14 years ago)
Author:
Nicolas Pouillon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Arch/Soclib/Tutorial

    v6 v7  
    1010Other processors are available with different platforms.
    1111
     12In order to begin easy, we'll use only the Arm-v6k ISS model available in SoCLib in this
     13tutorial. Changing the Arm to a Mips or a PowerPC is left as an exercise to the reader.
     14
    1215== The SoCLib platform ==
    1316
     
    1619other relationships between the large set of available configuration tokens.
    1720
    18 The example below explains how to setup a SoCLib hardware simulator with 4 RISC processor (Mips, Arm or PowerPC).
     21The example below explains how to setup a SoCLib hardware simulator with 4 RISC processors.
    1922
    2023[[BR]][[BR]][[Image(arch.png,nolink)]][[BR]][[BR]]
     
    3134
    3235Even if it is available in newer revisions, this tutorial has been tested
    33 and is expected to work well at revision 1269,
     36and is expected to work well at revision 1488,
    3437please try with this one if you have troubles with the last revision.
    3538
    3639{{{
    37 svn co -r 1269 https://www.mutekh.org/svn/mutekh/trunk/mutekh
     40svn co -r 1488 https://www.mutekh.org/svn/mutekh/trunk/mutekh
    3841}}}
    3942
    4043=== Writing the example source code ===
    4144
    42 Note: This example is available directly from [source:trunk/mutekh/examples/hello@1269 examples/hello] directory in source tree.
     45Note: This example is available directly from [source:trunk/mutekh/examples/hello@1488 examples/hello] directory in source tree.
    4346
    4447 * Writing the source code in `hello.c`
     
    7780The MutekH configuration for the hello application is in the [source:trunk/mutekh/examples/hello/config examples/hello/config] file.
    7881
    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@1269 examples/common] directory for the platform definitions.
     82This 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.
    8083
    8184Have a look to the BuildSystem page for more information about configuration system and configuration file format.
     
    8588=== Platform description ===
    8689
    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@1269 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.
     90The 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.
    8891
    89 The build system also compiles the correct FlattenedDeviceTree from the platform name, see [source:trunk/mutekh/examples/common/Makefile@1269 examples/common/Makefile].
     92The build system also compiles the correct FlattenedDeviceTree from the platform name, see [source:trunk/mutekh/examples/common/Makefile@1488 examples/common/Makefile].
    9093
    9194The 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].
    9697
    97 === Configuring the application along with MutekH ===
     98=== Configuring and compiling the application along with MutekH ===
    9899
    99 The MutekH kernel and the application may be built out of the source tree.
     100Change to the MutekH source directory. We are going to build a MutekH Kernel
     101with our hello application inside. We need to pass the following variables
     102to the build system:
    100103
    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`::
    109105   MutekH configuration file name
    110106 `BUILD`::
    111107   MutekH build option list (target architecture, cpu type, …)
    112108
    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
    114111
    115 Inside `config.mk`, you'll also find a `CPU` variable that determines which CPU to use in the simulator platform.
     112
    116113
    117 See the comments in `config.mk` for more information.
     114   COPY      ldscript
     115   LD out    hello-soclib-arm.out
     116BUILD DIR    .../mutekh/obj-hello-soclib-arm
     117KERNEL       hello-soclib-arm.out
     118.../mutekh/ $
     119}}}
    118120
    119 === Compiling the application along with MutekH ===
     121=== Compiling the the simulator ===
    120122
    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.
     123Now we can compile the hardware simulator which will simulate the platform we are running
     124the kernel on. Go to the platform directory, in SoCLib source tree, and run make:
    125125
    126126{{{
    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
     128caba-vgmn-mutekh_soclib_tutorial $ make
     129mkisofs -f -R -V volname -o block0.iso iso_contents
     130Total translation table size: 0
     131Total rockridge attributes bytes: 2901
     132Total directory bytes: 16384
     133Path table size(bytes): 126
     134Max brk space used 0
     135195 extents written (0 MB)
     136soclib-cc -P -p platform_desc  -o system.x
     137[-----------------------------------------=------------------------------------------------=] 0 left
     138caba-vgmn-mutekh_soclib_tutorial $
    129139}}}
    130140
    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:
     141Now you have a simulator binary named `system.x`:
    136142
    137143{{{
    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
     144caba-vgmn-mutekh_soclib_tutorial $ ls
     145Makefile  README  arch.fig  block0.iso  default_caba:-0x7c4e9665_38f32183__top.o  iso_contents  platform_desc  system.x  top.cpp
     146caba-vgmn-mutekh_soclib_tutorial $
    142147}}}
    143148
    144149== Execution ==
    145150
    146 Simply run the simulator with optional MutekH binary file:
     151Simply run the simulator passing it the MutekH binary kenrel file:
    147152{{{
    148 $ ./system.x
    149153$ ./system.x path/to/mutekh/hello-soclib-arm.out
    150154}}}
     155
     156[[Image(output.png, nolink)]]
    151157
    152158You may want to refer to other articles and documents available from the main page to go further with MutekH.