Commit Graph

5453 Commits

Author SHA1 Message Date
Tanushree Baindur
ab41d23d7c Apps Issue #246:Replace romdisk_register() with boardctl(BOARDIOC_ROMDISK)
files changed: examples/nxflat/nxflat_main.c
               examples/thttpd/thttpd_main.c

examples/thttpd: Fix error: unused variable 'desc'
2021-05-17 07:13:51 -05:00
Xiang Xiao
b7e9c43489 ci: change sim01 and sim02 to sim-01 and sim-02
follow up the kernel side chnage:
commit 09a0ed111c0c193a57b2a538e23c2b6a6e9cdf26
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Thu May 13 21:28:43 2021 +0800

tools/ci: Rename sim0x.dat to sim-0x.dat to align with arm-xx.dat

To avoid the build break sim0x.dat will remove in the upcoming patch

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-16 19:44:46 +01:00
YAMAMOTO Takashi
95c9007668 webclient: Fix buffer overrun in wget_parsestatus
Similarly to the fix in wget_parseheaders.
But simply always bail out as i guess it's very rare to see
that long status line.

Tested with an aritifically small CONFIG_WEBCLIENT_MAXHTTPLINE=20,
which is smaller than "HTTP/1.1 301 Moved Permanently".
2021-05-16 11:32:47 -03:00
YAMAMOTO Takashi
b53375074b webclient.c: Fix buffer overrun in HTTP header parsing
* Detect a long header line which doesn't fit the buffer.

* If the header line in question doesn't seem important for us,
  just ignore it.

* Otherwise, bail out with -E2BIG.

The overrun was found by LLVM UBSan on macOS.

The following is an example of a long header line,
which doesn't fit the default CONFIG_WEBCLIENT_MAXHTTPLINE=200.
```
pacetanuki% curl -v https://www.midokura.com
:
:
< HTTP/2 200
< server: nginx
< date: Fri, 14 May 2021 02:16:24 GMT
< content-type: text/html; charset=UTF-8
< content-length: 131313
< x-powered-by: PHP/7.4.18
< link: <https://www.midokura.com/wp-json/>; rel="https://api.w.org/", <https://www.midokura.com/wp-json/wp/v2/pages/7>; rel="alternate"; type="application/json", <https://www.midokura.com/>; rel=shortlink
< x-powered-by: PleskLin
<
```
2021-05-16 11:32:47 -03:00
YAMAMOTO Takashi
eb1a99fdd6 webclient.c: Don't parse the status line as the first header line 2021-05-16 11:32:47 -03:00
YAMAMOTO Takashi
f17af21f9c webclient: Add a few ninfo in header parsing 2021-05-16 11:32:47 -03:00
Diego Herranz
d74ac654a9 hdc1008_demo: set intial measurement mode
No mode was set before the first read by the app.
The first time the app was run, it worked properly, reading
temperature and humidity on the first read(). But subsequent reads
returned humidity only since that was last mode set up.
Also, the ioctl read was returning invalid results.
2021-05-16 11:31:31 -03:00
Michał Łyszczek
ccc8ddaf5d system/embedlog: update to v0.6.0
Changes from v0.4.0
- add thread safety code
- add option to print function info (name) in logs
- abi/api stabilization
- bug fixes + increased reliability

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>

---
v1 -> v2 [suggested by Brennan Ashton]
 - fix path to embedlog_main.c in header comment
 - change license from bsd3 to apache2.0
2021-05-16 11:30:29 -03:00
Xiang Xiao
e352bdca4f examples/module: Fix error: unused variable 'desc'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-13 04:54:28 -05:00
Xiang Xiao
e25a303a73 examples/elf: Fix error: unused variable 'desc' [-Werror=unused-variable]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-12 19:23:02 -07:00
Tanushree Baindur
f0c044adb1 Apps Issue #246: Replace romdisk_register() with boardctl(BOARDIOC_ROMDISK)
C file changes:
   examples/bastest/bastest_main.c
   examples/elf/elf_main.c
   examples/module/module_main.c
   examples/posix_spawn/spawn_main.c
   examples/romfs/romfs_main.c
   examples/sotest/sotest_main.c
   examples/unionfs/unionfs_main.c

Update examples/elf/elf_main.c

Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>

Update examples/unionfs/unionfs_main.c

Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>

Update examples/unionfs/unionfs_main.c

Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>

Update examples/posix_spawn/spawn_main.c

Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>

Update examples/elf/elf_main.c

Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>

Update examples/elf/elf_main.c

Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>
2021-05-12 04:41:51 -07:00
Xiang Xiao
bb1e93cb67 netutils/wakeonlan: Remove the tab from the blank line in Kconfig
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-12 10:48:44 +01:00
Simon Piriou
842f149c78 netutils: add Wake-on-LAN util 2021-05-09 10:25:20 -03:00
Diego Herranz
b52de67f6e examples/hdc1008_demo: fix header path
As recommended by the nxstyle CI check.
2021-05-08 23:09:30 -07:00
Diego Herranz
453d5f2866 examples/hdc1008_demo: fix wrong printf parameter
An extra "%d" that shouldn't be there
2021-05-08 23:09:30 -07:00
Simon Piriou
e4db4df673 system: adb: fix shell service
Fix wrong dup2 return value check after:
fs: file_dup2 shouldn't hold the file list lock
1e5bfa623aa93b918566e8dc0e2f9c1a1037f45e

Fix issue in adb shell introduced in:
nsh: Pass the correct command lines to nsh_consolemain
6aca60133c
2021-05-08 22:51:25 -07:00
YAMAMOTO Takashi
998abe1deb netlib_parseurl.c: Fix string overruns
For EINVAL, it doesn't make sense to keep parsing.
(For E2BIG, it might make some sense.)

Found by LLVM ASan.

```
=================================================================
==81622==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000000f2 at pc 0x00010d2746ca bp 0x7ffee29a9980 sp 0x7ffee29a9978
READ of size 1 at 0x6020000000f2 thread T0
    #0 0x10d2746c9 in netlib_parseurl netlib_parseurl.c:121
    #1 0x10d26b293 in parseurl webclient.c:479
    #2 0x10d265e48 in webclient_perform webclient.c:690
    #3 0x10d277c5b in main main.c:210
    #4 0x7fff7a06f3d4 in start+0x0 (libdyld.dylib:x86_64+0x163d4)

0x6020000000f2 is located 0 bytes to the right of 2-byte region [0x6020000000f0,0x6020000000f2)
allocated by thread T0 here:
    #0 0x10d3996d3 in wrap_strdup+0x203 (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x3e6d3)
    #1 0x10d276abe in main main.c:147
    #2 0x7fff7a06f3d4 in start+0x0 (libdyld.dylib:x86_64+0x163d4)

SUMMARY: AddressSanitizer: heap-buffer-overflow netlib_parseurl.c:121 in netlib_parseurl
Shadow bytes around the buggy address:
  0x1c03ffffffc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c03ffffffd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c03ffffffe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c03fffffff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c0400000000: fa fa fd fd fa fa fd fd fa fa 00 00 fa fa 00 00
=>0x1c0400000010: fa fa 00 fa fa fa 00 00 fa fa 00 06 fa fa[02]fa
  0x1c0400000020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c0400000060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==81622==ABORTING
```
2021-05-07 20:23:01 -07:00
YAMAMOTO Takashi
73a93e2370 netlib_parseurl.c: Appease nxstyle
The following errors are false positives.
https://github.com/apache/incubator-nuttx/issues/387

```
/Users/yamamoto/git/nuttx/apps/netutils/netlib/netlib_parseurl.c:57:13: error: C++ style comment
/Users/yamamoto/git/nuttx/apps/netutils/netlib/netlib_parseurl.c:59:35: error: C++ style comment
```
2021-05-07 20:23:01 -07:00
chao.an
8721bc6847 nshlib: Fix the build break in nsh_telnetd.c when CONFIG_NSH_CONSOLE=n
set the config:
CONFIG_NSH_ROMFSETC=y
CONFIG_NSH_CONSOLE=n

nsh_telnetd.c: In function 'nsh_telnetstart':
nsh_telnetd.c:267:22: error: 'vtbl' undeclared (first use in this function)
  267 |       nsh_initscript(vtbl);
      |                      ^~~~

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-05-07 10:53:25 -07:00
chao.an
a5337af484 nsh/telnetd: bringup the network before telnetd init
bringup the network before telnetd init if without NSH_CONSOLE

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-05-06 19:14:47 -07:00
Nathan Hartman
6d3782c961 Licensing: Move wireless/wapi/LICENSE into top-level LICENSE 2021-05-06 19:14:13 -07:00
Gustavo Henrique Nihei
73a8c65ec9 system/spi: Adopt CPHA as the abbreviation for clock phase 2021-05-06 00:24:43 -07:00
Abdelatif Guettouche
739ab94d03 testing/unity: Select the latest version.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-05-05 06:05:33 -07:00
Atsunori Saito
a12f9d967c netutils/webclient: Fixed socket descriptor leak. 2021-05-03 16:44:28 +09:00
Abdelatif Guettouche
e86faa6966 testing/ostest: Fix nxstyle errors.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-04-30 09:17:14 -03:00
Abdelatif Guettouche
0e9f08e454 testing/ostest: Report "ERROR" the same way for all the test cases.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-04-30 09:17:14 -03:00
Masayuki Ishikawa
f902d900e1 netutils: dhcpc: Fix Kconfig for the usrsock
Summary:
- This commit fixes the renew command with the usrsock

Impact:
- None

Testing:
- Tested with spresense:wifi and esp32-devkitc:wapi

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-04-29 01:27:47 -05:00
Gregory Nutt
844b193713 apps/netutils/dhcpc/Kconfig: Auto-select CONFIG_NET_UDP_BINDTODEVICE
DHCPC depends on CONFIG_NET_UDP_BINDTODEVICE in many cases.  Safest thing is to just auto-select it whenever DHCPC is selected.
2021-04-28 21:23:05 -05:00
Gustavo Henrique Nihei
5b26068635 system/spi: Fix NxStyle issues 2021-04-27 02:29:45 -05:00
Gustavo Henrique Nihei
63d59b0acf system/spi: Print sent data in the same way as received.
This eases the comparison for testing SPI with looped back MOSI and MISO
signals.
2021-04-27 02:29:45 -05:00
Anthony Merlino
267aba6467 addroute: inet_pton cannot accept slash notation. We must fixup the argument before calling. 2021-04-23 03:27:40 -05:00
Abdelatif Guettouche
80eba3aad1 netutils/iperf: Configs were using EXAMPLES_ instead of NETUTILS_. 2021-04-21 13:43:05 -05:00
chao.an
084cc55064 usrsock/server: replace the wakeup source to eventfd
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-04-21 09:53:40 -05:00
chao.an
2214e51457 netutls/usrsock_rpmsg_server: add support for send reassemble
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-04-21 09:53:40 -05:00
Alan C. Assis
0146e88001 examples/modbus: Add Reg Coil support and use it to control USERLEDs 2021-04-20 07:55:35 -05:00
Alan C. Assis
f7880bcca9 examples/modbus: Fix endianess, it was inverted 2021-04-20 07:55:35 -05:00
Alan C. Assis
496393a87b interpreters/ficl: Fix compilation issue
A NuttX user told that ficl wasn't working as suggested in the
README.txt, then I found that the root cause was the order of the
Make.srcs inclusion inside the Makefile. I think we can do better:
we could automate the process to download and configure ficl.
2021-04-15 08:09:48 -05:00
Sara Souza
acfd0a9b4e examples/mqttc: If connection() fails, then fd becomes invalid 2021-04-15 09:54:29 -03:00
Xiang Xiao
0ee6f0e5e0 netutils/rpmsg: Prepare poll fds only when error with EINTR
to improve the performance

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id88df8618473b56236821b9e0f6399dfef2c958d
2021-04-13 08:32:12 +01:00
Abdelatif Guettouche
fbf5290401 wireless/wapi/src/wapi.c: When executing a command return it's error code on failure.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-04-12 22:29:01 -05:00
Gustavo Henrique Nihei
dd38c7f920 examples/lvgldemo: Fix unused variable build warning 2021-04-12 22:28:18 -05:00
Gustavo Henrique Nihei
0b2fd06ab0 examples/lvgldemo: Check for more specific input subclass on ifdefs 2021-04-12 22:28:18 -05:00
chenwen
39c5fa812d wireless/wapi: Fix issue of getting the operating frequency 2021-04-12 03:56:11 -05:00
Gustavo Henrique Nihei
852aa8a511 examples/lvgldemo: Make input options depend on enabled drivers 2021-04-11 12:08:09 -07:00
Brennan Ashton
e73d71c787 ltp: Resolve compile warnings 2021-04-11 03:43:51 -05:00
Anthony Merlino
98c1223746 i8sak: Fixes bug where daemon was being requested again when operation is finished, instead of being released. 2021-04-10 13:08:37 -05:00
raiden00pl
864a61a431 Add FOC motor controller example
For now, only open-loop velocity control is supported.
2021-04-10 00:40:43 -05:00
raiden00pl
d75d6b7af0 Add FOC library
Supported features:
- float and fixed16 operations
- helper interface to interact with the kernel-side FOC device
- general interface for FOC controller
- PI current/voltage controller
- 3-phase space vector modulation
- general interface for FOC model
- PMSM model
- general interface for phase angle data
- open-loop handler
- general interface for phase velocity data
- general interface for ramp (eg. velocity ramp, torque ramp)
- (WIP) CORDIC interface for hardware acceleration
2021-04-10 00:39:09 -05:00
Gustavo Henrique Nihei
a333a908a8 examples: Update missing DJOYSTICK macro to new INPUT template 2021-04-08 11:38:00 -03:00
Gustavo Henrique Nihei
62e0c2451b examples: Fit INPUT related configs to new naming template 2021-04-08 10:15:22 -03:00