|
4 | 4 |
|
5 | 5 | This example builds a small ELF loader test case. This includes several test
|
6 | 6 | programs under ``examples/elf`` tests. These tests are build using the relocatable
|
7 |
| -ELF format and installed in a ROMFS file system. At run time, each program in |
8 |
| -the ROMFS file system is executed. Requires ``CONFIG_ELF``. Other configuration |
9 |
| -options: |
| 7 | +ELF format and installed in a configurable file system. At run time, the file system |
| 8 | +is mounted and each program is executed. Requires ``CONFIG_ELF``. |
| 9 | +Two distinct types of file systems are supported: internal (included in the NuttX binary) |
| 10 | +and external (not included in the binary). The external file systems need to be uploaded |
| 11 | +manually. For the internal file systems the sample supports the ``romfs`` and ``cromfs`` |
| 12 | +filesystems. For the external file systems any of the provided file systems can be used |
| 13 | +(``vfat``, ...), but also the ``romfs`` filesystem for which the image (``romfs.img``) is |
| 14 | +automatically generated. |
| 15 | + |
| 16 | +Configuration options: |
10 | 17 |
|
11 | 18 | - ``CONFIG_EXAMPLES_ELF_DEVMINOR`` – The minor device number of the ROMFS block
|
12 | 19 | driver. For example, the ``N`` in ``/dev/ramN``. Used for registering the RAM
|
@@ -35,28 +42,26 @@ options:
|
35 | 42 |
|
36 | 43 | If you use GCC to link, you make also need to include ``-nostdlib``.
|
37 | 44 |
|
38 |
| -3. This example also requires ``genromfs``. ``genromfs`` can be build as part of the |
39 |
| - nuttx toolchain. Or can built from the ``genromfs`` sources that can be found |
40 |
| - in the NuttX tools repository (``genromfs-0.5.2.tar.gz``). In any event, the |
41 |
| - ``PATH`` variable must include the path to the genromfs executable. |
42 |
| - |
43 |
| -4. ELF size: The ELF files in this example are, be default, quite large because |
| 45 | +3. ELF size: The ELF files in this example are, be default, quite large because |
44 | 46 | they include a lot of build garbage. You can greatly reduce the size of the
|
45 | 47 | ELF binaries are using the ``objcopy --strip-unneeded`` command to remove
|
46 | 48 | un-necessary information from the ELF files.
|
47 | 49 |
|
48 |
| -5. Simulator. You cannot use this example with the NuttX simulator on Cygwin. |
| 50 | +4. Simulator. You cannot use this example with the NuttX simulator on Cygwin. |
49 | 51 | That is because the Cygwin GCC does not generate ELF file but rather some
|
50 | 52 | Windows-native binary format.
|
51 | 53 |
|
52 | 54 | If you really want to do this, you can create a NuttX x86 buildroot toolchain
|
53 | 55 | and use that be build the ELF executables for the ROMFS file system.
|
54 | 56 |
|
55 |
| -6. Linker scripts. You might also want to use a linker scripts to combine |
| 57 | +5. Linker scripts. You might also want to use a linker scripts to combine |
56 | 58 | sections better. An example linker script is at
|
57 | 59 | ``nuttx/binfmt/elf/gnu-elf.ld``. That example might have to be tuned for
|
58 | 60 | your particular linker output to position additional sections correctly. The
|
59 | 61 | GNU LD ``LDELFFLAGS`` then might be::
|
60 | 62 |
|
61 | 63 | LDELFFLAGS = -r -e main -T$(TOPDIR)/binfmt/elf/gnu-elf.ld
|
62 | 64 |
|
| 65 | +6. When generating the ``romfs.img`` for external filesystem the image (``romfs.img``) |
| 66 | + needs to be manually copied to the start of the configured ``CONFIG_EXAMPLES_ELF_DEVPATH`` |
| 67 | + using ``openocd`` or your preferred programmer. |
0 commit comments