Commit Graph

1270 Commits

Author SHA1 Message Date
Xiang Xiao f64da13e9b libxx: Add CXX_STANDARD to select -std=c++??
and default to "c++17"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-16 15:41:57 +02:00
lilei19 04f15d9dc1 fix the bug of strtold 2023-01-15 19:57:56 +08:00
Xiang Xiao ee9787a254 libc: Let _SC_PAGESIZE return 4096 when CONFIG_MM_PGSIZE isn't defined
since most application doesn't expect the page size equals one

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-15 08:39:19 +02:00
dongjiuzhu1 28027d0bee libc/versionsort: support versionsort and strverscmp
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-15 11:24:40 +08:00
lilei19 1f95cfdde8 fix the some else bug of strtold
I accidentally changed it when I was optimizing the code

Signed-off-by: lilei19 <lilei19@xiaomi.com>
2023-01-13 15:11:20 +02:00
Xiang Xiao 695f42f8d2 net: Move accept to libc after https://github.com/apache/nuttx/pull/8083
since accept can simply forward to kernel accept4 function

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-13 11:23:42 +02:00
lilei19 120594079a add function for strtof 2023-01-12 23:46:23 +08:00
zhanghongyu 4de3387eb2 getaddrinfo: add AI_NUMERICHOST flag handle
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-01-12 01:40:11 +08:00
Xuxingliang 431e31b6b2 libc/math: add simple implementation for sincos API
Signed-off-by: Xuxingliang <xuxingliang@xiaomi.com>
2023-01-12 00:07:44 +08:00
Xiang Xiao ef65d443ad sem: Remove PRIOINHERIT_FLAGS_ENABLE and use SEM_PRIO_INHERIT instead
and refine the code to prepare the support of new flags

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-11 17:35:28 +02:00
zhangyuan21 e34f79aa28 libc: don't redefined __ARM_ARCH_XXX when __ARM_ARCH defined
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-01-10 14:58:35 +02:00
zhangyuan21 fae5aef4fe libc: add arm64 libc function
Porting memory and string optimize functions from newlib and bionic

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-01-10 11:31:26 +08:00
zhangyuan21 f8f29c8147 libc: add risc-v libc function
Porting memory and string optimize functions from newlib and bionic

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-01-10 11:31:26 +08:00
zhangyuan21 fc9aeb8c70 libc: add armv7-r libc function
Porting memory and string optimize functions from newlib and bionic

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-01-10 11:31:26 +08:00
zhangyuan21 650f17169a libc: add armv7-a armv7-m armv8-m libc function
Porting memory and string optimize functions from newlib and bionic

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-01-10 11:31:26 +08:00
zhanghongyu e019b0d0b8 libc/net: add inet_network function
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-01-06 22:20:19 +08:00
yinshengkai 05f8c588fd libc/syslog: improve streamsyslog, add puts funtions
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-01-05 02:00:43 +08:00
Jiuzhu Dong c623ee20f1 stdlib: generate uniformly distributed pseudo-random numbers
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-04 20:53:05 +08:00
yinshengkai 275b2e70a4 syslog: fix extra line breaks in syslog when SYSLOG_COLOR_OUTPUT is enabled
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-01-02 21:22:46 +08:00
dongjiuzhu1 5826e8eeb1 libc/passwd: add pw_gecos field(userinfo)
The pw_gecos field is not specified in POSIX, but is
present on most implementations.
passwd file format:
name:uid:gid:gecos:dir:shell
ex: gdm127:133:Gnome Display Manager:/var/lib/gdm3:/bin/false

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-12-30 00:21:15 +08:00
dongjiuzhu1 8f05661a53 syslog: A trailing newline is added if none is present.
refs:
https://www.manpagez.com/man/3/syslog/

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-12-30 00:20:33 +08:00
YAMAMOTO Takashi bf7db14feb Suppress -Wsign-compare warning on a few places 2022-12-26 18:23:41 +08:00
Ville Juven 172b209f2d sched/assert: Re-implement assert() into user space
_assert is a kernel procedure, entered via system call to make the core
dump in privileged mode.

Running exit() from this context is not OK as it runs the registered
exit functions and flushes streams, which must not be done
from privileged mode as it is a security hole.

Thus, implement assert() into user space (again) and remove the exit()
call from the kernel procedure.
2022-12-22 21:07:47 +08:00
Ville Juven 3be81e649f libc/stdio: Flush streams in userspace when process exits
This fixes a long standing issue, where the kernel does flushing of file
streams, although it should not handle such streams at all.
2022-12-22 20:16:11 +08:00
Ville Juven 2ed51d026c fs/streams: Move the file streams from the group structure into TLS
This is preparation for flushing streams from user space, like it should
be done.

- Move tg_streamlist (group, kernel space) ->
       ta_streamlist (TLS, user space)
- Access stream list via tg_info in kernel
- Access stream list via TLS in user space
- Remove / rename nxsched_get_streams -> lib_getstreams
- Remove system call for nxsched_get_streams
2022-12-22 20:16:11 +08:00
flyingfish89 035656661e 1 2022-12-22 11:52:00 +08:00
Petro Karashchenko 7f564e0d86 nuttx: add some missing FAR
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-12-21 10:56:45 +08:00
Petro Karashchenko b107e4f417 nuttx: unify MIN, MAX and ABS macro definition across the code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-12-21 09:31:28 +08:00
Xiang Xiao fd0d6a9bf5 compiler.h: Add _ between format|printf|syslog|scanf|strftime and like
align with other macro naming style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-21 01:05:19 +02:00
chao an 01eb4d586b mm/iob: iob members are initialized after allocate
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-16 09:51:53 +08:00
chao an 0c21bc4e53 netdb/dns: add support of send timeout
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-16 09:51:15 +08:00
Lee Lup Yuen b895207489 arm64/a64: Add driver for MIPI DSI
This PR adds the driver for Allwinner A64's MIPI Display Serial Interface (DSI) and MIPI Display Physical Layer (D-PHY).

This driver will be used by the upcoming Display Driver for PINE64 PinePhone.

- `include/nuttx/crc16.h`: Added 16-bit CRC-CCITT

- `libs/libc/misc/Make.defs`: Added 16-bit CRC-CCITT to Makefile

- `arch/arm64/src/a64/Kconfig`: Added the Kconfig option for "A64 Peripheral Selection > MIPI DSI" (`CONFIG_A64_MIPI_DSI`), which enables the MIPI DSI Driver

- `arch/arm64/src/a64/hardware/a64_memorymap.h`: Added the Base Address for MIPI DSI

- `arch/arm64/src/a64/Make.defs`: Added the MIPI DSI Driver to the Makefile

- `libs/libc/misc/lib_crc16ccitt.c`: Compute 16-bit CRC-CCITT

- `arch/arm64/src/a64/mipi_dsi.c`, `mipi_dsi.h`: Compose MIPI DSI Packets (Long, Short, Short with Parameter)

- `arch/arm64/src/a64/a64_mipi_dsi.c`, `a64_mipi_dsi.h`: MIPI DSI Driver for Allwinner A64

- `arch/arm64/src/a64/a64_mipi_dphy.c`, `a64_mipi_dphy.h`: MIPI D-PHY Driver for Allwinner A64

- `platforms/arm/a64/boards/pinephone/index.rst`: Added MIPI DSI as supported peripheral for PinePhone

Co-Authored-By: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-12-14 22:37:32 +08:00
Xu Xingliang 252c6a1844 libc/netdb: add proto.c
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2022-12-10 02:36:24 +08:00
田昕 2719869ab2 Move _assert to kernel space.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-12-06 18:33:21 +08:00
Xiang Xiao 055f1f33eb libc/stream: Rename [lib_stream_](put|get) to [lib_stream_](putc|getc)
to make the naming style consistent with each other

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-05 14:27:55 +01:00
Xiang Xiao 4be9ec774b Don't download tarballs if a local git repo found
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-05 10:47:36 +01:00
chao an d12ddf56df arm/arm: sync ARM_THUMB support from cortex-a
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-05 01:09:31 +08:00
chao an 4b70e4ff77 arm/cortex-r: sync ARM_THUMB support from cortex-a
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-04 20:12:31 +08:00
jihandong 965566d2e8 libc/stdio: add total_len back
"The number of characters written if successful or negative value if an error occurred.
If the resulting string gets truncated due to buf_size limit, function returns the total
number of characters (not including the terminating null-byte) which would have been written,
if the limit was not imposed." --- https://en.cppreference.com/w/c/io/vfprintf

Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-12-04 17:27:49 +08:00
zouboan eaea38e0f2 libc and mm/Makefile:Fix an error caused by backslash in Windows native build
libc and mm/Makefile:Fix an error caused by backslash in Windows native build
2022-12-01 01:47:46 +08:00
flyingfish89 fa59db8cea Add Hexadecimal parsing for strtof
solve:
  almost the Hexadecimal string string->float
such as:
  code:float num;
       const char *s= "0x123p32lala";
       char *p;
       num=strtof(s,&p);
       printf("num is %f\n",num);
       printf("str is %s\n",p);
  output:num is 1249835483136.000000
         str is lala

but if the input number is much big;
like:
  code:const char *s2= "0x999999p100";
       num=strtof(s2,&p);
       printf("num is %f\n",num);
       printf("str is %s\n",p);
  corrent : num is 12760587998944832242938906880669384704.000000
  real:     num is 12760587998944800000000000000000000000.000000
it didn't have enough precision
2022-11-30 19:03:07 +08:00
flyingfish89 bb040befee optimize the code of the printf 2022-11-29 17:27:02 +08:00
ligd f243e4f268 localtime: fix deadlock when print syslog in romfs
thread1:
romfs_seek -> take romfslock -> syslog -> tzset
thread2:
sylsog -> tzset -> tz_load -> romfs_open -> deadlock

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-28 18:04:38 +08:00
田昕 9d48d86606 libc/stream:add putc interface for mtd/blk stream.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-11-28 16:37:01 +08:00
ligd 092c78d636 signal: correct signal() return value & errno
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-28 14:15:21 +08:00
ligd eef619fc46 signal: correct sigset() return value & errno
ref:
https://man7.org/linux/man-pages/man3/sigset.3.html
The dispositions for SIGKILL and SIGSTOP cannot be changed.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-28 14:15:21 +08:00
Xiang Xiao 7c7ab96b53 libc/stdio: Remove putc macro from lib_libvsprintf.c
call lib_stream_put directly instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-27 22:59:21 +01:00
Xiang Xiao 7568a0df22 libc/stdio: Don't count the output length repeatly in vsprintf_internal
let's reuse the counting from lib_outstream_s::nput instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-27 22:59:21 +01:00
Xiang Xiao 33e35c6ce3 libc/stdio: Don't set FL_[LONG|SHORT] repeatly in vsprintf_internal
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-27 22:59:21 +01:00
Xiang Xiao df6666ab5e libc/stream: Rename lib_stream_[put|get]c to lib_stream_[put|get]
keep the macro consistent with the callback name

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-27 22:59:21 +01:00