Commit Graph

247 Commits

Author SHA1 Message Date
Xiang Xiao ac53600e44 sched: Rename sched_cpu_count to sched_cpucount 2020-02-09 07:33:59 -06:00
Xiang Xiao a8de37fbec Ensure all source code end with one and only one newline
by this command:
git ls-files -z | while IFS= read -rd '' f; do tail -c1 < "$f" | read -r _ || echo >> "$f"; done
2020-02-08 07:25:56 -06:00
Masayuki Ishikawa 81f1133174 ELF64 support (#220)
* include: Introduce elf64.h and elf.h

    Added elf64.h for 64bit ELF support and moved common definitions
    from elf32.h to elf.h. Also introduced Elf_xxx to be used in
    common libraries such as binfmt.

  * binfmt, include, modlib, module: Add support for ELF64

    Elf_xxx must be used instead of Elf32_xxx to support ELF64.
    To use ELF64, CONFIG_ELF_64BIT must be enabled.

  * binfmt, modlib: Add support for relocate address

  * arch: risc-v: Add include/elf.h

  * libs: machine: Add risc-v related files.

    NOTE: Currently only supports ELF64

  * boards: maix-bit: Add elf and posix_spawn configurations

  * boards: maix-bit: Add support for module configuration
2020-02-07 17:10:23 -06:00
YAMAMOTO Takashi 486a05ed70 getopt: Fix a typo in a comment 2020-02-07 10:23:44 +08:00
Xiang Xiao adbff7de81 tools/Config.mk: add DEFINE macro like INCDIR 2020-02-03 15:06:11 -06:00
Xiang Xiao 5c80b94820 Replace #include <semaphore.h> to #include <nuttx/semaphore.h>
Since the kernel side should call nxsem_xxx instead and remove the unused inclusion
2020-02-01 08:27:30 -06:00
Xiang Xiao 80277d1630
Refine the preprocessor conditional guard style (#190) 2020-01-31 19:07:39 +01:00
Xiang Xiao 68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
YAMAMOTO Takashi ba1a150dd2 snprintf: Fix a comment typo 2020-01-29 09:04:25 +01:00
YAMAMOTO Takashi 83354983c3 Fix "with with" typos
In many cases, remove one of them.
In a few places, it looks like a typo of "width" actually.
2020-01-27 08:46:46 +01:00
Xiang Xiao 1e3f457c9e Remove TIME_EXTENDED option to more conform C standard
Gregory Nutt <gnutt@nuttx.org>

    Run all .c and .h files modified in this PR through nxstyle and correct all coding standard problems.

Xiang Xiao <xiaoxiang@xiaomi.com>

    Remove TIME_EXTENDED option to more conform C standard

    Note: the code/data size increment is small
2020-01-23 08:17:22 -06:00
chao.an c3ba541bd2 Author: Gregory Nutt <gnutt@nuttx.org>
mm/Makefile:  Same change should be applied to mm/Makefile since the mm/ build is identical to the libc/ build.
        libs/libnx/Makefile:  Same change should be applied to libnx/Makefile since the mm/ build is identical to the libc/ build.

    Author: chao.an <anchao@xiaomi.com>

        libs/libc/Makefile:  Correct the dependents path
2020-01-21 08:02:23 -06:00
Juha Niskanen a762c06ed9 Fix typos and some incorrect comments
Author: Alan Carvalho de Assis <acassis@gmail.com>

    Run nxstyle against .c and .h files and fix it

Author: Juha Niskanen <juha.niskanen@haltian.com>

    Fix typos and some incorrect comments
2020-01-20 09:32:36 -03:00
Alin Jerpelea a8d63c0cec various fixes (#49)
* libs: libc: math: Fix tanh() math functions
* drivers: mtd: smart: Fix trivial debug message in smartfs
* binfmt: libelf: Fix fd not closed on error
* binfmt: Fix stack memory leak on error
* fs: romfs: Fix private data not free on error
* sched: group: Fix reference after free memory
* sched: clock: Fix clock sync

Fix clock sync when CONFIG_RTC_HIRES is enabled
2020-01-07 09:06:02 -06:00
Xiang Xiao 6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Xiang Xiao 948c566e39 libs/libc/syslog/lib_syslog.c: Bring back the commit 2e8eba35ff 'libs/libc/syslog/lib_syslog.c: Fix syslog crash on 64bit simulation'. This has more detailed information:
https://stackoverflow.com/questions/10807310/platform-inconsistencies-with-vsprintf-and-va-list.
2019-12-05 07:17:55 -06:00
Xiang Xiao fb31d38394 libs/libc/locale/lib_localeconv.c and lib_setlocale.c: Make localeconv() and setlocale() more compliance with spec:
1. localeconvi() should return C locale not NULL by default
2. setlocale() should return "C" if new locale equals NULL
2019-11-18 11:41:32 -06:00
Xiang Xiao 111fc0c83e libs/libc/netdb/lib_getaddrinfo.c: getaddrinfo() should return EAI_FAMILY if res equals NULL. 2019-11-18 11:36:48 -06:00
Xiang Xiao 4c524407ea libs/libc/unistd/lib_getrusage.c: Add a dummy getrusage() implementation. 2019-11-17 08:48:05 -06:00
Gregory Nutt ace25a78d9 include/cxx/ctime: Remove gititimer and setitimer. These are prototyped in sys/time.h, not time.h. Alternatively, ctime could include sys/time.h. Those APIs should also be in the std namespace. 2019-11-13 14:01:25 -06:00
Gregory Nutt dbf266b9d4 libs/libc/stdio/lib_getdelim.c: Initial allocation should be larger; incremental reallocs should be smaller. Update some comments. 2019-11-13 11:45:26 -06:00
Gregory Nutt 675bf4e9b7 libs/libc/stdio/lib_getdelim.c: Make getdelim() behave per specification on OpenGroup.org. Specificailly, needs to reallocate buffer if more data is received than will fit. 2019-11-13 09:01:52 -06:00
liuhaitao 9b75ef06ea include/sys/time.h, libs/libc/unistd, sched/timer: Implement alarm(), setitimer() and getitimer() APIs. 2019-11-13 08:10:16 -06:00
Gregory Nutt 14fcacaf27 libs/libc/stdio/lib_libfgets.c: Because of how the function is defined, getline() canot be used on platforms that require CR-LF line terminations. 2019-11-12 19:43:42 -06:00
Gregory Nutt 0820af5f8d libs/libc/stdio/lib_getdelim.c: Add implementations of the POSIX functions getdelim() and getline(). 2019-11-12 18:58:50 -06:00
Gregory Nutt bda0a9c6a7 net/netlink: Fix offset in rtattr. include/net/route.h: Correct form and naming of sruct rtentry. include/netpacket/netlink.h: Add some definitions that will be needed to access routing tables. 2019-11-10 12:35:15 -06:00
Gregory Nutt 3927be2612 libs/libc/string/Make.defs: Need to include build support for files needed when CHAR_BIT != 8. 2019-11-04 16:02:50 -06:00
Guiding Li 8b92305265 This commit brings in the drivers needed to support OpenAMP. These changes were ported from https://github.com/FishsemiCode/nuttx. The current state: Most drivers do now compile but are not yet verfied.
This port was effort of a number of people, I rather arbitrarily gave authorship to Guiding Li because he has the largest number of fundamental quashed commits from the Xiamoi repository.

Squashed commit of the following:

Author: Xiang Xiao <xiaoxiang@pinecone.net>
    include/nuttx/b2c.h and libx/libc/string:  Add non-standard string functions to deal with cases where there are more than 8-bits in a type char.

Author: Gregory Nutt <gnutt@nuttx.org>
    Fix several build issues/missing definitiona needed for OpenAMP build in drivers/.
    Add OpenAMP code has been reviewed and ran through tools/nxstyle (with all reports accounted for).

Author: Xiang Xiao <xiaoxiang@xiaomi.com>
    tools/:  Fix the minor issue in Makefile

Author: Gregory Nutt <gnutt@nuttx.org>
    drivers/rptun/rptun.c:  Review for coding standard.  Run against tools/nxstyle.
    tools/LibTargets.mk:  Fix some TABs that were turned into spaces by a copy-paste.
    fs/hostfs:  Add configure and build support for hostfs RPC.
    drivers/timer:  Add configure and build support for syslog RTC.
    drivers/syslog:  Add configure and build support for syslog RPC.
    drivers/serial:  Add configure and build support for serial RPC.
    Kconfig, tools/*.mk. openamp/:  Add basic OpenAMP build support.
    drivers/rptun:  Add configure and build support for OpenAMP tunnel drivers.
    drivers/net:  Update Make.defs and Kconfig for OpenSDA support.
    Remove drivers/clk/clk-rpmsg.c drivers/power/rpmsg_regulator.c.  These depend on upstreaming support for a new subsystem based on the clk/regulator is model from Linux.  Removed because we want to separate the activities.  We will just try to get the basic OpenAMP support in place for now.
    Remove drivers/misc/misc_rpmsg.c and include/nuttx/misc/misc_rpmsg.h.  These are specific to the Xiaomi application.

Author: zhuyanlin <zhuyanlin@pinecone.net>
    This commit brings in the OpenAMP OS driver/RPC components from https://github.com/FishsemiCode/nuttx.  Initial commit is source files only.  Additional changes to Kconfig and Make.defs files still needed.

Author: Jianli Dong <dongjianli@pinecone.net>
    This commit brings in the OpenAMP OS driver/RPC components from https://github.com/FishsemiCode/nuttx.  Initial commit is source files only.  Additional changes to Kconfig and Make.defs files still needed.

Author: Guiding Li <liguiding@pinecone.net>
    This commit brings in the OpenAMP OS driver/RPC components from https://github.com/FishsemiCode/nuttx.  Initial commit is source files only.  Additional changes to Kconfig and Make.defs files still needed.
2019-11-02 11:30:33 -06:00
Xiang Xiao f23ccd5bb0 libs/libc/ Kconfig files: Disable EXECFUNCS_HAVE_SYMTAB for kernel build. The symbol table don't have any meaning for kernel build since all executable binary should be self contained. 2019-10-01 07:19:21 -06:00
Xiang Xiao 389ac36f20 libs/libc: Add CONFIG_MODLIB_SYSTEM_SYMTAB to generate the symbol table for dlopen/insmod. 2019-09-28 11:17:01 -06:00
Xiang Xiao 8e74365b96 ibs/libc, libs/symtab, tools/ build system: Move symbol table generation into libc since the address in symbol table should come from userspace binary for protect build, not kernel binary. 2019-09-28 11:14:48 -06:00
Xiang Xiao e92b4374bc libs/libc: move writev from math.csv to libc.csv 2019-09-28 10:57:03 -06:00
Juha Niskanen c3d24571fb Fix some typos. Mostly inital->initial. 2019-09-27 06:32:32 -06:00
Nathan Hartman 3aac01e843 libs/libc/machine/arm/armv7-m/arch_sqrtf.c: Fix a copy-paste typo in a #error message. 2019-09-22 16:14:30 -06:00
Juha Niskanen 5c853cd1dc libs/libc/unistd/lib_getcwd.c: remove stray sched_unlock(). Also fixes several typos. 2019-09-20 06:23:48 -06:00
Juha Niskanen e8b5dd4528 Fix use of undefined pp-token #errror, other typos. 2019-09-19 18:19:18 -06:00
Gregory Nutt ecb0b15fd0 libs/libc/math/Kconfig: Should select the NuttX float.h file automatically if the NuttX math library is selected. 2019-09-16 13:29:47 -06:00
Gregory Nutt 2925c28f8f All linker scripts: Preface all _edata defininitions with . = ALIGN(4). Otherwise, the last bytes in the .data section may not be initialized properly. Also convert all linker scripts indent in units of 8-spaces to units of 4-spaces. 2019-09-15 17:22:16 -06:00
Gregory Nutt 254a906409 libs/libc/builtin/: builtint_isavail() should not set the errno variable because this functions may be used by internal OS logic for which setting the rrno variable would be inappropriate. 2019-09-11 12:37:29 -06:00
Gregory Nutt 46d435fc65 Various cosmetic changes. 2019-09-09 14:47:47 -06:00
Nathan Hartman 91ef2ec394 Fix a few minor typos 2019-09-08 15:59:14 -06:00
Gregory Nutt 38ada48454 libc/libc/unistd/: Add stubs for setreuid(), and setregid(). NuttX does not currently support effective user/group IDs, but these stubs will support linkage of applications that expect these POSIX standard interfaces. 2019-09-03 11:35:31 -06:00
Gregory Nutt a2bf7057f6 libc/libc/unistd/: Add stubs for geteuid(), getegid(), seteuid(), and setegid(). NuttX does not currently support effective user/group IDs, but these stubs will support linkage of appliations that expect these POSIX standard interfaces. 2019-09-03 10:57:51 -06:00
Pavel Pisa f865b72433 libs/libc/libc.csv: Add ioctl() to fs_ioctl() wrapper for varidic case. 2019-08-28 07:11:02 -06:00
Gregory Nutt 5f02b0335f syscall/ and related: Fix an error found in build testing. Inconsistent conditional compilation led to link errors in certain configurations. 2019-08-27 16:41:07 -06:00
Gregory Nutt 65aabe3048 libs/symtab: move symtab/ to libs/symtab. Let's no clutter up the top level directory. Shorten CONFIG_EXECFUNCS_GENERATE_SYSTEM_SYSTAB to just CONFIG_EXECFUNCS_SYSTEM_SYMTAB. Some items in syscall/syscall.csv are only valid when CONFIG_LIB_SYSCALL is defined. That is always defined when really building the syatem calls, but causes errors in libs/symtab because they are not valid in the normal, FLAT build context. 2019-08-25 19:28:04 -06:00
Gregory Nutt da9433a4c7 Fix another warnings and an error in typing introduced in the previous commit related to BINFS in PROTECTED mode. 2019-08-25 18:37:23 -06:00
Gregory Nutt 19b94da468 Fix a couple of warnings in last commit (one was really an error). 2019-08-25 17:37:13 -06:00
Gregory Nutt f751aff7fe boards/boardctl.c and libs/libc/builtin: The BINFS file system uses the same builtin library and builtin arrays as does NSH. The builtin arrays are simple name-value pairs that map builtin function names with the user-space entry point. In the FLAT build, the builtin arrays are available everywhere via the backdoor left open by the FLAT address space. In the PROTECTED build, however, the kernel must maintain its own reference to the user-space builtin array. This commits adds those kernel globals and a new boardctl(BOARDIOC_BUILTINS) that can be used by applications to the provide the builtin list reference to the kernel. 2019-08-25 16:58:43 -06:00
Gregory Nutt 3c30cf1f05 Squashed commit of the following:
task_spawn() and posix_spawn() are NuttX OS interfaces.  In PROTECTED and KERNEL build modes, then can be reached from applications only via a system call.  Currently, the number of parameters in a system call is limited to six; these spawn function have seven parameters.  Rather than extend the maximum number of parameters across all architectures, I opted instead to marshal the seven parameters into a structure.
     *

In order to support builtin in function in protected mode, a task_spawn() system call must be supported.  Unfortunately this is overly complex because there is a (soft) limit of 6 parameters in a system call; task_spawn has seven paramters.  This is a soft limit but still difficult to extend because it involves assembly language changes to numerous architectures.  Better to get more creative.
2019-08-23 13:20:52 -06:00