Commit Graph

54167 Commits

Author SHA1 Message Date
makejian
8de247543f crypto: export interfaces abort aes-cmac
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-27 07:44:06 -04:00
makejian
28974b8a21 crypto: export crc32 from /dev/crypto
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-27 07:44:06 -04:00
Ville Juven
963c5e8e52 arm64/imx9: Force 64-bit ELF format
The format is always 64-bits
2024-08-27 07:39:26 -04:00
guoshichao
599d41d806 greenhills: fix the pointless comparison build warning
"ioexpander/gpio.c", line 529: warning #186-D: pointless comparison of
          unsigned integer with zero
            if (pintype < GPIO_INPUT_PIN || pintype >= GPIO_NPINTYPES)
                        ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-27 07:33:09 -04:00
SPRESENSE
2cc9221c09 arch: cxd56xx: Add logic for i2c reset
Add ARCH_HAVE_I2CRESET configration to ARCH_CHIP_CXD56XX
and implement i2c reset function.
2024-08-27 12:29:46 +02:00
SPRESENSE
de8829f8cd arch: cxd56xx: Fix SCU sensor data format
Add offset setting for sensor data to be written to SCU math function.
Fix comments in function descriptions.
2024-08-27 12:28:50 +02:00
Samuel Martinez
a6df724b4f BlackPill buttons example
Description:
Example to interact with KEY button and user external button connected to PA1.
For KEY button pull-up resistor is active, board schematic does not show any pull-up or pull-down resistor.

Results: Example working as expected.

BlackPill PWM example

Description:
PWM example using PB0 - Timer3 - Channel 3
Create default configuration for the example.

Controlling_RGB_LED

Description: Controlling a RGB LED on NuttX for Black Pill board [STM32F411]

Note: Example currently not working as expected.
2024-08-27 09:13:35 +08:00
Samuel Martinez
447f03cfd0 Led and buttons examples
Description:
Test LED examples on freedom-k66f, nucleo-f401re and blackpill-f411ce boards.
Update linker file for bluepill-f103c6.
2024-08-27 09:13:35 +08:00
zhaoxingyu1
517d55a2ce nvs: modify nvs block size and block numbers
mtd_config_fs/Kconfig: update nvs block size and block number to configurable

Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2024-08-26 20:55:24 -04:00
yangguangcai
352e3a6873 armv7-a timer:fix timer overflow.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-08-26 17:50:47 -04:00
wanggang26
dfffaee706 mmcsd: add write ext csd reg support
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-08-26 17:45:43 -04:00
Zhe Weng
90c0acce05 net/tun: Support changing carrier state of TUN/TAP
Add TUNSETCARRIER ioctl, then we may change the carrier state of TUN dynamically. Note that we don't need an ioctl for getting carrier, it can be done by SIOCGIFFLAGS already.

Ref: https://github.com/torvalds/linux/blob/v6.10/drivers/net/tun.c#L3374-L3380

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-08-26 17:34:23 -03:00
yanghuatao
33ddf1a297 toolchain/ghs: Fix green hills toolchain build Vela warnings
ccarm: Warning: Option "-fomit-frame-pointer" not supported in this product
ccarm: Warning: Unknown option "-Wno-cpp" ignored.  Did you mean "--nocpp"?
ccarm: Warning: Unknown option "-pipe" passed to linker
ccarm: Warning: Unknown option "-Wno-psabi" ignored.  Did you mean "-Wno-convert64"?
ccarm: Warning: Option "-fomit-frame-pointer" not supported in this product
ccarm: Warning: Unknown option "-Wno-cpp" ignored.  Did you mean "--nocpp"?
ccarm: Warning: Unknown option "-pipe" passed to linker
[asarm] (warning #2073) unknown option: -mimplicit-it=always
Warning: Unknown option "-pipe" passed to linker
[asarm] (warning #2073) unknown option: -mthumb
[asarm] (warning #2073) unknown option: -mimplicit-it=always
[asarm] (warning #2073) unknown option: -mthumb
[asarm] (warning #2073) unknown option: -mimplicit-it=always
[asarm] (warning #2073) unknown option: -mthumb
[asarm] (warning #2073) unknown option: -mimplicit-it=always
[asarm] (warning #2073) unknown option: -mthumb
[asarm] (warning #2073) unknown option: -mimplicit-it=always
[asarm] (warning #2073) unknown option: -mthumb
[asarm] (warning #2073) unknown option: -mimplicit-it=always

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-08-27 01:56:34 +08:00
guoshichao
3bb30231a9 greenhills: fix the file build path error
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-27 01:56:34 +08:00
guoshichao
e5f40db601 greenhills: fix the "etc/init.d/rc.sysinit" file preprocess error
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-27 01:56:34 +08:00
guoshichao
c2d26988fd greenhills: fix double-precision float operation running error
since not all Armv7-m platform support double-precision floating
operations, so we add an extra option that help those specific platform
could define the single-precision floating operations.
for example, qemu-mps platform(armv7-m) support double-precision
floating operations, so we do not need to open
CONFIG_ARM_FPU_SINGLE_HARDWARE build options;
but for fc7300 platform(armv7-m) only support single-precision floating
operations, so if we pass "-fhard" build option to "ghs" compiler, then
the following instruction will be generated:
vcvt.f64.s32    d9, s18
which will fail to execute on fc7300 platform.
with "-fsingle" build option, the "ghs" compiler will generate hardware
instruction for single-precision floating operation, and generate
software instruction for double-precision floating operation.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-27 01:56:34 +08:00
guoshichao
90a6ced9c1 arch/arm/toolchain: add --entry_std LDFLAGS for different toolchain
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-27 01:56:34 +08:00
pangzhen1
d2ec034ada support inputting multiple ldscript files when linking the nuttx.bin
To support greenhill compilation, LDFLAGS removes the code that adds -T through addprefix to ARCHSCRIPT(greenhill requires a space between -T and ldscript files, but addprefix didn't do it). However,if we modified like this, when ARCHSCRIPT has more than one ldscript, the -T is only added to the first ldscript, but not to the following ldscripts, which results in a warning when linking.
To solve this problem, we can just add a space after $(SCRIPT_OPT) when using addprefix, instead of deleting addprefix.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2024-08-27 01:56:34 +08:00
guoshichao
67f0b5131b arch/arm/toolchain: add greenhills toolchain config
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-27 01:56:34 +08:00
guoshichao
dd8b630b0d nuttx: add GREENHILLS compiler config option
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-27 01:56:34 +08:00
Xiang Xiao
56745e300a rpmsg: Reformat drivers/rpmsg/rpmsg.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-27 01:48:16 +08:00
Yongrong Wang
88ec55f6af rpmsg.c: move onceinit judge logic to common part
move rptun/rpmsg_virtio onceinit judge logic to rpmsg_register.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-08-27 01:48:16 +08:00
liuhongchao
d2d8d49359 drivers: Fix goldfish events x64 unresponsive interrupt issue
Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
2024-08-27 01:41:43 +08:00
Yongrong Wang
122a832feb rptun.c: fix rptun.c format follow rpmsg virtio
optimization rptun.c format

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-08-27 01:41:14 +08:00
yanghuatao
91e341dbda toolchain/ghs: ioexpander_dev_s "declaration is not visible outside of function" warning
CC:  serial/serial_io.c "/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/nuttx/power/regulator.h", line 227: warning #231-D:
          declaration is not visible outside of function
  int regulator_gpio_init(FAR struct ioexpander_dev_s *iodev,

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-08-27 01:39:37 +08:00
yanghuatao
edce454d55 toolchain/ghs: Fix trailing comma is nonstandard warnings
"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,
          ^

"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/sys/types.h", line 319: warning #228-D:
          trailing comma is nonstandard
    OK = 0,

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-08-27 01:39:37 +08:00
yanghuatao
ac26e83a45 toolchain/ghs: Fix unknown attribute warnings
"string/lib_strlen.c", line 54: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address
"string/lib_strncpy.c", line 81: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address
"string/lib_strncmp.c", line 58: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address
"string/lib_strchr.c", line 73: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address
"string/lib_strcpy.c", line 68: warning #1097-D: unknown attribute
          "no_sanitize_address"
  nosanitize_address

"procfs/fs_procfstcbinfo.c", line 185: warning #1097-D: unknown attribute
          "optimize"
  nooptimiziation_function

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-08-27 01:39:37 +08:00
yanghuatao
f6b3e92b6c toolchain/ghs: Fix tstate_t "enumerated type mixed with another type" warnings
"/mnt/yang/qixinwei_cmake/nuttx/sched/sched/sched_removeblocked.c", line 58: warning #188-D:
          enumerated type mixed with another type
    tstate_t task_state = btcb->task_state;
"/mnt/yang/qixinwei_cmake/nuttx/sched/sched/sched_setpriority.c", line 243: warning #188-D:
          enumerated type mixed with another type
    tstate_t task_state = tcb->task_state;

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-08-27 01:39:37 +08:00
yangguangcai
f44232b7a8 memset:optimizate speed.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-08-27 00:21:27 +08:00
yangguangcai
d6cd95313d pl031:change mktime to timegm.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-08-27 00:15:29 +08:00
wanggang26
289fc24b32 boot: fix potential bl jump to app failed issue
After changing sp, following functions calling will result
in unpredictable behavior in case of jumping

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-08-26 11:54:21 -03:00
wangchen
ab92b7d04d tcp_close.c:when tcp socket stays in TCP_FIN_WAIT_1 or TCP_FIN_WAIT_2,calling tcp_close_eventhandler releases received packets
when tcp socket stays in TCP_FIN_WAIT_1 or TCP_FIN_WAIT_2,not actively calling tcp_close_eventhandler,can reuslt in some TCP socket being set to a closed state,but nofosegs are not directly released,leading to IOB resource leakage.

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-08-26 06:14:10 -04:00
zhanghongyu
5c271198a9 ipfrag: remove assert for actual product reasons
If the device's CPU resources are scarce and unable to execute the
ip_fragin_timerwork callback in a timely manner, this assert will
be triggered. This is a normal scenario that can occur. The logic
should be modified to wait for the ip_fragin_timerwork to be
executed if it has not been executed yet.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-26 17:44:40 +08:00
Xiang Xiao
fcb3e84c24 can: Merge netpacket/can.h into nuttx/can.h
To align with the layout of Linux can header file.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-26 05:05:31 -04:00
jianglianfang
7abd460131 fb:add select overlay FB_NO_OVERLAY
It is expected that select_overlay can switch from overlay to main
plane.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-08-26 16:26:53 +08:00
Windrow14
cc8d453b5a arch/xtensa/src/esp32s3/esp32s3_sdmmc.c: wait for command done event also on error response
Wait for CMDDONE in esp32s3_waitresponse even an error response is received.
Otherwise, the CMDDONE event of this command will disrupt later command.

Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
2024-08-26 13:44:57 +08:00
Matheus Catarino
25bd3be167 tools/ci: add zig, ldc and swift
The main objective is to determine if the examples really work or if they have been obsoleted.
The languages included in the list promote good interoperability with the NuttX API (C predominant).

This will show if they are worth integrating in NuttX.

**FFI method**

- Rust: bindgen or c2rust
- D: importC
- Swift: Bridging header or clang modulemap.
- Zig: `@cImport/@cInclude` or translate-c
2024-08-26 10:25:54 +08:00
Petro Karashchenko
282cf2f7d0 sys/socket: implement compiler agnostic sockaddr_storage alignment
'aligned_data' is compiler dependent, but Open Group Base Specifications
describe compiler agnostic solution that can be used:
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-26 10:25:05 +08:00
Petro Karashchenko
1528b8dcca nuttx: resolve various 'FAR' and 'CODE' issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-26 10:21:03 +08:00
meijian
a4b4fd16e9 netlib/route: add length for add/del route-func to reduce caller stack usage
Signed-off-by: meijian <meijian@xiaomi.com>
2024-08-26 01:54:10 +08:00
yinshengkai
84333881d7 mm: add mm_largest api to get the current largest available memory block
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
yinshengkai
2cdfda149a mm: memory pressure support returns the maximum available memory
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
yinshengkai
49d1b4198f mm: add memory pressure notification support
Add mm_heap_free interface to pass remaining memory to memory pressure

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
yinshengkai
f44a31c337 procfs: add memory pressure notification support
This is a memory monitoring interface implemented with reference to Linux's PSI (Pressure Stall Information),
which can send notifications when the system's remaining memory is below the threshold.

The following example code sets two different thresholds.
When the system memory is below 10MB, a notification is triggered.
When the system memory is below 20 MB, a notification (POLLPRI event) is triggered every 1s.

```
int main(int argc, FAR char *argv[])
{
  struct pollfd fds[2];
  int ret;

  if (argc == 2)
    {
      char *ptr = malloc(1024*1024*atoi(argv[1]));
      printf("Allocating %d MB\n", atoi(argv[1]));
      ptr[0] = 0;
      return 0;
    }

  fds[0].fd = open("/proc/pressure/memory", O_RDWR);
  fds[1].fd = open("/proc/pressure/memory", O_RDWR);
  fds[0].events = POLLPRI;
  fds[1].events = POLLPRI;

  dprintf(fds[0].fd, "%llu -1", 1024LLU*1024 * 10);
  dprintf(fds[1].fd, "%llu 1000000", 1024LLU*1024 * 20);

  while (1)
    {
      ret = poll(fds, 2, -1);
      if (ret > 0)
        {
          printf("Memory pressure: POLLPRI, %d\n", ret);
        }
    }

  return 0;
}
```

https://docs.kernel.org/accounting/psi.html
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
yanghuatao
fac44ab8aa nuttx/mps2: Support NuttX running on qemu cortex-m7
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-08-25 22:56:46 +08:00
Xiang Xiao
d3be25d90c arch/arm: Add the support of MPS2 AN386 and AN500
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-25 22:56:46 +08:00
yangsong8
6a38c37702 pty: use mutex to protect alloc minor
If failed in pty_register2, it is possible to enter unregister_driver
function, which eventually calls ptmx_minor_free, resulting in mutex
conflict.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-25 22:16:53 +08:00
buxiasen
946ed96926 fs: add fs_heap, support shm/tmpfs/pseudofile with indepent heap
For some case, need large files from tmpfs or shmfs, will lead to high
pressure on memory fragments, add an optional fs_heap with independent
heap will benifit for memory fragments issue.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-08-25 22:12:37 +08:00
hujun5
1d6a099180 irq: remove restore_critical_section in irq
Only in the non-critical region, nuttx can the respond to the irq and not hold the lock
When returning from the irq, there is no need to check whether the lock needs to be released
we also need keep restore_critical_section in svc call

test:
Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
   -machine virt,virtualization=on,gic-version=3 \
   -net none -chardev stdio,id=con,mux=on -serial chardev:con \
   -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-08-25 21:14:19 +08:00
Petro Karashchenko
d499ac9d58 nuttx: fix multiple 'FAR', 'CODE' and style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00