Separate CVS parsing logic from tools/mksyscall.c; Create tools/mksymtab.c to create symbol tables from CSV files

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5075 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-09-01 15:33:33 +00:00
parent d1764ac57e
commit b2db45bee3
23 changed files with 852 additions and 346 deletions

View File

@ -3243,3 +3243,7 @@
for testing the changes to the uIP web server (see apps/ChangeLog.txt).
* lib/stdio/lib_perror.c: Remove CONFIG_LIBC_PERROR_DEVNAME. What was I
thinking? Arbitrary streams cannot be shared by different tasks.
* tools/mksyscall.c, csvparser.c, and csvparser.h: Separate CSV parsing
logic from mksyscall.c into files where it can be shared.
* tools/mksymtab.c: Add a tool that can be used to convert a CSV file
into a NuttX-style symbol table.

View File

@ -8,7 +8,6 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>On-Demand Paging</i></font></big></h1>
<h2><font color="#dc143c">&gt;&gt;&gt; Under Construction &lt;&lt;&lt;</font></h2>
<p>Last Updated: August 12, 2010</p>
</td>
</tr>

View File

@ -9,8 +9,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NXFLAT</i></font></big></h1>
<h2><font color="#dc143c">&gt;&gt;&gt; Under Construction &lt;&lt;&lt;</font></h2>
<p>Last Updated: June 29, 2012</p>
<p>Last Updated: September 1, 2012</p>
</td>
</tr>
</table>
@ -90,7 +89,13 @@
<tr>
<td><br></td>
<td>
<a href="#making">1.4 Making an NXFLAT module</a>
<a href="#mksymtab">1.4 mksymtab</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#making">1.5 Making an NXFLAT module</a>
</td>
</tr>
<tr>
@ -122,7 +127,7 @@
<a name="overview"><h1>1.0 Overview</h1></a>
</td>
</tr>
</table>f
</table>
<a name="functionality"><h2>1.1 Functionality</h2></a>
@ -386,7 +391,41 @@ any following arguments.
debug output is enabled [Default: no verbose output].
</pre></ul>
<a name="making"><h2>1.4 Making an NXFLAT module</h2></a>
<a name="mksymtab"><h2>1.4 mksymtab</h2></a>
<p>
There is a small helper program available in <code>nuttx/tools</code> call <code>mksymtab</code>.
<code>mksymtab</code> can be sued to generate symbol tables for the NuttX base code that would be usable by the typical NXFLAT application.
<code>mksymtab</code> builds symbol tables from common-separated value (CSV) files.
In particular, the CSV files:
</p>
<ol>
<li>
<code>nuttx/syscall/syscall.csv</code> that describes the NuttX RTOS interface, and
</li>
<li>
<code>nuttx/lib/lib/csv</code> that describes the NuttX C library interface.
</li>
</ol>
<ul><pre>
USAGE: ./mksymtab &lt;cvs-file&gt; &lt;symtab-file&gt;
Where:
&lt;cvs-file&gt; : The path to the input CSV file
&lt;symtab-file&gt;: The path to the output symbol table file
-d : Enable debug output
</pre></ul>
<p>
For example,
</p>
<ul><pre>
cd nuttx/tools
cat ../syscall/syscall.csv ../lib/lib.csv | sort >tmp.csv
./mksymtab.exe tmp.csv tmp.c
</pre></ul>
<a name="making"><h2>1.5 Making an NXFLAT module</h2></a>
<p>
Below is a snippet from an NXFLAT make file (simplified from NuttX
@ -639,8 +678,7 @@ any following arguments.
<p>
<ul><pre>
ldr r1, .L0 <-- Fetch the offset to 'x'
ldr r0, [r10, r1] <-- Load the value of 'x' with PIC
offset
ldr r0, [r10, r1] <-- Load the value of 'x' with PIC offset`
...
.L0: .word x <-- Offset to 'x'
</pre></ul>
@ -652,8 +690,7 @@ any following arguments.
<ul><pre>
ldr r1, .L0 <-- Fetch the offset to the GOT entry
ldr r1, [r10,r1] <-- Fetch the (relocated) address
of 'x' from the GOT
ldr r1, [r10,r1] <-- Fetch the (relocated) address of 'x' from the GOT
ldr r0, [r1, #0] <-- Fetch the value of 'x'
...
.L1 .word x(GOT) <-- Offset to entry in the GOT
@ -667,9 +704,9 @@ any following arguments.
execution time.
</p>
<p>
NXFLAT (like <a href="http://xflat.sourceforge.net/">XFLAT</a>) can work even better with
NXFLAT (like <a href="http://xflat.sourceforge.net/">XFLAT</a>) can work even better without
the GOT.
Patches again older version of GCC exist to eliminate the GOT indirections.
Patches against older version of GCC exist to eliminate the GOT indirections.
Several are available <a href="http://xflat.cvs.sourceforge.net/viewvc/xflat/xflat/gcc/">here</a>
if you are inspired to port them to a new GCC version.
</p>
@ -735,7 +772,7 @@ any following arguments.
<a href="http://xflat.cvs.sourceforge.net/viewvc/*checkout*/xflat/xflat/gcc/README?revision=1.1.1.1">XFLAT discussion</a>.
</p>
<p>
Patches again older version of GCC exist to correct this GCC behavior.
Patches against older version of GCC exist to correct this GCC behavior.
Several are available <a href="http://xflat.cvs.sourceforge.net/viewvc/xflat/xflat/gcc/">here</a>
if you are inspired to port them to a new GCC version.
</p>

View File

@ -7,6 +7,7 @@ Table of Contents
o Summary of Files
o Supported Architectures
o Configuring NuttX
o Building Symbol Tables
Board-Specific Configurations
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -1805,3 +1806,26 @@ command line like:
cd tools
./configure.sh -a <app-dir> <board-name>/<config-dir>
Building Symbol Tables
^^^^^^^^^^^^^^^^^^^^^^
Symbol tables are needed at several of the binfmt interfaces in order to bind
a module to the base code. These symbol tables can be tricky to create and
will probably have to be tailored for any specific application, balancing
the number of symbols and the size of the symbol table against the symbols
required by the applications.
The top-level System.map file is one good source of symbol information
(which, or course, was just generated from the top-level nuttx file
using the GNU 'nm' tool).
There are also common-separated value (CSV) values in the source try that
provide information about symbols. In particular:
nuttx/syscall/syscall.csv - Describes the NuttX RTOS interface, and
nuttx/lib/lib.csv - Describes the NuttX C library interface.
There is a tool at nuttx/tools/mksymtab that will use these CSV files as
input to generate a generic symbol table. See nuttx/tools/README.txt for
more information about using the mksymtab tool.

View File

@ -80,3 +80,5 @@ Each type field has a format as follows:
cannot cast a union sigval to a uinptr_t either. Rather, we need
to cast a specific union member fieldname to uintptr_t.
NOTE: The tool mksymtab can be used to generate a symbol table from this CSV
file. See nuttx/tools/README.txt for further details about the use of mksymtab.

View File

@ -1,170 +1,170 @@
"_inet_ntoa","#include <arpa/inet.h>","#if !defined(CONFIG_NET_IPv6) && !defined(CONFIG_CAN_PASS_STRUCTS)","FAR char","in_addr_t"
"abort","#include <stdlib.h>","","void"
"abs","#include <stdlib.h>","","int","int"
"asprintf","#include <stdio.h>","","int","FAR char **","const char *","..."
"avsprintf","#include <stdio.h>","","int","FAR char **","const char *","va_list"
"b16atan2","#include <fixedmath.h>","","b16_t","b16_t","b16_t"
"b16cos","#include <fixedmath.h>","","b16_t","b16_t"
"b16divb16","#include <fixedmath.h>","","b16_t","b16_t","b16_t"
"b16mulb16","#include <fixedmath.h>","","b16_t","b16_t","b16_t"
"b16sin","#include <fixedmath.h>","","b16_t","b16_t"
"b16sqr","#include <fixedmath.h>","","b16_t","b16_t"
"basename","#include <libgen.h>","","FAR char","FAR char *"
"cfgetspeed","#include <termios.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","speed_t","FAR const struct termios *"
"cfsetspeed","#include <termios.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","FAR struct termios *","speed_t"
"chdir","#include <unistd.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char *"
"crc32","#include <crc32.h>","","uint32_t","FAR const uint8_t *","size_t"
"crc32part","#include <crc32.h>","","uint32_t","FAR const uint8_t *","size_t","uint32_t"
"dbg","#include <debug.h>","#if !defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG)","int","const char *","..."
"dbg_enable","#include <debug.h>","#ifdef CONFIG_DEBUG_ENABLE","void","bool"
"dirname","#include <libgen.h>","","FAR char","FAR char *"
"dq_addafter","#include <queue.h>","","void","FAR dq_entry_t *","FAR dq_entry_t *","FAR dq_queue_t *"
"dq_addbefore","#include <queue.h>","","void","FAR dq_entry_t *","FAR dq_entry_t *","FAR dq_queue_t *"
"dq_addfirst","#include <queue.h>","","void","FAR dq_entry_t *","dq_queue_t *"
"dq_addlast","#include <queue.h>","","void","FAR dq_entry_t *","dq_queue_t *"
"dq_rem","#include <queue.h>","","void","FAR dq_entry_t *","dq_queue_t *"
"dq_remfirst","#include <queue.h>","","FAR dq_entry_t","dq_queue_t *"
"dq_remlast","#include <queue.h>","","FAR dq_entry_t","dq_queue_t *"
"ether_ntoa","#include <netinet/ether.h>","","FAR char","FAR const struct ether_addr *"
"fclose","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *"
"fdopen","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR FILE","int","FAR const char *"
"fflush","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *"
"fgetc","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *"
"fgetpos","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR fpos_t *"
"fgets","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR char","FAR char *","int","FAR FILE *"
"fileno","#include <stdio.h>","","int","FAR FILE *"
"fopen","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR FILE","FAR const char *","FAR const char *"
"fprintf","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR const char *","..."
"fputc","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","int c","FAR FILE *"
"fputs","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR const char *","FAR FILE *"
"fread","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","size_t","FAR void *","size_t","size_t","FAR FILE *"
"fseek","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","long int","int"
"fsetpos","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR fpos_t *"
"ftell","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","long","FAR FILE *"
"fwrite","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","size_t","FAR const void *","size_t","size_t","FAR FILE *"
"getcwd","#include <unistd.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)","FAR char","FAR char *","size_t"
"getopt","#include <unistd.h>","","int","int","FAR char *const[]","FAR const char *"
"getoptargp","#include <unistd.h>","","FAR char *"
"getoptindp","#include <unistd.h>","","int"
"getoptoptp","#include <unistd.h>","","int"
"gets","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR char","FAR char *"
"gmtime","#include <time.h>","","struct tm","const time_t *"
"gmtime_r","#include <time.h>","","FAR struct tm","FAR const time_t *","FAR struct tm *"
"htonl","#include <arpa/inet.h>","","uint32_t","uint32_t"
"htons","#include <arpa/inet.h>","","uint16_t","uint16_t"
"imaxabs","#include <stdlib.h>","","intmax_t","intmax_t"
"inet_addr","#include <arpa/inet.h>","","in_addr_t","FAR const char "
"inet_ntoa","#include <arpa/inet.h>","#if !defined(CONFIG_NET_IPv6) && defined(CONFIG_CAN_PASS_STRUCTS)","FAR char","struct in_addr"
"inet_ntop","#include <arpa/inet.h>","","FAR const char","int","FAR const void *","FAR char *","socklen_t"
"inet_pton","#include <arpa/inet.h>","","int","int","FAR const char *","FAR void *"
"labs","#include <stdlib.h>","","long int","long int"
"lib_dumpbuffer","#include <debug.h>","","void","FAR const char *","FAR const uint8_t *","unsigned int"
"lib_lowprintf","#include <debug.h>","","int","FAR const char *","..."
"lib_rawprintf","#include <debug.h>","","int","FAR const char *","..."
"llabs","#include <stdlib.h>","#ifdef CONFIG_HAVE_LONG_LONG","long long int","long long int"
"lldbg","#include <debug.h>","#if !defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG) && defined(CONFIG_ARCH_LOWPUTC)","int","const char *","..."
"llvdbg","#include <debug.h>","#if !defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_VERBOSE) && defined(CONFIG_ARCH_LOWPUTC)","int","const char *","..."
"_inet_ntoa","arpa/inet.h","!defined(CONFIG_NET_IPv6) && !defined(CONFIG_CAN_PASS_STRUCTS)","FAR char","in_addr_t"
"abort","stdlib.h","","void"
"abs","stdlib.h","","int","int"
"asprintf","stdio.h","","int","FAR char **","const char *","..."
"avsprintf","stdio.h","","int","FAR char **","const char *","va_list"
"b16atan2","fixedmath.h","","b16_t","b16_t","b16_t"
"b16cos","fixedmath.h","","b16_t","b16_t"
"b16divb16","fixedmath.h","","b16_t","b16_t","b16_t"
"b16mulb16","fixedmath.h","","b16_t","b16_t","b16_t"
"b16sin","fixedmath.h","","b16_t","b16_t"
"b16sqr","fixedmath.h","","b16_t","b16_t"
"basename","libgen.h","","FAR char","FAR char *"
"cfgetspeed","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","speed_t","FAR const struct termios *"
"cfsetspeed","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","FAR struct termios *","speed_t"
"chdir","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char *"
"crc32","crc32.h","","uint32_t","FAR const uint8_t *","size_t"
"crc32part","crc32.h","","uint32_t","FAR const uint8_t *","size_t","uint32_t"
"dbg","debug.h","!defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG)","int","const char *","..."
"dbg_enable","debug.h","defined(CONFIG_DEBUG_ENABLE)","void","bool"
"dirname","libgen.h","","FAR char","FAR char *"
"dq_addafter","queue.h","","void","FAR dq_entry_t *","FAR dq_entry_t *","FAR dq_queue_t *"
"dq_addbefore","queue.h","","void","FAR dq_entry_t *","FAR dq_entry_t *","FAR dq_queue_t *"
"dq_addfirst","queue.h","","void","FAR dq_entry_t *","dq_queue_t *"
"dq_addlast","queue.h","","void","FAR dq_entry_t *","dq_queue_t *"
"dq_rem","queue.h","","void","FAR dq_entry_t *","dq_queue_t *"
"dq_remfirst","queue.h","","FAR dq_entry_t","dq_queue_t *"
"dq_remlast","queue.h","","FAR dq_entry_t","dq_queue_t *"
"ether_ntoa","netinet/ether.h","","FAR char","FAR const struct ether_addr *"
"fclose","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *"
"fdopen","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR FILE","int","FAR const char *"
"fflush","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *"
"fgetc","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *"
"fgetpos","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR fpos_t *"
"fgets","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR char","FAR char *","int","FAR FILE *"
"fileno","stdio.h","","int","FAR FILE *"
"fopen","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR FILE","FAR const char *","FAR const char *"
"fprintf","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR const char *","..."
"fputc","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","int c","FAR FILE *"
"fputs","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR const char *","FAR FILE *"
"fread","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","size_t","FAR void *","size_t","size_t","FAR FILE *"
"fseek","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","long int","int"
"fsetpos","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR fpos_t *"
"ftell","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","long","FAR FILE *"
"fwrite","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","size_t","FAR const void *","size_t","size_t","FAR FILE *"
"getcwd","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)","FAR char","FAR char *","size_t"
"getopt","unistd.h","","int","int","FAR char *const[]","FAR const char *"
"getoptargp","unistd.h","","FAR char *"
"getoptindp","unistd.h","","int"
"getoptoptp","unistd.h","","int"
"gets","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","FAR char","FAR char *"
"gmtime","time.h","","struct tm","const time_t *"
"gmtime_r","time.h","","FAR struct tm","FAR const time_t *","FAR struct tm *"
"htonl","arpa/inet.h","","uint32_t","uint32_t"
"htons","arpa/inet.h","","uint16_t","uint16_t"
"imaxabs","stdlib.h","","intmax_t","intmax_t"
"inet_addr","arpa/inet.h","","in_addr_t","FAR const char "
"inet_ntoa","arpa/inet.h","!defined(CONFIG_NET_IPv6) && defined(CONFIG_CAN_PASS_STRUCTS)","FAR char","struct in_addr"
"inet_ntop","arpa/inet.h","","FAR const char","int","FAR const void *","FAR char *","socklen_t"
"inet_pton","arpa/inet.h","","int","int","FAR const char *","FAR void *"
"labs","stdlib.h","","long int","long int"
"lib_dumpbuffer","debug.h","","void","FAR const char *","FAR const uint8_t *","unsigned int"
"lib_lowprintf","debug.h","","int","FAR const char *","..."
"lib_rawprintf","debug.h","","int","FAR const char *","..."
"llabs","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","long long int","long long int"
"lldbg","debug.h","!defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG) && defined(CONFIG_ARCH_LOWPUTC)","int","const char *","..."
"llvdbg","debug.h","!defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_VERBOSE) && defined(CONFIG_ARCH_LOWPUTC)","int","const char *","..."
"match","","","int","const char *","const char *"
"memccpy","#include <string.h>","","FAR void","FAR void *","FAR const void *","int c","size_t"
"memchr","#include <string.h>","","FAR void","FAR const void *","int c","size_t"
"memcmp","#include <string.h>","","int","FAR const void *","FAR const void *","size_t"
"memcpy","#include <string.h>","","FAR void","FAR void *","FAR const void *","size_t"
"memmove","#include <string.h>","","FAR void","FAR void *","FAR const void *","size_t"
"memset","#include <string.h>","","FAR void","FAR void *","int c","size_t"
"mktime","#include <time.h>","","time_t","const struct tm *"
"mq_getattr","#include <mqueue.h>","#ifndef CONFIG_DISABLE_MQUEUE","int","mqd_t","struct mq_attr *"
"mq_setattr","#include <mqueue.h>","#ifndef CONFIG_DISABLE_MQUEUE","int","mqd_t","const struct mq_attr *","struct mq_attr *"
"ntohl","#include <arpa/inet.h>","","uint32_t","uint32_t"
"ntohs","#include <arpa/inet.h>","","uint16_t","uint16_t"
"perror","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","void","FAR const char *"
"printf","#include <stdio.h>","","int","const char *","..."
"pthread_attr_destroy","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_attr_t *"
"pthread_attr_getinheritsched","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR const pthread_attr_t *","FAR int *"
"pthread_attr_getschedparam","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_attr_t *","FAR struct sched_param *"
"pthread_attr_getschedpolicy","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_attr_t *","int *"
"pthread_attr_getstacksize","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_attr_t *","FAR long *"
"pthread_attr_init","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_attr_t *"
"pthread_attr_setinheritsched","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_attr_t *","int"
"pthread_attr_setschedparam","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_attr_t *","FAR const struct sched_param *"
"pthread_attr_setschedpolicy","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_attr_t *","int"
"pthread_attr_setstacksize","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_attr_t *","long"
"pthread_barrierattr_destroy","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_barrierattr_t *"
"pthread_barrierattr_getpshared","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR const pthread_barrierattr_t *","FAR int *"
"pthread_barrierattr_init","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_barrierattr_t *"
"pthread_barrierattr_setpshared","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_barrierattr_t *","int"
"pthread_condattr_destroy","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_condattr_t *"
"pthread_condattr_init","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_condattr_t *"
"pthread_mutexattr_destroy","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_mutexattr_t *"
"pthread_mutexattr_getpshared","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_mutexattr_t *","FAR int *"
"pthread_mutexattr_gettype","#include <pthread.h>","#if !defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_MUTEX_TYPES)","int","const pthread_mutexattr_t *","int *"
"pthread_mutexattr_init","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_mutexattr_t *"
"pthread_mutexattr_setpshared","#include <pthread.h>","#ifndef CONFIG_DISABLE_PTHREAD","int","FAR pthread_mutexattr_t *","int "
"pthread_mutexattr_settype","#include <pthread.h>","#if !defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_MUTEX_TYPES)","int","pthread_mutexattr_t *","int"
"puts","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR const char *"
"qsort","#include <stdlib.h>","","void","void *","size_t","size_t","int(*)(const void *","const void *)"
"rand","#include <stdlib.h>","","int"
"readdir_r","#include <dirent.h>","#if CONFIG_NFILE_DESCRIPTORS > 0","int","FAR DIR *","FAR struct dirent *","FAR struct dirent **"
"memccpy","string.h","","FAR void","FAR void *","FAR const void *","int c","size_t"
"memchr","string.h","","FAR void","FAR const void *","int c","size_t"
"memcmp","string.h","","int","FAR const void *","FAR const void *","size_t"
"memcpy","string.h","","FAR void","FAR void *","FAR const void *","size_t"
"memmove","string.h","","FAR void","FAR void *","FAR const void *","size_t"
"memset","string.h","","FAR void","FAR void *","int c","size_t"
"mktime","time.h","","time_t","const struct tm *"
"mq_getattr","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","struct mq_attr *"
"mq_setattr","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","const struct mq_attr *","struct mq_attr *"
"ntohl","arpa/inet.h","","uint32_t","uint32_t"
"ntohs","arpa/inet.h","","uint16_t","uint16_t"
"perror","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","void","FAR const char *"
"printf","stdio.h","","int","const char *","..."
"pthread_attr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *"
"pthread_attr_getinheritsched","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR const pthread_attr_t *","FAR int *"
"pthread_attr_getschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","FAR struct sched_param *"
"pthread_attr_getschedpolicy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","int *"
"pthread_attr_getstacksize","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","FAR long *"
"pthread_attr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *"
"pthread_attr_setinheritsched","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","int"
"pthread_attr_setschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","FAR const struct sched_param *"
"pthread_attr_setschedpolicy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","int"
"pthread_attr_setstacksize","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *","long"
"pthread_barrierattr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrierattr_t *"
"pthread_barrierattr_getpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR const pthread_barrierattr_t *","FAR int *"
"pthread_barrierattr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrierattr_t *"
"pthread_barrierattr_setpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrierattr_t *","int"
"pthread_condattr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_condattr_t *"
"pthread_condattr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_condattr_t *"
"pthread_mutexattr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutexattr_t *"
"pthread_mutexattr_getpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutexattr_t *","FAR int *"
"pthread_mutexattr_gettype","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_MUTEX_TYPES)","int","const pthread_mutexattr_t *","int *"
"pthread_mutexattr_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutexattr_t *"
"pthread_mutexattr_setpshared","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutexattr_t *","int "
"pthread_mutexattr_settype","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_MUTEX_TYPES)","int","pthread_mutexattr_t *","int"
"puts","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR const char *"
"qsort","stdlib.h","","void","void *","size_t","size_t","int(*)(const void *","const void *)"
"rand","stdlib.h","","int"
"readdir_r","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","int","FAR DIR *","FAR struct dirent *","FAR struct dirent **"
"rint","","","double_t","double_t"
"sched_get_priority_max","#include <sched.h>","","int","int"
"sched_get_priority_min","#include <sched.h>","","int","int"
"sem_getvalue","#include <semaphore.h>","","int","FAR sem_t *","FAR int *"
"sem_init","#include <semaphore.h>","","int","FAR sem_t *","int","unsigned int"
"sigaddset","#include <signal.h>","#ifndef CONFIG_DISABLE_SIGNALS","int","FAR sigset_t *","int"
"sigdelset","#include <signal.h>","#ifndef CONFIG_DISABLE_SIGNALS","int","FAR sigset_t *","int"
"sigemptyset","#include <signal.h>","#ifndef CONFIG_DISABLE_SIGNALS","int","FAR sigset_t *"
"sigfillset","#include <signal.h>","#ifndef CONFIG_DISABLE_SIGNALS","int","FAR sigset_t *"
"sigismember","#include <signal.h>","#ifndef CONFIG_DISABLE_SIGNALS","int","FAR const sigset_t *","int"
"snprintf","#include <stdio.h>","","int","FAR char *","size_t","const char *","..."
"sprintf","#include <stdio.h>","","int","FAR char *","const char *","..."
"sq_addafter","#include <queue.h>","","void","FAR sq_entry_t *","FAR sq_entry_t *","FAR sq_queue_t *"
"sq_addfirst","#include <queue.h>","","void","FAR sq_entry_t *","sq_queue_t *"
"sq_addlast","#include <queue.h>","","void","FAR sq_entry_t *","sq_queue_t *"
"sq_rem","#include <queue.h>","","void","FAR sq_entry_t *","sq_queue_t *"
"sq_remafter","#include <queue.h>","","FAR sq_entry_t","FAR sq_entry_t *","sq_queue_t *"
"sq_remfirst","#include <queue.h>","","FAR sq_entry_t","sq_queue_t *"
"sq_remlast","#include <queue.h>","","FAR sq_entry_t","sq_queue_t *"
"srand","#include <stdlib.h>","","void","unsigned int"
"sscanf","#include <stdio.h>","","int","const char *","const char *","..."
"strcasecmp","#include <string.h>","","int","FAR const char *","FAR const char *"
"strcasestr","#include <string.h>","","FAR char","FAR const char *","FAR const char *"
"strcat","#include <string.h>","","FAR char","FAR char *","FAR const char *"
"strchr","#include <string.h>","","FAR char","FAR const char *","int"
"strcmp","#include <string.h>","","int","FAR const char *","FAR const char *"
"strcpy","#include <string.h>","","FAR char","char *","FAR const char *"
"strcspn","#include <string.h>","","size_t","FAR const char *","FAR const char *"
"strdup","#include <string.h>","","FAR char","FAR const char *"
"strerror","#include <string.h>","","FAR const char","int"
"strftime","#include <time.h>","","size_t","char *","size_t","const char *","const struct tm *"
"strlen","#include <string.h>","","size_t","FAR const char *"
"strncasecmp","#include <string.h>","","int","FAR const char *","FAR const char *","size_t"
"strncat","#include <string.h>","","FAR char","FAR char *","FAR const char *","size_t"
"strncmp","#include <string.h>","","int","FAR const char *","FAR const char *","size_t"
"strncpy","#include <string.h>","","FAR char","char *","FAR const char *","size_t"
"strndup","#include <string.h>","","FAR char","FAR const char *","size_t"
"strnlen","#include <string.h>","","size_t","FAR const char *","size_t"
"strpbrk","#include <string.h>","","FAR char","FAR const char *","FAR const char *"
"strrchr","#include <string.h>","","FAR char","FAR const char *","int"
"strspn","#include <string.h>","","size_t","FAR const char *","FAR const char *"
"strstr","#include <string.h>","","FAR char","FAR const char *","FAR const char *"
"strtod","#include <stdlib.h>","","double_t","const char *str","char **endptr"
"strtok","#include <string.h>","","FAR char","FAR char *","FAR const char *"
"strtok_r","#include <string.h>","","FAR char","FAR char *","FAR const char *","FAR char **"
"strtol","#include <string.h>","","long","const char *","char **","int"
"strtoll","#include <stdlib.h>","#ifdef CONFIG_HAVE_LONG_LONG","long long","const char *nptr","char **endptr","int base"
"strtoul","#include <stdlib.h>","","unsigned long","const char *","char **","int"
"strtoull","#include <stdlib.h>","#ifdef CONFIG_HAVE_LONG_LONG","unsigned long long","const char *","char **","int"
"tcflush","#include <termios.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","int"
"tcgetattr","#include <termios.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","FAR struct termios *"
"tcsetattr","#include <termios.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","int","FAR const struct termios *"
"telldir","#include <dirent.h>","#if CONFIG_NFILE_DESCRIPTORS > 0","off_t","FAR DIR *"
"time","#include <time.h>","","time_t","time_t *"
"ub16divub16","#include <fixedmath.h>","","ub16_t","ub16_t","ub16_t"
"ub16mulub16","#include <fixedmath.h>","","ub16_t","ub16_t","ub16_t"
"ub16sqr","#include <fixedmath.h>","","ub16_t","ub16_t"
"ungetc","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","int","FAR FILE *"
"vdbg","#include <debug.h>","#if !defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_VERBOSE)","int","const char *","..."
"vfprintf","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","const char *","va_list"
"vprintf","#include <stdio.h>","#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR const char *","va_list"
"vsnprintf","#include <stdio.h>","","int","FAR char *","size_t","const char *","va_list"
"vsprintf","#include <stdio.h>","","int","FAR char *","const char *","va_list"
"vsscanf","#include <stdio.h>","","int","char *","const char *","va_list"
"sched_get_priority_max","sched.h","","int","int"
"sched_get_priority_min","sched.h","","int","int"
"sem_getvalue","semaphore.h","","int","FAR sem_t *","FAR int *"
"sem_init","semaphore.h","","int","FAR sem_t *","int","unsigned int"
"sigaddset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t *","int"
"sigdelset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t *","int"
"sigemptyset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t *"
"sigfillset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t *"
"sigismember","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR const sigset_t *","int"
"snprintf","stdio.h","","int","FAR char *","size_t","const char *","..."
"sprintf","stdio.h","","int","FAR char *","const char *","..."
"sq_addafter","queue.h","","void","FAR sq_entry_t *","FAR sq_entry_t *","FAR sq_queue_t *"
"sq_addfirst","queue.h","","void","FAR sq_entry_t *","sq_queue_t *"
"sq_addlast","queue.h","","void","FAR sq_entry_t *","sq_queue_t *"
"sq_rem","queue.h","","void","FAR sq_entry_t *","sq_queue_t *"
"sq_remafter","queue.h","","FAR sq_entry_t","FAR sq_entry_t *","sq_queue_t *"
"sq_remfirst","queue.h","","FAR sq_entry_t","sq_queue_t *"
"sq_remlast","queue.h","","FAR sq_entry_t","sq_queue_t *"
"srand","stdlib.h","","void","unsigned int"
"sscanf","stdio.h","","int","const char *","const char *","..."
"strcasecmp","string.h","","int","FAR const char *","FAR const char *"
"strcasestr","string.h","","FAR char","FAR const char *","FAR const char *"
"strcat","string.h","","FAR char","FAR char *","FAR const char *"
"strchr","string.h","","FAR char","FAR const char *","int"
"strcmp","string.h","","int","FAR const char *","FAR const char *"
"strcpy","string.h","","FAR char","char *","FAR const char *"
"strcspn","string.h","","size_t","FAR const char *","FAR const char *"
"strdup","string.h","","FAR char","FAR const char *"
"strerror","string.h","","FAR const char","int"
"strftime","time.h","","size_t","char *","size_t","const char *","const struct tm *"
"strlen","string.h","","size_t","FAR const char *"
"strncasecmp","string.h","","int","FAR const char *","FAR const char *","size_t"
"strncat","string.h","","FAR char","FAR char *","FAR const char *","size_t"
"strncmp","string.h","","int","FAR const char *","FAR const char *","size_t"
"strncpy","string.h","","FAR char","char *","FAR const char *","size_t"
"strndup","string.h","","FAR char","FAR const char *","size_t"
"strnlen","string.h","","size_t","FAR const char *","size_t"
"strpbrk","string.h","","FAR char","FAR const char *","FAR const char *"
"strrchr","string.h","","FAR char","FAR const char *","int"
"strspn","string.h","","size_t","FAR const char *","FAR const char *"
"strstr","string.h","","FAR char","FAR const char *","FAR const char *"
"strtod","stdlib.h","","double_t","const char *str","char **endptr"
"strtok","string.h","","FAR char","FAR char *","FAR const char *"
"strtok_r","string.h","","FAR char","FAR char *","FAR const char *","FAR char **"
"strtol","string.h","","long","const char *","char **","int"
"strtoll","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","long long","const char *nptr","char **endptr","int base"
"strtoul","stdlib.h","","unsigned long","const char *","char **","int"
"strtoull","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","unsigned long long","const char *","char **","int"
"tcflush","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","int"
"tcgetattr","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","FAR struct termios *"
"tcsetattr","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","int","FAR const struct termios *"
"telldir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","off_t","FAR DIR *"
"time","time.h","","time_t","time_t *"
"ub16divub16","fixedmath.h","","ub16_t","ub16_t","ub16_t"
"ub16mulub16","fixedmath.h","","ub16_t","ub16_t","ub16_t"
"ub16sqr","fixedmath.h","","ub16_t","ub16_t"
"ungetc","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","int","FAR FILE *"
"vdbg","debug.h","!defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_VERBOSE)","int","const char *","..."
"vfprintf","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","const char *","va_list"
"vprintf","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","int","FAR const char *","va_list"
"vsnprintf","stdio.h","","int","FAR char *","size_t","const char *","va_list"
"vsprintf","stdio.h","","int","FAR char *","const char *","va_list"
"vsscanf","stdio.h","","int","char *","const char *","va_list"

Can't render this file because it has a wrong number of fields in line 2.

View File

@ -108,6 +108,10 @@ Each type field has a format as follows:
cannot cast a union sigval to a uinptr_t either. Rather, we need
to cast a specific union member fieldname to uintptr_t.
NOTE: This CSV file is used both to support the generate of trap information,
but also for the generation of symbol tables. See nuttx/tools/README.txt
and nuttx/lib/README.txt for further information.
Auto-Generated Files
====================

View File

@ -2,7 +2,7 @@
# Makefile.export
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions

View File

@ -58,8 +58,13 @@ mkversion: mkconfig.c cfgparser.c
# mksyscall - Convert a CSV file into syscall stubs and proxies
mksyscall: mksyscall.c
@gcc $(CFLAGS) -o mksyscall mksyscall.c
mksyscall: mksyscall.c csvparser.c
@gcc $(CFLAGS) -o mksyscall mksyscall.c csvparser.c
# mksymtab - Convert a CSV file into a symbol table
mksymtab: mksymtab.c csvparser.c
@gcc $(CFLAGS) -o mksymtab mksymtab.c csvparser.c
# bdf-converter - Converts a BDF font to the NuttX font format

View File

@ -67,7 +67,7 @@ mkversion.c, cfgparser.c, and cfgparser.h
.version file in the top level directory into include/nuttx/version.h.
version.h provides version information that can be included by C files.
mksyscall.c
mksyscall.c, cvsparser.c, and cvsparser.h
This is a C file that is used to build mksyscall program. The mksyscall
program is used during the initial NuttX build by the logic in the top-
@ -89,6 +89,26 @@ mksyscall.c
accept this CVS file as input and generate all of the required proxy or
stub files as output. See syscall/README.txt for additonal information.
mksymtab.c, cvsparser.c, and cvsparser.h
This is a C file that is used to build symbol tables from common-separated
value (CSV) files. This tool is not used during the NuttX build, but
can be used as needed to generate files.
USAGE: ./mksymtab <cvs-file> <symtab-file>
Where:
<cvs-file> : The path to the input CSV file
<symtab-file>: The path to the output symbol table file
-d : Enable debug output
Example:
cd nuttx/tools
cat ../syscall/syscall.csv ../lib/lib.csv | sort >tmp.csv
./mksymtab.exe tmp.csv tmp.c
pic32mx
This directory contains build tools used only for PIC32MX platforms

View File

@ -2,7 +2,7 @@
* tools/cfgpaser.h
*
* Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions

View File

@ -2,7 +2,7 @@
# configure.sh
#
# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions

205
nuttx/tools/csvparser.c Normal file
View File

@ -0,0 +1,205 @@
/****************************************************************************
* tools/csvparser.c
*
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include "csvparser.h"
/****************************************************************************
* Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
bool g_debug;
char g_line[LINESIZE+1];
char g_parm[MAX_FIELDS][MAX_PARMSIZE];
int g_lineno;
/****************************************************************************
* Private Functions
****************************************************************************/
static char *skip_space(char *ptr)
{
while (*ptr && isspace((int)*ptr)) ptr++;
return ptr;
}
static char *copy_parm(char *src, char *dest)
{
char *start = src;
int i;
for (i = 0; i < MAX_PARMSIZE; i++)
{
if (*src == '"')
{
*dest = '\0';
return src;
}
else if (*src == '\n' || *src == '\0')
{
fprintf(stderr, "%d: Unexpected end of line: \"%s\"\n", g_lineno, start);
exit(4);
}
else
{
*dest++ = *src++;
}
}
fprintf(stderr, "%d: Parameter too long: \"%s\"\n", g_lineno, start);
exit(3);
}
static char *find_parm(char *ptr)
{
char *start = ptr;
if (*ptr != '"')
{
fprintf(stderr, "%d: I'm confused: \"%s\"\n", g_lineno, start);
exit(5);
}
ptr++;
ptr = skip_space(ptr);
if (*ptr == '\n' || *ptr == '\0')
{
return NULL;
}
else if (*ptr != ',')
{
fprintf(stderr, "%d: Expected ',': \"%s\"\n", g_lineno, start);
exit(6);
}
ptr++;
ptr = skip_space(ptr);
if (*ptr != '"')
{
fprintf(stderr, "%d: Expected \": \"%s\"\n", g_lineno, start);
exit(7);
}
ptr++;
return ptr;
}
/****************************************************************************
* Public Functions
****************************************************************************/
char *read_line(FILE *stream)
{
char *ptr;
for (;;)
{
g_line[LINESIZE] = '\0';
if (!fgets(g_line, LINESIZE, stream))
{
return NULL;
}
else
{
g_lineno++;
if (g_debug)
{
printf("Line: %s\n", g_line);
}
ptr = skip_space(g_line);
if (*ptr && *ptr != '#' && *ptr != '\n')
{
return ptr;
}
}
}
}
int parse_csvline(char *ptr)
{
int nparms;
int i;
/* Format "arg1","arg2","arg3",... Spaces will be tolerated outside of the
* quotes. Any initial spaces have already been skipped so the first thing
* should be '"'.
*/
if (*ptr != '"')
{
fprintf(stderr, "%d: Bad line: \"%s\"\n", g_lineno, g_line);
exit(2);
}
ptr++;
nparms = 0;
do
{
ptr = copy_parm(ptr, &g_parm[nparms][0]);
nparms++;
ptr = find_parm(ptr);
}
while (ptr);
if (g_debug)
{
printf("Parameters: %d\n", nparms);
for (i = 0; i < nparms; i++)
{
printf(" Parm%d: \"%s\"\n", i+1, g_parm[i]);
}
}
return nparms;
}

76
nuttx/tools/csvparser.h Normal file
View File

@ -0,0 +1,76 @@
/****************************************************************************
* tools/csvparser.h
*
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __TOOLS_CSVPARSER_H
#define __TOOLS_CSVPARSER_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdbool.h>
#include <limits.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define LINESIZE (PATH_MAX > 256 ? PATH_MAX : 256)
#define MAX_FIELDS 16
#define MAX_PARMSIZE 128
#define NAME_INDEX 0
#define HEADER_INDEX 1
#define COND_INDEX 2
#define RETTYPE_INDEX 3
#define PARM1_INDEX 4
/****************************************************************************
* Public Data
****************************************************************************/
extern bool g_debug;
extern char g_line[LINESIZE+1];
extern char g_parm[MAX_FIELDS][MAX_PARMSIZE];
extern int g_lineno;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
char *read_line(FILE *stream);
int parse_csvline(char *ptr);
#endif /* __TOOLS_CSVPARSER_H */

View File

@ -2,7 +2,7 @@
# tools/define.sh
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions

View File

@ -3,7 +3,7 @@
# tools/indent.sh
#
# Copyright (C) 2008, 2010 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions

View File

@ -3,7 +3,7 @@
# tools/link.sh
#
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions

View File

@ -3,7 +3,7 @@
# tools/mkdeps.sh
#
# Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions

View File

@ -2,7 +2,7 @@
# tools/mknulldeps.sh
#
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions

View File

@ -3,7 +3,7 @@
# tools/mkromfsimg.sh
#
# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions

277
nuttx/tools/mksymtab.c Normal file
View File

@ -0,0 +1,277 @@
/****************************************************************************
* tools/mksymtab.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include "csvparser.h"
/****************************************************************************
* Definitions
****************************************************************************/
#define MAX_HEADER_FILES 500
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
static const char *g_hdrfiles[MAX_HEADER_FILES];
static int nhdrfiles;
/****************************************************************************
* Private Functions
****************************************************************************/
static void show_usage(const char *progname)
{
fprintf(stderr, "USAGE: %s <cvs-file> <symtab-file>\n\n", progname);
fprintf(stderr, "Where:\n\n");
fprintf(stderr, " <cvs-file> : The path to the input CSV file\n");
fprintf(stderr, " <symtab-file>: The path to the output symbol table file\n");
fprintf(stderr, " -d : Enable debug output\n");
exit(EXIT_FAILURE);
}
static bool check_hdrfile(const char *hdrfile)
{
int i;
for (i = 0; i < nhdrfiles; i++)
{
if (strcmp(g_hdrfiles[i], hdrfile) == 0)
{
return true;
}
}
return false;
}
static void add_hdrfile(const char *hdrfile)
{
if (!check_hdrfile(hdrfile))
{
if (nhdrfiles > MAX_HEADER_FILES)
{
fprintf(stderr, "ERROR: Too man header files. Increase MAX_HEADER_FILES\n");
exit(EXIT_FAILURE);
}
g_hdrfiles[nhdrfiles] = strdup(hdrfile);
nhdrfiles++;
}
}
/****************************************************************************
* Public Functions
****************************************************************************/
int main(int argc, char **argv, char **envp)
{
char *csvpath;
char *symtab;
char *terminator;
char *ptr;
bool cond;
FILE *instream;
FILE *outstream;
int ch;
int i;
/* Parse command line options */
g_debug = false;
while ((ch = getopt(argc, argv, ":d")) > 0)
{
switch (ch)
{
case 'd' :
g_debug = true;
break;
case '?' :
fprintf(stderr, "Unrecognized option: %c\n", optopt);
show_usage(argv[0]);
case ':' :
fprintf(stderr, "Missing option argument, option: %c\n", optopt);
show_usage(argv[0]);
break;
fprintf(stderr, "Unexpected option: %c\n", ch);
show_usage(argv[0]);
}
}
if (optind >= argc)
{
fprintf(stderr, "Missing <cvs-file> and <symtab-file>\n");
show_usage(argv[0]);
}
csvpath = argv[optind];
optind++;
if (optind >= argc)
{
fprintf(stderr, "Missing <symtab-file>\n");
show_usage(argv[0]);
}
symtab = argv[optind];
optind++;
if (optind < argc)
{
fprintf(stderr, "Unexpected garbage at the end of the line\n");
show_usage(argv[0]);
}
/* Open the CSV file for reading */
instream = fopen(csvpath, "r");
if (!instream)
{
fprintf(stderr, "open %s failed: %s\n", csvpath, strerror(errno));
exit(EXIT_FAILURE);
}
/* Open the Symbol table file for writing */
outstream = fopen(symtab, "w");
if (!outstream)
{
fprintf(stderr, "open %s failed: %s\n", csvpath, strerror(errno));
exit(EXIT_FAILURE);
}
/* Get all of the header files that we need to include */
while ((ptr = read_line(instream)) != NULL)
{
/* Parse the line from the CVS file */
int nargs = parse_csvline(ptr);
if (nargs < PARM1_INDEX)
{
fprintf(stderr, "Only %d arguments found: %s\n", nargs, g_line);
exit(EXIT_FAILURE);
}
/* Add the header file to the list of header files we need to include */
add_hdrfile(g_parm[HEADER_INDEX]);
}
/* Back to the beginning */
rewind(instream);
/* Output up-front file boilerplate */
fprintf(outstream, "/* %s: Auto-generated symbol table. Do not edit */\n\n", symtab);
fprintf(outstream, "#include <nuttx/config.h>\n");
fprintf(outstream, "#include <nuttx/symtab.h>\n\n");
/* Output all of the require header files */
for (i = 0; i < nhdrfiles; i++)
{
fprintf(outstream, "#include <%s>\n", g_hdrfiles[i]);
}
/* Now the symbol table itself */
fprintf(outstream, "\nstruct symtab_s g_symtab[] =\n");
fprintf(outstream, "{\n");
/* Parse each line in the CVS file */
terminator = "";
while ((ptr = read_line(instream)) != NULL)
{
/* Parse the line from the CVS file */
int nargs = parse_csvline(ptr);
if (nargs < PARM1_INDEX)
{
fprintf(stderr, "Only %d arguments found: %s\n", nargs, g_line);
exit(EXIT_FAILURE);
}
/* Output any conditional compilation */
cond = (g_parm[COND_INDEX] && strlen(g_parm[COND_INDEX]) > 0);
if (cond)
{
fprintf(outstream, "%s#if %s\n", terminator, g_parm[COND_INDEX]);
terminator = "";
}
/* Output the symbol table entry */
fprintf(outstream, "%s { \"%s\", (FAR const void *)%s }",
terminator, g_parm[NAME_INDEX], g_parm[NAME_INDEX]);
terminator = ",\n";
if (cond)
{
fprintf(outstream, "%s#endif", terminator);
terminator = "\n";
}
}
fprintf(outstream, "\n};\n");
/* Close the CSV and symbol table files and exit */
fclose(instream);
fclose(outstream);
return EXIT_SUCCESS;
}

View File

@ -1,8 +1,8 @@
/****************************************************************************
* tools/mksyscall.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -41,174 +41,26 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include "csvparser.h"
/****************************************************************************
* Definitions
****************************************************************************/
#define LINESIZE (PATH_MAX > 256 ? PATH_MAX : 256)
#define MAX_FIELDS 16
#define MAX_PARMSIZE 128
#define NAME_INDEX 0
#define HEADER_INDEX 1
#define COND_INDEX 2
#define RETTYPE_INDEX 3
#define PARM1_INDEX 4
/****************************************************************************
* Private Data
****************************************************************************/
static bool g_debug;
static bool g_inline;
static char g_line[LINESIZE+1];
static char g_parm[MAX_FIELDS][MAX_PARMSIZE];
static FILE *g_stubstream;
static int g_lineno;
/****************************************************************************
* Private Functions
****************************************************************************/
static char *skip_space(char *ptr)
{
while (*ptr && isspace(*ptr)) ptr++;
return ptr;
}
static char *read_line(FILE *stream)
{
char *ptr;
for (;;)
{
g_line[LINESIZE] = '\0';
if (!fgets(g_line, LINESIZE, stream))
{
return NULL;
}
else
{
g_lineno++;
if (g_debug)
{
printf("Line: %s\n", g_line);
}
ptr = skip_space(g_line);
if (*ptr && *ptr != '#' && *ptr != '\n')
{
return ptr;
}
}
}
}
static char *copy_parm(char *src, char *dest)
{
char *start = src;
int i;
for (i = 0; i < MAX_PARMSIZE; i++)
{
if (*src == '"')
{
*dest = '\0';
return src;
}
else if (*src == '\n' || *src == '\0')
{
fprintf(stderr, "%d: Unexpected end of line: \"%s\"\n", g_lineno, start);
exit(4);
}
else
{
*dest++ = *src++;
}
}
fprintf(stderr, "%d: Parameter too long: \"%s\"\n", g_lineno, start);
exit(3);
}
static char *find_parm(char *ptr)
{
char *start = ptr;
if (*ptr != '"')
{
fprintf(stderr, "%d: I'm confused: \"%s\"\n", g_lineno, start);
exit(5);
}
ptr++;
ptr = skip_space(ptr);
if (*ptr == '\n' || *ptr == '\0')
{
return NULL;
}
else if (*ptr != ',')
{
fprintf(stderr, "%d: Expected ',': \"%s\"\n", g_lineno, start);
exit(6);
}
ptr++;
ptr = skip_space(ptr);
if (*ptr != '"')
{
fprintf(stderr, "%d: Expected \": \"%s\"\n", g_lineno, start);
exit(7);
}
ptr++;
return ptr;
}
static int parse_csvline(char *ptr)
{
int nparms;
int i;
/* Format "arg1","arg2","arg3",... Spaces will be tolerated outside of the
* quotes. Any initial spaces have already been skipped so the first thing
* should be '"'.
*/
if (*ptr != '"')
{
fprintf(stderr, "%d: Bad line: \"%s\"\n", g_lineno, g_line);
exit(2);
}
ptr++;
nparms = 0;
do
{
ptr = copy_parm(ptr, &g_parm[nparms][0]);
nparms++;
ptr = find_parm(ptr);
}
while (ptr);
if (g_debug)
{
printf("Parameters: %d\n", nparms);
for (i = 0; i < nparms; i++)
{
printf(" Parm%d: \"%s\"\n", i+1, g_parm[i]);
}
}
return nparms;
}
static bool is_vararg(const char *type, int index, int nparms)
{
if (strcmp(type,"...") == 0)
@ -719,6 +571,7 @@ static void show_usage(const char *progname)
fprintf(stderr, "\t-p : Generate proxies\n");
fprintf(stderr, "\t-s : Generate stubs\n");
fprintf(stderr, "\t-i : Generate proxies as static inline functions\n");
fprintf(stderr, "\t-d : Enable debug output\n");
exit(1);
}

View File

@ -2,7 +2,7 @@
* tools/mkversion.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions