Commit Graph

133 Commits

Author SHA1 Message Date
Gregory Nutt
533fd0636e libs/libc/lib_libvsprintf.c and Kconfig: Remove CONFIG_LIBC_PRINT_MINIMAL. The output in that configuration is unsatisfactory and inappropriate for use with NuttX. For example, the output from many NSH commands become corrupted and useless. Doesn't belong in this context. 2019-02-21 13:53:34 -06:00
Johannes
0059a5a88e libs/libc/stdio/lib_vsprintf.c and Kconfig:
- Numbered arguments now work by using two pass parsing and an argument list.
    The maximum number of numbered args is determined by CONFIG_LIBC_NL_ARGMAX
    which is then copied into NL_ARGMAX.
  - Size of pointer argument ('p') is determined before output.

include/limits.h:  Define NL_ARGMAX (as well as some of the other 'invariant
  values' per http://pubs.opengroup.org/onlinepubs/7908799/xsh/limits.h.html)
2019-02-21 13:26:33 -06:00
Gregory Nutt
146c398eff libs/libc/stdio/lib_libvsprintf.c: Fix typo: PRINTF_LEVEL, not PRINT_LEVEL. 2019-02-20 08:40:27 -06:00
Gregory Nutt
05a68d175b libs/libc/stdio/Kconfig: CONFIG_LIBC_NUMBERED_ARGS now depends on EXPERIMENTAL. Per Johannes: I tested numbered arguments on i.mx rt 1050, and it isn't working. Only on Linux/MSYS 64bit all relevant data types are size 8 bytes, and therefore my loop through the arg list is working. On 32bit systems, all is 4 bytes except floating point variables which is implicit 8 byte double. 2019-02-20 08:00:35 -06:00
Johannes
88130512b8 libs/libc/stdio/lib_libvsprintf.c: Cleaned naming and allow for leading zeros in argument number (which doesn't make sense but should be). 2019-02-19 13:08:54 -06:00
Gregory Nutt
a76e137ce2 Squashed commit of the following:
sched/init/nx_start.c:  Add support for CONFIG_BOARD_DRIVER_INITIALIZE.  If this option is selected then nx_start() will call a board-provided function board_driver_initialize() immediately after calling up_initialize().

    Rename CONFIG_BOARD_INITIALIZE to CONFIG_BOARD_LATE_INITIALIZE.

    Raname board_initialize() to board_late_initialize()
2019-02-18 15:32:00 -06:00
Johannes
77aa1f1179 libs/libc/stdio/Kconfig: Need to guard LIBC_NUMBERED_ARGS against LIBC_LEGACY_PRINTF 2019-02-18 15:26:41 -06:00
Johannes
698d942f8d libs/libc/stdio/lib_libvsprintf.c: Adds configurable support for numbered arguments. 2019-02-18 11:51:22 -06:00
Gregory Nutt
a971171695 libs/libc/stdio/Make.defs: Make that else, not #else. 2019-02-17 16:07:54 -06:00
Gregory Nutt
3ff42a846e libs/libc/stdio: Rename all nano_*.c and nano_*.h files to lib_*.c and lib_*.h to emphasize that these are now the defaults, not an optional implementation. 2019-02-17 12:29:50 -06:00
Gregory Nutt
f12eda8a05 libs/libc/stdio: Rename lib_dtoa.c to legacy_dtoa.c; rename lib_libvsprint.c to legacy_libvsprintf.c 2019-02-17 12:29:35 -06:00
Gregory Nutt
76a2f6c2a2 libs/libc/stdio: This commits makes the nano-printf the defualt logic for the printf family. The legacy printf is still available via CONFIG_LIBC_PRINT_LEGACY. This commit also modifies the nano-prinf configure: The PRINT_LEVEL is not long selectable. Instead, a not CONFIG_LIBC_PRINT_MINIMAL boolean setting was added and the PRINT_LEVEL is derived from a combination of CONFIG_LIBC_PRINT_MINIMAL, CONFIG_LIBC_FLOATINGPOINT, and CONFIG_LIBC_LONG_LONG. 2019-02-17 12:29:20 -06:00
Gregory Nutt
bc5908d9fd tools/nxstyle.c: Beef up logic that detects multiple variable definitions per line. 2019-02-17 10:57:28 -06:00
Johannes
af75330012 libs/libc/stdio/nano_libvsprintf.c: Added hh type modifier (without extending the flag variable). 2019-02-17 07:27:47 -06:00
Gregory Nutt
67b16613ba libs/libc/stdio/lib_dtoa.c: Lots of risky turmoil to get this file closer to the NuttX coding style. Seems to check out, but still risky. libs/libc/stdio/lib_libdtoa.c: A fix for the %g format. The algorithm will sometimes generate number greater than the precision of type double. This adds a check if the precision has been exceeded and logic to remove the least significant garbage. 2019-02-16 18:08:38 -06:00
Gregory Nutt
653ff2c34e Restore lib_sprintf(). It was removed because I thought was not used. But I was wrong; there is logic in drivers/syslog that depends on lib_sprintf().
This commits reverts a part of commit c271151d57.  That commit also removed lib_sscanf() which really is not needed.
2019-02-16 12:29:00 -06:00
Johannes
739561ab34 libs/libc/stdio/Make.defs: lib_dtoa.c is only used in the LIBC_CONFIG_NANO_PRINTF=n case. 2019-02-16 09:45:13 -06:00
Gregory Nutt
4bd2a9e1b2 libs/libc/stdio/nano_libvsprintf.c: Fix compile error introduced by my review of last commit. Fix some coding standard violations and a few other cosmetics. 2019-02-16 06:28:23 -06:00
Johannes
41a4a40879 libs/libc/stdio/nano_libvsprintf.c: Add long long support. CONFIG_LIBC_LONG_LONG needs at least CONFIG_NANO_PRINTLEVEL 2. Code size for compile without CONFIG_LIBC_LONG_LONG shouldn't be affected. 2019-02-15 19:10:40 -06:00
Gregory Nutt
72bc331217 Cosmetic update to some comments. 2019-02-15 18:26:06 -06:00
Gregory Nutt
c271151d57 libs/libc/stdio: Remove unused, non-standard functions lib_sscanf() and lib_sprintf(). 2019-02-15 18:01:39 -06:00
Gregory Nutt
928108036c libs/libc/stdio: In the recent changes we lost the implementation of vsscanf(). This commit restores vsscanf(). sscanf() is not just a front end for vsscanf(). 2019-02-15 17:31:58 -06:00
Gregory Nutt
d0bd4c959d arch/arm/src/tiva/hardware/tiva_ssi.h: Fix typo error found in build testing. libs/libc/stdio/lib_libsscanf.c: Fix warnings found in build testing. 2019-02-15 14:38:06 -06:00
Gregory Nutt
4dc0636f1e libs/libc/stdio: Add support for %g format which, for these purpose, is equivalent to %f except that trailing zeroes are suppressed. 2019-02-15 11:45:25 -06:00
Gregory Nutt
5739179109 Upate Kconfig comments 2019-02-15 10:04:57 -06:00
Gregory Nutt
38e93ede2b Revert "libs/libc/stdio: Fix the %f floating point output format."
The previous implementation was probably corect.  On Cygwin with GCC I see this:

int main(int argc, char **argv)
{
  printf("Value 1.2 is: [%f]\n", 1.2);
  printf("Value 0.1 is: [%f]\n", 0.1);
  printf("Value 0.0: [%f]\n", 0.0);
  printf("Value 347.6872: [%f]\n", 347.6872);
}

Generates output

Value 1.2 is: [1.200000]
Value 0.1 is: [0.100000]
Value 0.0: [0.000000]
Value 347.6872: [347.687200]

This reverts commit eb0223bc7f.
2019-02-15 10:01:44 -06:00
Gregory Nutt
eb0223bc7f libs/libc/stdio: Fix the %f floating point output format. 2019-02-15 09:56:58 -06:00
Johannes
7b9d02d496 libs/libc/stdio/lib_libvsprintf.c: No precision specifier resulted in precision 0 but should be precision 6. 2019-02-15 08:42:07 -06:00
Gregory Nutt
b8c7e5fcc0 Minor fixes to some spacing. 2019-02-14 15:57:15 -06:00
Johannes
479363ae3b libs/libc/stdio/lib_libsscanf.c: Initialized the lastc pointer to avoid the checks for NULL. Removed a bug in the floating point parsing which allowed several signs after each other. 2019-02-14 15:43:21 -06:00
Johannes
350295d009 Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org>

    TODO:  Remove 'Missing fscanf()' bug
    Clean up remaining complaints for tools/nxstyle
    Apply tools/detab, rmcr, convert-comments, lowhex, and indent.sh to the new and highly modified files.

Author: Johannes <nivus.entwicklung@gmail.com>

    - Move vscanf logic to lib_sscanf.c  Switched to stream interface (tricky, because the old implementation used massive read ahead, which isn't suitable for streams, chars already read are gone).
    - Added scanf and fscanf
    - Added hh, h, and ll modifiers
    - Fixes for standard compliance in scanf
    - Fixes for standard compliance in strto... function family (don't consume single '-' or '+', allow sign in strotul(l))
2019-02-14 07:03:02 -06:00
Gregory Nutt
efe65749ce Fix condition logic: The setup seems to support a network without sockets. That is not the case.
Squashed commit of the following:

    sched/sched/sched_getsockets.c:  Fix an error in conditional compilation.
    fs/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    Documentation/:  Remove all references to CONFIG_NSOCKET_DESCRIPTORS == 0
    include/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    libs/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    net/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    sched/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    syscall/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    tools/:  Fixups for CONFIG_NSOCKET_DESCRIPTORS no longer used to disable sockets.
2019-02-11 15:47:25 -06:00
Gregory Nutt
a64869aa67 CONFIG_NFILE_DESCRIPTORS=0 can no longer be used to disable the file system. NuttX with no file system does not make sense.
Squashed commit of the following:

    configs/:  The few configurations that formerly set CONFIG_NFILE_DESCRIPTORS=0 should not default, rather they should set the number of descriptors to 3.
    fs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    tools/:  Tools updates for changes to usage of CONFIG_NFILE_DESCRIPTORS.
    syscall/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    libs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    include/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    drivers/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    Documentation/:  Remove all references to CONFIG_NFILE_DESCRIPTORS == 0
    binfmt/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    arch/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    net/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/Kconfig:  CONFIG_NFILE_DESCRIPTORS may no longer to set to a value less than 3
    configs/:  Remove all settings for CONFIG_NFILE_DESCRIPTORS < 3
2019-02-11 12:09:26 -06:00
Gregory Nutt
675a9a170a lib_sscanf.c: Remove some redundancy in debug output. 2019-02-10 07:49:42 -06:00
Gregory Nutt
810b5de41b Update TODO list. 2019-02-10 07:49:25 -06:00
Gregory Nutt
3ba777bb27 include/: Correct naming of standard header file. Should be dlfcn.h, not dllfcn.h. I am surprised no one ever noticed before now. 2019-02-09 14:09:28 -06:00
Gregory Nutt
6a30e22ad4 Update a README; improvie some Kconfig defaults. 2019-02-09 12:19:32 -06:00
Gregory Nutt
7ac9bd671b libs/libc/stdio/Kconfig: Update some help comments. 2019-02-07 18:47:27 -06:00
Gregory Nutt
adf28d8903 libs/libc/stdio/Kconfig: CONFIG_NANO_PRINTF should depend on CONFIG_LIBC_LONG_LONG=n. Default should be y if CONFIG_DEFAULT_MALL=yi (as suggested by Alan Carvalho de Assis). 2019-02-07 17:37:43 -06:00
Alan Carvalho de Assis
38508e72b9 libs/libc/stdio/nano_libvsprintf.c: Remove not used sign variable that was stopping the compilation 2019-02-07 16:48:38 -06:00
Gregory Nutt
e5ea84c1ff libs/libc/stdio: A few more coding standard fixes for nano-printf file: all global data names must begin with g_. All structure names must end with _s. 2019-02-06 17:05:01 -06:00
Keith Packard
e05149b745 libs/libc/stdio: Add newlib-nano fprintf as an option. This fprintf code was originally adapted from AVR libc and provides improved floating point output support, including 'g' mode and making 'f' mode include digits past the decimal by default. However, this version does not have any long long support. On a demonstration cortex M4 build, this version saves about 5kB of ROM. The newlib version can be found here: https://salsa.debian.org/electronics-team/toolchains/newlib-nano . That project is GPL overall, but the newlib-nano printf portions are BSD licensed as described in the COPYING.NEWLIB file. 2019-02-06 15:50:52 -06:00
Xiang Xiao
659852acd5 libs/libc/unistd/lib_getopt.c: Add logic to reinitialize the stale context for the FLAT/PROTECTED builds. In these builds getopt() global varriables may be shared by many tasks. If any task exits the getopt() loop before all command line arguments have been parsed, then getopt() global variables will be left in a bad state. The next time getopt() is called, this logic should detect the bad state and force the state of getopt() to be re-initialized so that it can be reused. This logic is not full proof (it would fail, for example, if you tried to parse the same command line twice) but should catch the typical misuse cases. 2019-02-05 10:30:59 -06:00
Xiang Xiao
964f0ab304 aio_cancel need signal caller after the succeed and fix minor issue in the error handler 2019-01-27 09:39:33 -06:00
Xiang Xiao
fb63c0a293 sched/signal and related changes to other OS subsystems. 2019-01-27 09:28:59 -06:00
Xiang Xiao
dc8013ab76 Remove the unused libs/libc/endian/Kconfig 2019-01-27 06:58:01 -06:00
Xiang Xiao
16850297f3 libs/unistd and other affected files: Hostname support no longer depends on CONFIG_NET since the host name is also useful in the non-network environment. CONFIG_NET_HOSTNAME changed to CONFIG_LIB_HOSTNAME. 2019-01-27 06:56:16 -06:00
Gregory Nutt
c40daffb5b libs/libc/misc/lib_utsname.c: Add build date and time to uname output (like Linux). 2019-01-27 06:24:24 -06:00
ligd
d6740a6678 libs/libc/stdio/lib_libvsprintf.c: Correct justification for alternate forms of %p and %P 2019-01-27 06:22:01 -06:00
Alan Carvalho de Assis
db0b9b7c34 arch/arm/src/samd2l2 serial: Fix SAMD2L2 serial driver it needs sam_usart_enable() to work 2019-01-26 12:51:51 -06:00