Commit Graph

54738 Commits

Author SHA1 Message Date
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
likun17
2b59a0a19b lzf: Add macro judgment to header file reference.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-21 03:00:13 +08:00
hujun5
c5ecc49c10 riscv: g_current_regs is only used to determine if we are in irq,
with other functionalities removed.

reason:
  by doing this we can reduce context switch time,
  When we exit from an interrupt handler, we directly use tcb->xcp.regs

before
   text    data     bss     dec     hex filename
 138805     337   24256  163398   27e46 nuttx

after
   text    data     bss     dec     hex filename
 138499     337   24240  163076   27d04 nuttx

 szie change -322
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-21 02:59:57 +08:00
wangmingrong1
b5c5e4b850 gdb plugin: Encapsulate the gdb native command gcore as nxgcore
Modify elf with nxgcore and call gcore:
(gdb) nxgcore --help
usage: [-h] [-o OUTPUT] [-t OBJCOPY] [-r MEMRANGE]

options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        Gcore output file
  -t OBJCOPY, --objcopy OBJCOPY
                        Select the appropriate architecture for the objcopy
                        tool
  -r MEMRANGE, --memrange MEMRANGE

examples:
	(gdb) nxgcore -t arm-none-eabi-objcopy -r 0x40200000,0x48000000,0x07

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-20 22:07:29 +08:00
likun17
bdac8c116a sensor_rpmsg.c: Fix that "stub" will be created when local core only has subscribers.
After the ap core subscribes to the 25hz batch 120ms data of the sensor core, it switches
to the cp core and subscribes to the 50hz batch 120ms sensor core data. At this time,
the data subscribed by the AP will be abnormally lost (12.5hz). Mainly because ap
subscribes to sensor core data earlier than cp. The subscription of cp will be broadcast
to the ap core at the same time, and the corresponding "path" already exists
under "/dev/uorb" of ap. Thus the ap will create a "stub".

There are some restrictions on the creation of "stub" to avoid this situation.

Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-20 22:05:58 +08:00
anjiahao
112cc083d3 pthread_mutex:add deadlock assert
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-20 22:05:29 +08:00
raiden00pl
ff24fc425e github: add specifier to issue github labels
This change adds a specifier to github lables created with "new issue":

- for labels related to architecture specifier is "Arch: xxx"
- for labels related to issue type specifier is "Type: xxx"
- for labels related to host OS type specifier is "OS: xxx"
- for labels related to issue area type specifier is "Area: xxx"
2024-09-20 22:02:44 +08:00
guoshichao
d26357d3e6 nuttx/math: fix greenhills build warning on using sizeof with operand
the detailed warning info are:
CC:  syslog/vsyslog.c "pthread/pthread_create.c", line 443: warning #1931-D: operand of sizeof is
          not a type, variable, or dereferenced pointer expression
          ptcb->cmn.timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
                                ^

CC:  dirent/lib_closedir.c "sched/sched_profil.c", line 81: warning #1931-D: operand of sizeof is not a
          type, variable, or dereferenced pointer expression
    wd_start(&prof->timer, PROFTICK, profil_timer_handler, arg);
                           ^

"sched/sched_profil.c", line 142: warning #1931-D: operand of sizeof is not a
          type, variable, or dereferenced pointer expression
    wd_start(&prof->timer, PROFTICK, profil_timer_handler, (wdparm_t)prof);
                           ^

CC:  common/arm_modifyreg8.c "sched/sched_setscheduler.c", line 165: warning #1931-D: operand of sizeof is
          not a type, variable, or dereferenced pointer expression
            tcb->timeslice  = MSEC2TICK(CONFIG_RR_INTERVAL);
                              ^

CC:  misc/lib_utsname.c "sched/sched_unlock.c", line 275: warning #1931-D: operand of sizeof is not a
          type, variable, or dereferenced pointer expression
            rtcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
                              ^

"sched/sched_roundrobin.c", line 119: warning #1931-D: operand of sizeof is
          not a type, variable, or dereferenced pointer expression
            tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
                             ^

CC:  armv7-m/arm_fpuconfig.c cxarm: Error: No files.  Try -help.
CC:  misc/lib_crc8ccitt.c cxarm: Error: No files.  Try -help.
cxarm: Error: No files.  Try -help.
CC:  getprime_main.c cxarm: Error: No files.  Try -help.
cxarm: Error: No files.  Try -help.
CC:  misc/lib_log2ceil.c cxarm: Error: No files.  Try -help.
CC:  task/task_start.c "task/task_setup.c", line 423: warning #1931-D: operand of sizeof is not a
          type, variable, or dereferenced pointer expression
        tcb->timeslice      = MSEC2TICK(CONFIG_RR_INTERVAL);
                              ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-09-20 22:01:36 +08:00
wangmingrong1
469418f3c9 mm/kasan: Kasan global support setting alignment length
1. Similar to asan, supports single byte out of bounds detection
2. Fix the script to address the issue of not supporting the big end

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-20 21:47:23 +08:00
wangmingrong1
0d8b6de03a mm/kasan: Map the generated shadow area to the fixed segment
Since the size of the shadow area will change during the script merging of global variables, it will lead to unpredictable number of links. After fixing, only three links are required.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-20 21:47:23 +08:00
wangmingrong1
071af0c993 mm/kasan: Tag kasan and generic kasan use the same instrumentation options
1. Tested on QEMU, the two sockets were basically the same, and their performance was not affected. The size of the generated bin file was also the same
2. Extract global detection as a separate file, both types of Kasan support global variable out of bounds detection simultaneously

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-20 21:47:23 +08:00
wangmingrong1
5c511443fe mm/kasan: Using arrays instead of linked lists
1. Modify the Kasan global variable script to support array storage of region addresses
2. Due to the lack of formatting in the previous attempt, a formatting script was created

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-20 21:47:23 +08:00
wangmingrong1
7796161ee2 mm/kasan:Remove compiler restrictions
The latest version of clang also supports kasan

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-20 21:47:23 +08:00
wangmingrong1
0916461f8b arm/qemu: Add mounting of tmpfs
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-20 21:24:50 +08:00
raiden00pl
cafd563da1 github/workflows: add auto labeler for PR
this commit adds initial support for auto labeler for PR
based on https://github.com/actions/labeler
2024-09-20 10:02:18 -03:00
Shoukui Zhang
985e539e02 i2c: Optimize access to private data
Signed-off-by: Shoukui Zhang <zhangshoukui@xiaomi.com>
2024-09-20 13:28:03 +02:00
Shoukui Zhang
2c543c27bf Fix greater-than-or-equal-to-zero issue
unsigned_compare: This greater-than-or-equal-to-zero comparison without a signed value is always true. ndx >= 0U

Signed-off-by: Shoukui Zhang <zhangshoukui@xiaomi.com>
2024-09-20 12:34:27 +02:00
wangjianyu3
44cce29d12 libs/gnssutils: Ignore source zip
Log:
  Untracked files:
    (use "git add <file>..." to include in what will be committed)
          libs/libc/gnssutils/db46128e73cee26d6a6eb0482dcba544ee1ea9f5.zip

  nothing added to commit but untracked files present (use "git add" to track)

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-20 14:38:43 +08:00
wangjianyu3
b14b15ac2d nrf91: Update GPS to GNSS
Related: 03f4ec7765ed8b3551f1a2bc8198c5007a542788

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-20 14:38:43 +08:00
simbit18
6a0c0722e2 CI: Improvement to speed up compilation and reduce download errors.
The simple improvement is designed to speed up compilation and reduce download errors on github and local.

Added a folder nxtmpdir for storing third-party packages

nuttxworkspace
|
|- nuttx
|- apps
|- nxtmpdir

tools/Unix.mk:
added export NXTMPDIR := $(WSDIR)/nxtmpdir

tools/configure.sh:
added option -S creates the nxtmpdir folder for third-party packages.

tools/Config.mk:
added macro
CLONE - Git clone repository.
CHECK_COMMITSHA - Check if the branch contains the commit SHA-1.

tools/testbuild.sh:
added option -S

For now I added in the folder this package

ESP_HAL_3RDPARTY_URL = https://github.com/espressif/esp-hal-3rdparty.git

ARCH
arch/xtensa/src/esp32/Make.defs
arch/xtensa/src/esp32s2/Make.defs
arch/xtensa/src/esp32s3/Make.defs
arch/risc-v/src/common/espressif/Make.defs
arch/risc-v/src/esp32c3-legacy/Make.defs

but you can also add other packages (maybe also of apps)
2024-09-20 11:26:01 +08:00
Stuart Ianna
b60a8b216b arch/risc-v/src/litex_ticked: Set initial tick count to known value.
The tick count should be manually set as there is no guarantee that the
previous boot stage hasn't modified this count since reset.
2024-09-20 10:51:45 +08:00
chao an
b82717b9e6 arm/cortex-a,r: replace cp15 instruct to macros to align operation
This is continue work of https://github.com/apache/nuttx/pull/13486

Discussion here:
https://github.com/apache/nuttx/pull/13486#discussion_r1764354675

1. move cp15.h to arch public
2. replace cp15 instruct to macros to align operation
3. add memory barrier to avoid compiler optimization

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-20 09:29:57 +08:00
xuxin19
e627850442 build(bugfix):ensure compatibility between kconfig-frontend and kconfiglib in kernel build
Because kconfiglib recognizes MODULE configuration but not modules attributes,
and kconfig-frontend is compatible with the latest modules attributes of Linux,
we can only use the old version to use MODULE configuration plus options modules to be compatible with both.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-20 07:26:32 +08:00
raiden00pl
31b2438ac1 github/workflows: add PR size labeler
add workflow that assigns labels based on the PR's size
2024-09-19 22:19:12 +08:00
wangjianyu3
1fabad67ec lilygo_tbeam_lora_gps/gps: Enable GNSSUTILS_MINMEA_LIB for EXAMPLES_GPS
Log:
  ./gps_main.c:33:10: fatal error: minmea/minmea.h: No such file or directory
     33 | #include <minmea/minmea.h>
        |          ^~~~~~~~~~~~~~~~~
  compilation terminated.
  ERROR: xtensa-esp32-elf-gcc failed: 1
         command: xtensa-esp32-elf-gcc -MT ./gps_main.c.github.workspace.sources.apps.examples.gps.o  -M '-fno-common' '-Wall' '-Wstrict-prototypes' '-Wshadow' '-Wundef' '-Wno-attributes' '-Wno-unknown-pragmas' '-Wno-psabi' '-Os' '-fno-strict-aliasing' '-fomit-frame-pointer' '-ffunction-sections' '-fdata-sections' '-mlongcalls' '-isystem' '/github/workspace/sources/nuttx/include' '-D__NuttX__' '-DNDEBUG' '-D__KERNEL__' '-Wno-cpp' '-Werror' '-I' '/github/workspace/sources/apps/include' ./gps_main.c
  gps_main.c:33:10: fatal error: minmea/minmea.h: No such file or directory
     33 | #include <minmea/minmea.h>
        |          ^~~~~~~~~~~~~~~~~
  compilation terminated.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 22:13:42 +08:00
wangjianyu3
bdddc76997 nuttx/uorb: Fix incompatible type error
Related: b17c074a18

Log:
  Error: sensors/ms56xx_uorb.c:145:20: error: initialization of 'int (*)(struct sensor_lowerhalf_s *, struct file *, uint32_t *)' {aka 'int (*)(struct sensor_lowerhalf_s *, struct file *, unsigned int *)'} from incompatible pointer type 'int (*)(struct sensor_lowerhalf_s *, struct file *, long unsigned int *)' [-Werror=incompatible-pointer-types]
    145 |   .set_interval  = ms56xx_set_interval,
        |                    ^~~~~~~~~~~~~~~~~~~
  sensors/ms56xx_uorb.c:145:20: note: (near initialization for 'g_sensor_ops.set_interval')
  cc1: all warnings being treated as errors

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 19:54:38 +08:00
wangjianyu3
3ab62370cb nuttx/uorb: Fix initialization error of variable of type struct sensor_ops_s
Related change:
  .flush    : 403469336f
  .get_info : 703bb7e7b3

Error Log:
  1153  Building NuttX...
  1154Error: sensors/bme680_uorb.c:428:3: error: initialization of 'int (*)(struct sensor_lowerhalf_s *, struct file *, long unsigned int)' from incompatible pointer type 'int (*)(struct sensor_lowerhalf_s *, struct file *, int,  long unsigned int)' [-Werror=incompatible-pointer-types]
  1155  428 |   bme680_control    /* control */
  1156      |   ^~~~~~~~~~~~~~

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 19:54:38 +08:00
wanggang26
f6c1d88931 mmcsd: fix a build error
Error: mmcsd/mmcsd_sdio.c:1419:12: error: 'mmcsd_setblockcount' defined
but not used [-Werror=unused-function]
1172 1419 | static int mmcsd_setblockcount(FAR struct mmcsd_state_s
*priv,

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-09-19 15:44:59 +08:00
guoshichao
f01a2c70fd greenhills: fix the enumerated type mixed using warning
CC:  obstack/lib_obstack_printf.c "mmap/fs_rammap.c", line 126: warning #188-D: enumerated type mixed with
          another type
    enum mm_map_type_e type = (uintptr_t)entry->priv.p & 3;
                              ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-09-19 14:08:07 +08:00
wangjianyu3
012dcc41a2 sim/minmea: Fix defconfig warning
Warning/Error:
  $ ./tools/configure.sh -l sim:minmea
  $ make defconfig
  $ make savedefconfig
  $ diff defconfig boards/sim/sim/sim/configs/minmea/defconfig
  38d37
  < CONFIG_GNSSUTILS_MINMEA_LIB=y
  39a39
  > CONFIG_GNSSUTILS_MINMEA_LIB=y

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 13:49:55 +08:00
wanggang26
1a6e8b9c99 mmcsd: fix a logic error
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-09-19 07:29:33 +02:00
wangjianyu3
d2b58a520e sensor.c: Rename container_of to list_container_of
https://github.com/apache/nuttx/pull/11805

Log:
    /github/workspace/sources/nuttx/drivers/sensors/usensor.c: In function 'usensor_get_info':
    Warning: /github/workspace/sources/nuttx/drivers/sensors/usensor.c:228:44: warning: implicit declaration of function 'container_of'; did you mean 'list_container_of'? [-Wimplicit-function-declaration]
      228 |   FAR struct usensor_lowerhalf_s *ulower = container_of(lower,
          |                                            ^~~~~~~~~~~~
          |                                            list_container_of
    Error: /github/workspace/sources/nuttx/drivers/sensors/usensor.c:229:44: error: expected expression before 'struct'
      229 |                                            struct usensor_lowerhalf_s,
          |                                            ^~~~~~
    /github/workspace/sources/nuttx/drivers/sensors/usensor.c: In function 'usensor_control':
    Error: /github/workspace/sources/nuttx/drivers/sensors/usensor.c:241:44: error: expected expression before 'struct'
      241 |                                            struct usensor_lowerhalf_s,
          |                                            ^~~~~~

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 11:45:11 +08:00
likun17
71876ae098 lib_libvscanf.c:Add buffer data type conversion interface.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-19 11:44:47 +08:00
likun17
89a3f28a76 lib_libvsprintf.c:Add buffer data type conversion interface.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-19 11:44:47 +08:00
Petro Karashchenko
f0267bc507 arch/arm/samv7: add support of SocketLIN interface
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-09-19 09:39:54 +08:00
Petro Karashchenko
549ad08013 can/sja1000: drop driver dependency on __builtin functions
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-09-19 09:39:04 +08:00
xuxin19
1d3dd328dd modify BUILD_LOADABLE to MODULES which backwards-compatible Kernel
maintains the same semantics as Kernel’s module build
and compatible with Kconfiglib implementation.

The problem of kconfiglib not being able to use tri-states is this:
linux is here torvalds/linux@6dd85ff
The module option is extracted from one of the triate three states into a MODULE keyword.
Kconfiglib supports the default implementation of module to be MODULE for compatibility with the linux kernel, and triate degenerates into bool two states
Refer to this code: 061e71f7d7/kconfiglib.py (L4274-L4284)

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-19 08:32:03 +08:00
hujun5
0561b55860 arm: optimize up_interrupt_context used in armv[6/7/8]-m
resson:
using percpu storage for g_current_regs or leveraging interrupt status
registers to determine if code is running within an interrupt context can enhance performance.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-19 08:30:09 +08:00
hujun5
6a3a32b185 arch: move up_interrupt_context to arch specific irq.h
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-19 08:30:09 +08:00
hujun5
a754c517cc irq: use per-cpu reg to replace g_current_regs
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-19 08:30:09 +08:00
Shoukui Zhang
5d3d123272 BCH: Add readonly configuration for BCH devices
Signed-off-by: Shoukui Zhang <zhangshoukui@xiaomi.com>
2024-09-19 03:53:20 +08:00
anjiahao
e085f0ee80 armv8-m:arch libc function need save ip register use pacbti
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-19 03:50:53 +08:00