Commit Graph

55029 Commits

Author SHA1 Message Date
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
likun17 b8835be6c5 libs/libc/stdio: Optimize header file dependencies in *scanf.c file.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-23 18:22:12 +08:00
dongjiuzhu1 47eec633a0 libs/libc/stdio: using sprintf to instead itoa
itoa isn't posix function, the standard stdlib file exclude it.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-23 18:22:12 +08:00
dongjiuzhu1 88da2b4adb include/nuttx/compiler.h: fix redefine about offsetof
nuttx/compiler.h:176:11: warning: 'offsetof' macro redefined [-Wmacro-redefined]
          ^
clang/14.0.6/include/stddef.h:104:9: note: previous definition is here

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-23 18:22:12 +08:00
dongjiuzhu1 c9ad454807 libs/stdio: fix compile warning when disable CONFIG_LIBC_NUMBERED_ARGS
libs/libc/stdio/lib_libvsprintf.c:160:48: warning: unused parameter 'arglist' [-Wunused-parameter]
                             FAR struct arg_s *arglist, int numargs,
                                               ^
libs/libc/stdio/lib_libvsprintf.c:160:61: warning: unused parameter 'numargs' [-Wunused-parameter]
                             FAR struct arg_s *arglist, int numargs,

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-23 18:22:12 +08:00
dongjiuzhu1 319501e9ef libs/libc: remove LIB_BUFLEN_UNKNOWN to reduce depends on libc.h
1. remove libc.h
2. include <nuttx/stream.h>, remove stdio.h, becuase stream.h include stdio.h

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-23 18:22:12 +08:00
yangshuyong a537ecdd0f Support nuttx pci endpoint driver framework
Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
lipengfei28 56308bf202 bitmap: add bitmap_find_free_region
The pci ep framewoek use bitmap manage the pci outbond memory

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
lipengfei28 ca39dc2e74 math: Optimize the implementation of log2ceil and log2floor
and move common math funtions to math32.h:
div_round_up
div_round_closest
is_power_of_2
roundup_pow_of_two
rounddown_pow_of_two

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
lipengfei28 4fd78583f7 libc: add find_next_zero_bit
The pci ep framework use bitmap manage free bar

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
lipengfei28 b18262d78f bits:rename __set_bit to set_bit __clear_bit to clear_bit
This used for add pci ep drver framework

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
dongjiuzhu1 a2845faee3 fs/chmod/fchmod/lchmod: only set permissions by mode_t and ignore other bits
test case:

int main(void)
{
  struct stat buf;
  int ret;

  stat("test1.t", &buf);
  printf("test1.t st.mode:%x\n", buf.st_mode);
  stat("test.t", &buf);
  printf("test.t st.mode:%x\n", buf.st_mode);
  ret = chmod("test1.t", buf.st_mode);
  if (ret == 0)
    {
      stat("test1.t", &buf);
      printf("test1.t st.mode:%x\n", buf.st_mode);
    }

  return 0;
}

>>
test1.t st.mode:81b4
test.t st.mode:81fd
test1.t st.mode:81fd

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-23 14:57:37 +08:00
dependabot[bot] a116a6210e build(deps): bump codelytv/pr-size-labeler from 1.10.0 to 1.10.1
Bumps [codelytv/pr-size-labeler](https://github.com/codelytv/pr-size-labeler) from 1.10.0 to 1.10.1.
- [Release notes](https://github.com/codelytv/pr-size-labeler/releases)
- [Commits](https://github.com/codelytv/pr-size-labeler/compare/v1.10.0...v1.10.1)

---
updated-dependencies:
- dependency-name: codelytv/pr-size-labeler
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-23 14:37:02 +08:00
chao an db5320fd9f drivers/syslog: compile syslog_device.c if console/char/file channel enabled
Add conditional compilation to syslog_device.c

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-23 14:36:40 +08:00
chenrun1 ab4d72756e arch/samd2l2:Ignore atomic warning when using clang compiler
When the toolchain does not support atomic, it will use the version implemented by NuttX (low performance version). This scenario is consistent with the original design, so we can ignore it.

see bug here:
https://bugs.llvm.org/show_bug.cgi?id=43603

Error: inode/fs_inodeaddref.c:50:7: error: large atomic operation may incur significant performance penalty; the access size (4 bytes) exceeds the max lock-free size (0  bytes) [-Werror,-Watomic-alignment]
   50 |       atomic_fetch_add(&inode->i_crefs, 1);
      |       ^
/tools/clang-arm-none-eabi/lib/clang/17/include/stdatomic.h:152:43: note: expanded from macro 'atomic_fetch_add'
  152 | #define atomic_fetch_add(object, operand) __c11_atomic_fetch_add(object, operand, __ATOMIC_SEQ_CST)
      |                                           ^
1 error generated.
make[1]: *** [Makefile:83: fs_inodeaddref.o] Error 1
Error: inode/fs_inodefind.c:74:7: error: large atomic operation may incur significant performance penalty; the access size (4 bytes) exceeds the max lock-free size (0  bytes) [-Werror,-Watomic-alignment]
   74 |       atomic_fetch_add(&node->i_crefs, 1);

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-23 14:07:03 +08:00
chenrun1 76e83a5424 arch_atomic.c:Provide __sync_synchronize when the compiler does not support it
Summary:
  Configuration/Tool: zp214xpa/nsh,CONFIG_ARM_TOOLCHAIN_GNU_EABI
2024-09-14 06:11:00
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Building NuttX...
arm-none-eabi-ld: /github/workspace/sources/nuttx/staging/libfs.a(fs_inoderemove.o): in function `inode_remove':
fs_inoderemove.c:(.text.inode_remove+0x94): undefined reference to `__sync_synchronize'
arm-none-eabi-ld: fs_inoderemove.c:(.text.inode_remove+0x9c): undefined reference to `__sync_synchronize'
make[1]: *** [Makefile:212: nuttx] Error 1
make: *** [tools/Unix.mk:548: nuttx] Error 2
make: Target 'all' not remade because of errors.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-23 14:07:03 +08:00
chenrun1 03f215b374 nuttx/atomic.h:fix Fixed the pragma of ATOMIC_VAR_INIT in clang
Error: vfs/fs_epoll.c:126:3: error: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Werror,-Wdeprecated-pragma]
  ATOMIC_VAR_INIT(1),     /* i_crefs */
  ^
/Applications/Xcode_15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/stdatomic.h:54:41: note: macro marked 'deprecated' here
                                        ^
1 error generated.
make[1]: *** [fs_epoll.o] Error 1
Error: socket/socket.c:78:3: error: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Werror,-Wdeprecated-pragma]
  ATOMIC_VAR_INIT(1),     /* i_crefs */

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-23 14:07:03 +08:00
chenrun1 4cec713dbf fs_inode:Change the type of i_crefs to atomic_int
Summary:
  1.Modified the i_crefs from int16_t to atomic_int
  2.Modified the i_crefs add, delete, read, and initialize interfaces to atomic operations
The purpose of this change is to avoid deadlock in cross-core scenarios, where A Core blocks B Core’s request for a write operation to A Core when A Core requests a read operation to B Core.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-23 14:07:03 +08:00
ouyangxiangzhen 56bcc3bb12 sched/signal: Add ifdef macro to reduce the bss size.
This commit added ifdef macro to sigwork_s. When CONFIG_SIG_EVTHREAD is
not defined, the struct sigwork_s will be empty struct, which is helpful
to reduce bss size.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-23 12:29:36 +08:00
ouyangxiangzhen c6861ea931 Revert "olimex-stm32-p407: adjust memory layout"
This reverts commit 9a9d0a647e.
2024-09-23 12:29:36 +08:00
ouyangxiangzhen db88754822 sched/signal: Simplify the implementation of SIGEV_THREAD_TID.
This commit simplified thread ID dispatching logic by integrating it into the `nxsig_dispatch` function.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-23 12:29:36 +08:00
ouyangxiangzhen 0373ba0fab sched/signal: Simplified Implementation for SIGEV_THREAD_TID.
This commit simplified the implementation for SIGEV_THREAD_TID.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-23 12:29:36 +08:00
ouyangxiangzhen 9f36509c0b signal: Add siginfo initializer
This patch is to make Coverity happy.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-23 12:29:36 +08:00
chao an 037baee4fb can: Add g_ prefix to can_dlc_to_len and len_to_can_dlc.
continue work of f76c2ed83b

detail: Add g_ prefix to can_dlc_to_len and len_to_can_dlc to
follow NuttX coding style conventions for global symbols,
improving code readability and maintainability.

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-23 12:14:56 +08:00
wangjianyu3 58f25a31a1 Add Documentation for thermal framework
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 898a5d501f sim:thermal: Remove CPUFreq realted
CPUFreq has not upstreamed to apache:nuttx

Warning/Error:
  $ make distclean
  $ ./tools/configure.sh -l sim:thermal
  $ make savedefconfig
  $ diff defconfig boards/sim/sim/sim/configs/thermal/defconfig
  18a19
  > CONFIG_CPUFREQ=y
  73a75
  > CONFIG_THERMAL_CDEV_CPUFREQ=y
  74a77
  > CONFIG_THERMAL_DUMMY_CPUFREQ=y

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 a73ee73c78 Thermal/dummy: Fix depends error
1. cpufreq.h not found if cpufreq is not supported on some branches.
./thermal/thermal_dummy.c:25:10: fatal error: nuttx/cpufreq.h: No such file or directory
   25 | #include <nuttx/cpufreq.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.

2. debug.h is included by including <nuttx/cpufreq.h>, should not.
CC:  thermal/thermal_dummy.c thermal/thermal_dummy.c: In function ‘thermal_dummy_init’:
thermal/thermal_dummy.c:338:7: warning: implicit declaration of function ‘therr’ [-Wimplicit-function-declaration]
  338 |       therr("Register cooling device fan0 failed!\n");
      |

https://github.com/apache/nuttx/pull/12824
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 efd7e31b3a Thermal/procfs: Remove unnecessary nxmutex_unlock
https://github.com/apache/nuttx/pull/12824
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 88cc4b1120 Thermal/procfs: Disabled immediately after enabling.
When exec "echo 1 > /proc/thermal/cpu-thermal", procfs get "\n" after "1", treat as disable:
```
 #1  0x000000000040f452 in thermal_procfs_write (filep=0x7ffff3d241e8, buffer=0x7ffff3d344fc "\n", buflen=1) at thermal/thermal_procfs.c:179
```

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 d5ffed635b Thermal/dummy: Get cpufreq_driver from cpufreq_policy.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 e8758eb974 Thermal/step_wise: Increase cooling state in case of "stable" trend and "hot" trip.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 68d5516c90 Thermal/dummy: Fix warning
```
CID 1159822: (#1 of 2): 宏将无符号值与 0 做了比较 (NO_EFFECT)
unsigned_compare: 不带符号值的此 greater-than-or-equal-to-zero 比较总是为 true。index >= 0U。
```
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 515c3978dd Thermal: Check trip type in thermal_zone_device_register().
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 6442683359 sim:thermal: move etc romfs mount from nsh to sched/init
Ref: I7afe1047369e91662583c8ef9c98fffcf567fbb7
```
sched: move etc romfs mount from nsh to sched/init
```
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 f96d3798a1 Thermal: remove assert of thermal_zone_device_update()
Called by both of lpwork and Idle_Task:

[    0.000000] [ 0] [  INFO] [ap] thermal_zone_device_register: Registered zone device cpu-thermal
[    0.000000] [ 0] [ EMERG] [ap] _assert: Current Version: NuttX ap 0.0.0  Dec 11 2023 20:59:20 sim
[    0.000000] [ 0] [ EMERG] [ap] _assert: Assertion failed : at file: thermal/thermal_core.c:820 task: Idle_Task process: Kernel 0x32ade29

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 2480f599c6 Add default config for thermal framework based on sim:nsh
Test: ./tools/configure.sh -l sim:thermal && make -j8

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 d43f0272e5 Thermal: Add dummy driver
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 b30f866f80 Thermal: Add procfs file nodes
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 520e4042ce Thermal: Register pm suspend notifier
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 2f285a04f9 Thermal: Support cpufreq cooling device
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 338b5d7415 Thermal: Support step_wise governor
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 d1b87bd021 Add thermal framework
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 b78c9a7067 boardctl.h: Add BOARDIOC_SOFTRESETCAUSE_THERMAL reset cause
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
hujun5 e4a0470527 riscv: add a return value to riscv_swint indicating whether a context switch is required
This commit fixes the regression from https://github.com/apache/nuttx/pull/13561

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-22 09:38:26 -03:00
Rodrigo Sim a5754a2f03 arm/stm32f401rc-rs485: Add support to LCD 16x2 with I2C Backpack
Signed-off-by: Rodrigo Sim rcsim10@gmail.com
2024-09-21 14:42:54 -03:00
Ville Juven 10b40abecc arm64_task/pthread_start: Convert the C / inline ASM code to assembly
The aforementioned functions can/will fail if the C compiler decides
to use the stack for the incoming entrypt/etc. parameters.

Fix this issue by converting the jump to user part into pure assembly,
ensuring the stack is NOT used for the parameters.
2024-09-21 23:24:02 +08:00
likun17 09ab135d2f sensor: Fixed the problem of user information lag in cross-core communication "stublist".
When its remote core publishes a message, all subscribed cores will receive the message,
but the local core "stublist" does not update the user's "generation" and "bufferpos" parameters.

Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-21 23:09:48 +08:00
Ville Juven 6e15994f4c arm64_addrenv: Add support for 4 level MMU translations
The original code made the incorrect assumption that the amount of
translation levels is 3, but this is incorrect. The amount of levels is 4
and the amount of levels that are utilized / in use is set dynamically
from the amount of VA bits in use.
2024-09-21 08:36:23 -03:00
Ville Juven a559f3495a arm64_addrenv: Fix the amount of page table levels
The VMSAv8-64 translation system has 4 page table levels in total, ranging
from 0-3. The address environment code assumes only 3 levels, from 1-3 but
this is wrong; the amount of levels _utilized_ depends on the configured
VA size CONFIG_ARM64_VA_BITS. With <= 39 bits 3 levels is enough, while
if the va range is larger, the 4th translation table level is taken into
use dynamically by shifting the base translation table level.

From arm64_mmu.c, where va_bits is the amount of va bits used in address
translations:
(va_bits <= 21)       - base level 3
(22 <= va_bits <= 30) - base level 2
(31 <= va_bits <= 39) - base level 1
(40 <= va_bits <= 48) - base level 0

The base level is what is configured as the page directory root. This also
affects the performance of address translations i.e. if the VA range is
smaller, address translations are also faster as the page table walk is
shorter.
2024-09-21 08:36:23 -03:00
Tiago Medicci Serrano 72acec7275 esp32s3: Fix faulty `esp32s3-devkit:stack` example
This defconfig is an example of the recorded stack and it became
faulty recently after the implementation of the `up_current_regs`
functions. The `noinstrument_function` directive must be used for
preventing it from being looped when instrumentation is enabled.
Also, this commit places `sched/instrument/stack_record.c` in IRAM.
2024-09-21 10:42:06 +08:00