nuttx-apps/system/symtab
anchao 220653f21c Squashed commit of the following:
Author: anchao <anchao@pinecone.net>

     apps/, most main() function: Correct CONFIG_BUILD_LOADABLE usage
     Loadable apps/: Correct loadable symbol table generate
     apps/system/ubloxmodem:  Fix build break
     apps/examples/ostest: start restart/waitpid/user test from main loop
     apps/nshlib:  Expand reboot and poweroff commands to include a second, optional mode argument

    Author: Gregory Nutt <gnutt@nuttx.org>

     An attempt to fix build issues.  Does not work.
     apps/examples/ostest:  Fix some inappropriate renaming of static functions introduced with recent patches.
     apps/builtin/exec_builtin.c:  Fix a error introduced by recent comments.  Found in build testing.

    Author: anchao <anchao@pinecone.net>

     apps/builtin/exec_builtin.c:  Try posix_spawn if builtin apps do not have have an entry point.
     apps/Application.mk: introduce MODULE config to simplify tristate(m)
     apps/nsh:  Change the nuttx shell module type to tristate
     apps:  Add loadable application support
     script/mksymtab:  Generate symbol table name by default
     apps/builtin:  Allow loadable applications can register with apps/builtin.
2018-08-23 11:06:15 -06:00
..
.gitignore apps/system/symtab: Fix some typos; update .gitignore 2015-08-23 12:19:52 -06:00
Kconfig Update examples/module and system/symtab to adjust to change in boardctl() and insmod() interfaces 2015-12-13 08:14:44 -06:00
Make.defs make the full tree use wildcards make.defs 2016-06-02 16:21:21 +02:00
Makefile The last change added .PRECIOUS: $(BIN) to everyway Makefile in hopes the libapps.a will not be deleted on Control-C (unproven so far). However, $(BIN) may contain back slashes in some build platforms and that causes problems for make: It can't handle the backslashes in the .PRECIOUS dependency list. $(BIN) replaced with ../../libapp.a, where the number of ../ depends on the depth of the Makefile in the apps/ source tree. 2017-08-13 11:03:17 -06:00
README.txt Squashed commit of the following: 2018-08-23 11:06:15 -06:00
symtab.c This is the Pokemon patch to change all includes fronm <apps/bla/bla.h> to "bla/bla.h" 2016-07-11 10:11:18 -06:00

symtab
======

Symbol Tables and Build Modes
-----------------------------
This directory provide support for a symbol table which provides all/most of
system and C library services/functions to the application and NSH.

Symbol tables have differing usefulness in different NuttX build modes:

  1. In the FLAT build (CONFIG_BUILD_FLAT), symbol tables are used to bind
     addresses in loaded ELF or NxFLAT modules to base code that usually
     resides in FLASH memory.  Both OS interfaces and user/application
     libraries are made available to the loaded module via symbol tables.

  2. Symbol tables may be of value in a protected build
     (CONFIG_BUILD_PROTECTED) where the newly started user task must
     share resources with other user code (but should use system calls to
     interact with the OS).

  3. But in the kernel build mode (CONFIG_BUILD_LOADABLE), only fully linked
     executables loadable via execl(), execv(), or posix_spawan() can used.
     There is no use for a symbol table with the kernel build since all
     memory resources are separate; nothing is share-able with the newly
     started process.

Creating the Canned Symbol Table
--------------------------------
The support is selected by CONFIG_SYSTEM_SYMTAB option and table has to be
prepared in advance manually.  It can be prepared from NuttX top level
directory by using the following commands:

  cd <nuttx-path>
  cat syscall/syscall.csv libc/libc.csv | sort > <apps-path>/symtab/symtab.csv
  tools/mksymtab <apps-path>/symtab/symtab.csv <apps-path>/symtab/symtab.inc

where:
  <nuttx-path> is the path to the NuttX top level build directory
  <apps-path> is the path to the top level application directory

You may want omit syscall/syscall.csv in the above command in the protected
mode.  It is optional since the system calls are provided through system
call traps.

Your board-level start up code code then needs to select the symbol table
by calling the function symtab_initialize():

  #include "system/symtab.h"
  ...
    symtab_initialize();

Code/Text Size Implications
---------------------------
The option can have substantial effect on system image size, mainly
code/text.  That is because the instructions to generate symtab.inc
above will cause EVERY interface in the NuttX RTOS and the C library to be
included into build.  Add to that the size of a huge symbol table.

In order to reduce the code/text size, you may want to manually prune the
auto-generated symtab.inc file to remove all interfaces that you do
not wish to include into the base FLASH image.