Commit Graph

40005 Commits

Author SHA1 Message Date
YAMAMOTO Takashi
4e6adefc2b sim: Use c++14 for LIBCXX
The compiler default varies among the environment.
Especially, the default std version for xcode clang doesn't work
for libcxx.

This commit just ensures to use the consistent std version
among compilers.  we can come up with a more sophisticated way
to control the version later if desiable.

clang/macOS (from xcode):

    spacetanuki% c++ -dM -E -x c++ /dev/null | grep __cplusplus
    #define __cplusplus 199711L
    spacetanuki% c++ --version
    Apple clang version 11.0.0 (clang-1100.0.33.17)
    Target: x86_64-apple-darwin18.7.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    spacetanuki%

clang/macOS (from homebrew):

    spacetanuki% /usr/local/Cellar/llvm/11.0.0/bin/clang++ -dM -E -x c++ /dev/null | grep __cplusplus
    #define __cplusplus 201402L
    spacetanuki% /usr/local/Cellar/llvm/11.0.0/bin/clang++ --version
    clang version 11.0.0
    Target: x86_64-apple-darwin18.7.0
    Thread model: posix
    InstalledDir: /usr/local/Cellar/llvm/11.0.0/bin
    spacetanuki%

gcc/ubuntu:

    root@477d94753e9b:/# c++ -dM -E -x c++ /dev/null | grep __cplusplus
    #define __cplusplus 201402L
    root@477d94753e9b:/# c++ --version
    c++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
    Copyright (C) 2019 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    root@477d94753e9b:/#
2021-01-14 04:26:12 -06:00
YAMAMOTO Takashi
27a49331fc sim: Link libc++abi for LIBCXX + macOS 2021-01-14 04:26:12 -06:00
YAMAMOTO Takashi
3fc06ff2d1 sim: Specify -fshort-wchar as NuttX wchar_t is 16-bit
* For C, wchar_t is provided by the OS. On NuttX, it's uint16_t.
  (Except wide character literals, which uses the compiler
   built-in knowledge of wchar_t.)

* For C++, wchar_t is a built-in type. It's provided by the compiler.

* The compilers built-in wchar depends on the compiler configuration.
  For the sim, the compilers are usually configured with wchar_t == int,
  which is 32-bit.

* wchar_t should be compatible between C and C++.

This commit fixes the mismatches by telling the compiler to use
16-bit wchar_t.

An alternative is to make NuttX use 32-bit wchar_t if the compiler
is configured with 32-bit wchar_t. It can increase the runtime
footprint. While it might be ok for the sim, it might be a problem
for real devices.
2021-01-14 04:26:12 -06:00
YAMAMOTO Takashi
21c091f903 esp32: Add a gdb script to show backtrace
Just for my convenience. Hopefully useful for others too.
2021-01-14 09:23:36 +01:00
David Sidrane
657088318a stm32412: Fixes pinmap CAN1 2021-01-13 11:01:44 -06:00
Nathan Hartman
095d99717b arch/stm32h7: Fix nxstyle errors
arch/arm/src/stm32h7/stm32_rcc.c:
arch/arm/src/stm32h7/stm32_rcc.h:

    * Fix nxstyle issues.
2021-01-13 11:01:03 -06:00
YAMAMOTO Takashi
ca0932f842 esp32_i2c.c: Remove useless casts 2021-01-13 11:04:59 +01:00
Xiang Xiao
e49bae1300 fs: Remove fs_dupfd and fs_dupfd2 internal functions
let's call either nx_dup/nx_dup2 or file_dup/file_dup2
instead just like other fs api: xxx->nx_xxx->file_xxx

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I1aacfb9e25dc7b3fcb0345ff7b269b1953a01e5b
2021-01-13 16:39:45 +08:00
Xiang Xiao
1e5bfa623a fs: file_dup2 shouldn't hold the file list lock
the argument passed to file_dup2 doesn't always come from task file list
so it doesn't make sense to hold the file list lock and then it is better
to do the protection in the new function files_dupfd2

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ibf02cea9b0b275e7472f9c04fd66b9242285b957
2021-01-13 16:39:45 +08:00
Xiang Xiao
985f33e42c time.h: Sprinkle strftime format attribute
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 16:39:24 +08:00
Xiang Xiao
0dc6990166 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 08:57:58 +01:00
Xiang Xiao
0536953ded Kernel module should prefer functions with nx/kmm prefix
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 08:57:58 +01:00
Nathan Hartman
15480e51cf arch/stm32h7: Fix nxstyle errors
arch/arm/src/stm32h7/stm32_qencoder.c:

    * Fix nxstyle issues.
2021-01-12 19:06:44 +01:00
Matthew Trescott
301ba3a5cd can: fix RTR ioctl and support timeout 2021-01-12 11:57:22 -06:00
Xiang Xiao
fe96250c40 fs: Make nx_vxxx and file_vxxx as internal functions
these functions are the implementation detail and then
don't need expose to external

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ief832391d5b42d1f1645907eb465631650490234
2021-01-12 17:08:22 +01:00
liang
32708ab849 arch/risc-v/bl602 : add spiflash(hardware sf controller) 2021-01-11 17:59:00 -08:00
Xiang Xiao
1604fe0b4b fs: Remove file_detach since it is unefficient to call open and file_detach
the kernel user should call file_open directly instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I5bf7f661006f5d43739bc8618abfb4b983fde78d
2021-01-11 23:47:57 +01:00
Xiang Xiao
0032ddb8bf fs: Reimplement file_open to not depend on nx_open
on the other hand, open/nx_open call file_open instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I66990a77cdeb6ff18f7bf48a65bbc7b701dad552
2021-01-11 23:47:57 +01:00
Dong Heng
7a953bb154 xtensa/esp32: Fix ESP32 SPI3 slave ops data error 2021-01-11 09:10:18 +01:00
YAMAMOTO Takashi
fc7cddee39 Deal with "sed -i" portability
An empty extension for sed -i is not widely available.

* Where it isn't available (eg. macOS's sed) "sed -i -e" will
  create a backup file with the "-e" suffix.

* Even GNU sed documentation says it's "not recommended".

This commit deals with it by:

* Replace it with a more appropriate tool (kconfig-tweak)

* Or, specify the extension (.bak)
2021-01-11 08:38:19 +01:00
Xiang Xiao
fbc68912b9 arch/sim: Simplify SYMBOL macro definition
Change-Id: I1772b65b9bbe29917885e432056f84921b562eb0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-10 11:10:09 +01:00
ligd
e772be8c8a fs/inode/fs_files.c: fix DEBUGASSERT in romfs
up_assert: Assertion failed at file:romfs/fs_romfs.c line: 643

newp->f_priv should be NULL.

Change-Id: I5f72b1329a8938ce39cf1ac5fbee561ca106f4f6
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-08 10:20:47 -06:00
Xiang Xiao
1aa69f4c73 fs: Remove the special hack for pty in nx_vopen
let's replace the content of file in place instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I538910d55815c7aec656c05dba4eab2fa1d6d964
2021-01-08 11:04:24 +08:00
Xiang Xiao
a24ff44ae6 fs: Add file_pipe function
so pty don't need call nx_pipe and then file_detach

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ibb8d108abd76bafe53897e5fca35babcf3e1bae9
2021-01-08 11:03:19 +08:00
Xiang Xiao
4d4cba41f6 Move the declaration of nx_mkfifo/nx_pipe to nuttx/fs/fs.h
the new location is better than nuttx/drivers/drivers.h
since they are part of the file system api.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-08 11:03:19 +08:00
Xiang Xiao
86fab49c46 fs: Fix the race condition in file_dup
NULL inode passed to files_allocate doesn't mark file struct in the
allocated state, so other threads which invovle in file allocation
(e.g. open or dup) may allocate the same file struct again.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I53ff876eae3c7a1e311e7f671686b73a4b4ef891
2021-01-08 11:01:46 +08:00
Xiang Xiao
b343caae4d fs: file_dup2 shouldn't destroy filep2 before the duplication of filep1 succeed
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I10956f5e32cc0add414076465c06a24a858e52bc
2021-01-08 11:01:46 +08:00
liang
2889315c20 arch/risc-v/bl602 : add pwm onshot watchdog driver. 2021-01-06 23:40:37 -08:00
Masayuki Ishikawa
84283d0911 boards: sabre-6quad: Update README.txt
Summary:
- This commit updates how to build the u-boot
- Also adds tftpboot

Impact:
- No impact

Testing:
- Tested with sabre-6quad board

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-01-06 20:18:28 -06:00
Nathan Hartman
2cfbfa8213 arch/stm32h7: Fix nxstyle errors
arch/arm/src/stm32h7/stm32_pwr.c:

    * Fix nxstyle issues.
2021-01-07 01:11:43 +01:00
Nathan Hartman
f30097d0ab arch/stm32h7: Fix nxstyle errors
arch/arm/src/stm32h7/stm32_pmstop.c:

    * Fix nxstyle issues.
2021-01-07 01:11:43 +01:00
Nathan Hartman
4c82459851 arch/stm32h7: Fix nxstyle errors
arch/arm/src/stm32h7/stm32_dma.h:

    * Fix nxstyle issues.
2021-01-07 01:11:43 +01:00
Nathan Hartman
8cc9308da7 arch/stm32h7: Fix nxstyle errors
arch/arm/src/stm32h7/chip.h:

    * Fix nxstyle issues.
2021-01-07 01:11:43 +01:00
YAMAMOTO Takashi
b3d36219e4 spiffs: Document how to generate images 2021-01-06 03:06:39 -06:00
YAMAMOTO Takashi
7305e04336 spiffs/Kconfig: Mention that CONFIG_SPIFFS_MAX_NAME is an on-flash thing 2021-01-06 03:06:39 -06:00
YAMAMOTO Takashi
3ba050a4c2 spiffs: Rename the upsteam readme to README-spiffs.md
To make a room for NuttX specific documentation.
2021-01-06 03:06:39 -06:00
YAMAMOTO Takashi
c9b783e5e6 spiffs: Prefix filenames with '/' as other implmenetations do 2021-01-06 03:06:39 -06:00
YAMAMOTO Takashi
9b7e7efeb8 spiffs_pgobj_ndxheader_s: Add a missing alignment
Withtout this change, I was not able to read images built
with the following tools:

    * https://github.com/igrr/mkspiffs
    * spiffsgen.py from ESP-IDF

Introduce a new Kconfig option, SPIFFS_COMPAT_OLD_NUTTX,
for those who prefer to keep the on-disk (bug-to-bug?) compatibility
with the older NuttX.
2021-01-06 03:06:39 -06:00
YAMAMOTO Takashi
e38463ffff fs/spiffs/src/spiffs_core.h: Appease nxstyle 2021-01-06 03:06:39 -06:00
Xiang Xiao
98382dd8db sched: Add include/sys/poll.h
since many libc implementation(e.g. glibc, freebsd) provide this header file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-06 14:23:50 +08:00
liuhaitao
82ff5b52f0 configure.sh: fix '/configure.sh -e board:config menuconfig' build break
If boardconfig changed, '/configure.sh -e board:config menuconfig'
would finally call 'make distclean menuconfig' which results in
build break. It also applies to nconfig and qconfig.

Change-Id: I44c06718cbda948932c667b9f2d1339913c9ba37
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-01-05 22:52:02 +01:00
ligd
f63db66382 mqueue: add file_mq_xx for kernel use
Change-Id: Ida12f5938388cca2f233a4cde90277a218033645
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-05 02:40:43 -06:00
ligd
3bc33572e3 mqueue: simplify the mqueue reailize
1. remove descript management in mqueue, save code size
2. use i_ops instead of i_mqueue to remove the dup logic

Change-Id: Ie88960e50ddcae9c87977c9ad65a45297c663291
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-05 02:40:43 -06:00
chao.an
c8784faf3c ctype/iscntrl: correct the control character function
all the characters placed before the space on the ASCII table
and the 0x7F character (DEL) are control characters.

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-05 01:34:36 -06:00
Masayuki Ishikawa
89406462cc sched: sched: Don't call sched_lock()/unlock() in nx_waitid()/waitpid() for SMP
Summary:
- Calling sched_lock()/unlock() is unnecessary for SMP
  because we've been using the critical section API

Impact:
- SMP only

Testing:
- Tested with smp and ostest with the following configurations
- sabre-6quad:smp (QEMU, dev board)
- spresense:smp, spresense:wifi_smp
- sim:smp, sim:ostest
- maix-bit:smp (QEMU)
- esp32-devkitc:smp (QEMU)
- lc823450-xgevk:rndis

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-01-04 20:15:36 -06:00
Nathan Hartman
4ccaedf91f arch/stm32h7: Fix nxstyle errors
arch/arm/src/stm32h7/stm32_adc.c:
arch/arm/src/stm32h7/stm32_adc.h:

    * Fix nxstyle issues.
2021-01-04 13:04:51 -06:00
RB
4e6ce1f00b Updated README.txt 2021-01-04 05:26:32 -06:00
Dong Heng
fadae0bf39 xtensa/esp32: Fix ESP32 serial UART tx ready check error 2021-01-04 09:19:53 +01:00
danguanghua
7d33f73e27 libs/libc/net: implement socketpair
N/A

Reference here:
https://www.freebsd.org/cgi/man.cgi?apropos=0&sektion=2&query=socketpair&manpath=FreeBSD+7.0-current&format=html

Change-Id: I959b4d661cd436f5d5050baf9e821db84139d482
Signed-off-by: danguanghua <danguanghua@xiaomi.com>
2021-01-03 20:56:27 -06:00
Nathan Hartman
ec0b2f063c arch/stm32h7: Fix nxstyle errors
arch/arm/src/stm32h7/stm32_bbsram.h:

    * Fix nxstyle issues.
2021-01-03 20:30:45 -06:00