Xiang Xiao
d266bfaca1
libc: lib_bsprintf reuse var instead value for string
...
to simplify the code logic
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2025-06-20 09:48:39 +08:00
Xiang Xiao
4b8a738141
libc/stream: Add support for lib_scanf
...
This commit adds support for the `lib_scanf` function, which
is a stream-oriented version of the `scanf` function.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2025-06-20 09:48:39 +08:00
Xiang Xiao
025af9d281
libc: Merge lib_vsprintf from lib_libsprintf.c into lib_libvsprintf.c
...
since all other printf variants in lib_libvsprintf.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2025-06-18 09:24:38 +08:00
Xiang Xiao
84dc88730c
libc: Move stream printf/scanf from libc/stdio to libc/stream
...
to keep all related code in one place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2025-06-18 09:24:38 +08:00
Xiang Xiao
99bd3d0f73
libc/stream: Fix the typo error
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2025-06-17 20:58:13 +08:00
yangao1
c560db04a6
stream/fileoutstream: Add open interface for coredump
...
Signed-off-by: yangao1 <yangao1@xiaomi.com>
2025-06-17 20:58:13 +08:00
yangao1
47dd21c3c1
stream: Add fileinstream support
...
This commit introduces a new fileinstream implementation
in the NuttX stream library.
Signed-off-by: yangao1 <yangao1@xiaomi.com>
2025-06-17 20:58:13 +08:00
buxiasen
0b9bd22e19
mtdoutstream: fix missing Make & cmake file
...
to fix the build break
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-06-17 20:58:13 +08:00
buxiasen
95cf3b3aa9
blk/mtdoutstream: should flush before free
...
to avoid losing the data in the buffer
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-06-17 20:58:13 +08:00
buxiasen
379f246625
mtdstream: use mtdsostream to support seek
...
Decrease memory cost, flush should not be called too frequency, for not
bytewrite mtd, will cause not able to write again in same block.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-06-17 20:58:13 +08:00
Lars Kruse
4568110d63
fix misspelled names in locally scoped code
...
These misspelled words are used in strictly local scopes.
Renaming these variables should not cause any problems.
2025-05-15 10:12:12 +08:00
ouyangxiangzhen
9f01e5c972
libc/stream: Support lowsyslog.
...
This commit added support for lowsyslog.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-04-02 12:01:46 +08:00
buxiasen
eca83c4a73
blk/mtdoutstream: use lib_sostream_s to support seek
...
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-11-30 03:08:35 +08:00
buxiasen
3e24aab208
stream_getc: use lib_stream_eof instead of EOF
...
Will case scanftest break #14778 , at " %4c%n" case.
scanf use INT_MAX cause EOF break.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-11-26 10:25:36 +08:00
chao an
238cddde3a
drivers/syslog: remove implement of syslog_putc()
...
syslog_putc() have a lot of duplicate logic with syslog_write().
remove syslog_putc() and reuse syslog_write() to simplify syslog printing.
Signed-off-by: chao an <anchao@lixiang.com>
2024-11-15 19:46:36 +08:00
buxiasen
a5459cdaca
stream: reduce int use, handle FS_LARGEFILE correctly.
...
offset int -> offset, len int -> size_t, ret int -> ssize_t
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-11-15 01:05:04 +08:00
buxiasen
2433094ebd
blk/mtdoutstream: remove mtd bytewrite support, readback before update
...
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-11-15 01:05:04 +08:00
buxiasen
d6c746e88d
blk/mtdoutstream: flush before close
...
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-11-15 01:05:04 +08:00
Xiang Xiao
11960fd8e7
libc/mtdoutstream: Fix the in insufficient erase in byte write case
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-04 08:37:31 +08:00
Xiang Xiao
cccc413cb9
libc/mtdoutstream: Remove the redundant check and compute
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-04 08:37:31 +08:00
Xiang Xiao
1e343a884b
libc/mtdoutstream: Replace stream->geo.erasesize with erasesize
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-04 08:37:31 +08:00
Xiang Xiao
fa57289d68
libc/blkoutstream: Zero the cache to avoid random data
...
and skip zero cache in lib_mtdoutstream_open since it's aleady done ih mtdoutstream_puts
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-04 08:37:31 +08:00
Xiang Xiao
00529f1626
libc/blkoutstream: Remove the redundant check and compute
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-04 08:37:31 +08:00
Xiang Xiao
9f1af300cb
libc/blkoutstream: Replace stream->geo.geo_sectorsize with sectorsize
...
and sblock with sector to make the code more readable.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-04 08:37:31 +08:00
chao an
c6591c0f49
driver/serial: remove return value of up_putc()
...
modify the prototype of up_putc(): remove the return value
The architecture code does not care about the return value of up_putc(), so removing it saves two statements:
Before: After:
de4c: e52de004 push {lr} @ (str lr, [sp, #-4]!) | de4c: e52de004 push {lr} @ (str lr, [sp, #-4]!)
de50: e24dd014 sub sp, sp, #20 | de50: e24dd014 sub sp, sp, #20
de54: e58d0004 str r0, [sp, #4 ] | de54: e58d0004 str r0, [sp, #4 ]
de58: e30030f8 movw r3, #248 @ 0xf8 | de58: e30030f8 movw r3, #248 @ 0xf8
de5c: e3423000 movt r3, #8192 @ 0x2000 | de5c: e3423000 movt r3, #8192 @ 0x2000
de60: e58d300c str r3, [sp, #12 ] | de60: e58d300c str r3, [sp, #12 ]
de64: e59d1004 ldr r1, [sp, #4 ] | de64: e59d1004 ldr r1, [sp, #4 ]
de68: e59d000c ldr r0, [sp, #12 ] | de68: e59d000c ldr r0, [sp, #12 ]
de6c: ebfffe66 bl d80c <pl011_putc> | de6c: ebfffe66 bl d80c <pl011_putc>
de70: e59d3004 ldr r3, [sp, #4 ] | de70: e28dd014 add sp, sp, #20
de74: e1a00003 mov r0, r3 | de74: e49df004 pop {pc} @ (ldr pc, [sp], #4 )
de78: e28dd014 add sp, sp, #20 |
de7c: e49df004 pop {pc} @ (ldr pc, [sp], #4 ) |
Signed-off-by: chao an <anchao@lixiang.com>
2024-10-26 13:21:29 +08:00
anjiahao
ae126a8065
lib_stdoutstream:need return write size
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-15 23:30:57 +08:00
xuxin19
351781d601
cmake:refine nuttx cmake build system fix CMake build missing part
...
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-13 02:25:06 +08:00
Xu Xingliang
64e3a1fa0b
libc/stream: add base64 encoded stream output
...
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-10-08 22:33:19 +08:00
Xu Xingliang
127527acf6
libc/stream: increase nput in hexdumpstream
...
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-10-08 22:33:19 +08:00
Alin Jerpelea
6b5dddd5d7
libs/libc: migrate to SPDX identifier
...
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-10-01 12:25:52 +08:00
xucheng5
887c6c8716
syslogstream : init value for lib_syslograwstream_s.last_ch
...
Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2024-09-27 09:59:45 +08:00
dongjiuzhu1
90d990712d
libs/libc/stdio: Optimize header file dependencies in *prinf.c file.
...
Signed-off-by: likun17 <likun17@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-23 18:22:12 +08:00
chao an
2b4ab6cd29
stream/syslograw: remove support for iob buffer in syslog
...
IOB buffer participates in the calculation of the congestion strategy
in the protocol stack, if the iob buffer is exhausted or there are
too many syslog printing tasks, the behavior of the protocol stack
and log printing will unable to determined, this PR will remove support
for iob buffer in syslog
Signed-off-by: chao an <anchao@lixiang.com>
2024-09-13 09:14:56 +08:00
yinshengkai
81fccf96db
libc/stream: add file out stream
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-25 16:54:16 -03:00
yinshengkai
0c95bf73dc
libc/stream: provide lowerout_stream default initialization function
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-25 16:54:16 -03:00
Xiang Xiao
2c9511e655
libc/stdio: Remove bforce from lib_fflush[_unlocked]
...
since all callers set bforce to true
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-29 17:09:18 +02:00
Daniel Appiagyei
5bfda12634
c++ compatibility: rename reserved c++ keywords 'public' and 'this'
2023-09-16 19:45:02 +08:00
chao an
6ee9ec7656
build: add initial cmake build system
...
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)
------------------
How to test
From within nuttx/. Configure:
cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja
(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja
This uses ninja generator (install with sudo apt install ninja-build). To build:
$ cmake --build build
menuconfig:
$ cmake --build build -t menuconfig
--------------------------
2. cmake/build: reformat the cmake style by cmake-format
https://github.com/cheshirekow/cmake_format
$ pip install cmakelang
$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done
Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
Bowen Wang
8515294caa
lib_syslograwstream: fix bug when iob alloc failed
...
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-06-17 19:33:41 +08:00
chao an
e51ec54c02
stream/hexdump: add hexdump stream to dump binary to syslog
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-25 15:22:04 +08:00
Xiang Xiao
0203839fa1
stream: Add syslogstream implementation
...
which forward the output to syslog
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-25 15:22:04 +08:00
Xiang Xiao
20ea607bd0
stream: Rename syslogstream to syslograwstream
...
to prepare a new stream implementation of syslog
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-25 15:22:04 +08:00
chao an
f75adacea6
stream/syslog: remove unnecessary ifdef CONFIG_SYSLOG_BUFFER
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-25 15:22:04 +08:00
chao an
0455167457
stream/syslog: use internal buffer to decoupling syslog with iob
...
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-24 09:53:30 +08:00
yinshengkai
1cc3fd59ed
libc/syslogstream: fix nxstyle error
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-13 22:24:53 +02:00
yinshengkai
ca290e85ea
libc: stream adds length check
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-13 22:24:53 +02:00
yinshengkai
b8e622ea5d
libc/stream: unify stream behavior
...
Return the error code when all gets occur when an error is wrong
and return immediately when obtaining any valid data
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-04 01:48:22 +08:00
yinshengkai
205ca26556
libc/streams: Implement gets/puts for all streams
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-03-03 00:49:04 +08:00
Huang Qi
b99a96a7d0
stream: Exchange name of lib_rawsostream.c and lib_rawoutstream.c
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-01 10:07:36 -03:00
Huang Qi
b96035885a
stdio: Implement simple buffered out stream for vdprintf
...
Improve performance for raw fd based printf like operation.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-01 13:08:59 +09:00