the -fmacro-prefix-map compile option is gcc/clang/armclang specific
compile option, and greenhills do not recognize this compile option, if
we add this option is CMakeLists.txt, the following warning will be
reported when each file is being compiled:
ccarm: Warning: Unknown option "-fmacro-prefix-map=/home/guoshichao/work_profile/vela_os/vela_car_5/nuttx=" passed to linker
ccarm: Warning: Unknown option "-fmacro-prefix-map=/home/guoshichao/work_profile/vela_os/vela_car_5/apps=" passed to linker
ccarm: Warning: Unknown option "-fmacro-prefix-map=/home/guoshichao/work_profile/vela_os/vela_car_5/vendor/flagchip/boards/mann/dcu/fc4150f1m-labm_a1=" passed to linker
ccarm: Warning: Unknown option "-fmacro-prefix-map=/home/guoshichao/work_profile/vela_os/vela_car_5/vendor/flagchip/chips/fc4150=" passed to linker
ccarm: Warning: Unknown option "-fmacro-prefix-map=/home/guoshichao/work_profile/vela_os/vela_car_5/nuttx=" passed to linker
ccarm: Warning: Unknown option "-fmacro-prefix-map=/home/guoshichao/work_profile/vela_os/vela_car_5/apps=" passed to linker
ccarm: Warning: Unknown option "-fmacro-prefix-map=/home/guoshichao/work_profile/vela_os/vela_car_5/vendor/flagchip/boards/mann/dcu/fc4150f1m-labm_a1=" passed to linker
ccarm: Warning: Unknown option "-fmacro-prefix-map=/home/guoshichao/work_profile/vela_os/vela_car_5/vendor/flagchip/chips/fc4150=" passed to linker
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
Avoid the errno changed after interrupt in sim and make return value
mistake when according to errno.
Move host_errno_convert from macro to sim_errno.c.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
We will remove the API in next commit, so remove the errno manual save
API and save errno more commonly.
After whole pull request, should no longer need to care about errno.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This reverts commit ac5b38c9e5.
Keep host_errno_convert as a common interface in sim_internal.h
Keep the up_irq_save & up_irq_restore as common interface
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
rename nxsched_timer_expiration to nxsched_tick_expiration
to align with nxsched_process_tick()
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
The cmocka test framework is compiled as a library by default in
(apache/nuttx-apps#3270), and does not include the cmocka application
binary unless CONFIG_TESTING_CMOCKA_PROG=y. This commit updates the
defconfigs which include cmocka to also compile the cmocka binary, which
is the behaviour they were created with.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Fix a race on userfs_state_s iobuffer.
1. Task 1 takes the mutex and does a userfs operation.
2. A higher priority task 2 blocks on the mutex.
3. Task 1 releases the mutex when finished. The iobuffer response has not
been processed by task 1 yet, but task 2 is higher priority
and control switches to it.
4. Task 2 does a userfs operation and releases the mutex.
The iobuffer now contains task 2's response.
5. Control returns to task 1 for it to check the iobuffer
response. It contains task 2's response, not its own.
Fix it by releasing the mutex only after the exclusive iobuffer
usage lifecycle is complete.
Signed-off-by: liamHowatt <liamjmh0@gmail.com>
Remove unnecessary parentheses around case labels in switch statements
for power management callback functions. This fixes checkpatch style
violations for case statement formatting.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Implement gnss_get_info callback function to support device information query for GNSS sensor devices through the sensor framework.
Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
This commit simplified the wdog expiration handling by introducing the
`g_sched_event` timer.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
According to the test results, the restart interface offers no
performance improvement and requires additional state to encode the
non-pending state. This commit removed the wd_restart API to simplify
the wdog module.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
The TLS initialization logic needs to be updated to match the modified
linker script section definitions. The previous implementation assumed
that _END_TDATA and _START_TBSS were contiguous, but there may be
padding between these sections for alignment purposes.
This commit updates up_tls_initialize() to explicitly account for the
padding gap between _END_TDATA and _START_TBSS when zeroing the .tbss
section. The size calculation in up_tls_size() is also updated to use
_END_TBSS instead of the previous _END_TXXX definition to match the
current linker script layout.
Changes:
- Calculate padding gap: (_START_TBSS - _END_TDATA)
- Zero .tbss at correct offset accounting for padding
- Update size calculation to use proper section boundaries
Signed-off-by: guoshengyuan1 <guoshengyuan1@xiaomi.com>
Reimplement __aeabi_read_tp using naked function with inline assembly
to strictly follow ARM EABI TLS helper specification.
The ARM EABI specifies that __aeabi_read_tp may only modify r0, and
compilers rely on this guarantee by NOT saving r1-r3 registers when
calling this function. The previous simple C implementation could
potentially clobber these registers through compiler optimizations,
violating the ABI contract and causing subtle bugs.
Changes:
- Add __aeabi_read_tp_core() helper to allow tls_get_info() macro
expansion in C context
- Explicitly preserve r1-r3 registers per EABI requirement
This ensures proper register usage compliance for all calling contexts
while maintaining the ability to use tls_get_info() macro correctly.
Reference: ARM EABI TLS Helper Specification
https://github.com/ARM-software/abi-aa/blob/main/rtabi32/rtabi32.rst#thread-local-storage-new-in-v2-01
Signed-off-by: guoshengyuan1 <guoshengyuan1@xiaomi.com>
issue description:
task A: NSH:
1.open-> reboot->sync->task_fsfsync
2.nx_vopen-> context switch
3.fdlist_allocate: ----> 4.fsync->file_sync->assert(inode or priv is empty)
(new fd with empty filep)
5.file_vopen:
(init empty filep)
6.return fd
Task A allocates a new fd with an empty filep in fdlist_allocate. Before
it can fully initialize the filep in file_vopen, the NSH task triggers a
file - system sync operation. The sync operation encounters the empty
filep associated with the newly allocated fd, causing the assertion to
fail and the system to crash.
To resolve this race condition, we should modify the fd allocation
process. Instead of allocating a new fd with an empty filep first and
then initializing it later, we should use the file_allocate_from_inode
function. This function allows us to initialize the file structure first
and then bind it to the new filep when allocating the fd. By doing so,
we ensure that the filep is always properly initialized before it is
used in any file - system operations, thus preventing the assertion
failure and the subsequent system crash.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
Add basic timer operations to the kernel, including registration,
start/stop, and callback handling. This provides a consistent timer
interface for use by kernel components and drivers.
Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
1. move drop packets function from port spi to port;
2. add drop packets logic when reconnect to peer;
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: liaoao <liaoao@xiaomi.com>
Fix incorrect and non-existent flag usage in LIN handling:
- Replace undefined CANFD_FLAGS_BITS usage with valid bit definitions.
- Reassign CAN_TCF_FLAG to an available flag bit, as it is not defined in can.h.
- Add an identifier for LIN noise error frames.
Signed-off-by: wangxiaoxin <wangxiaoxin@xiaomi.com>
The hrtimer infrastructure only works with 64-bit system timers.
Add a dependency on SYSTEM_TIME64 in the hrtimer Kconfig.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
Separate SMP-specific logic from the hrtimer core to improve
performance and maintainability.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
rpmsg_test is a rpmsg api test service inside the kernel, and user
can use ioctl to start this test.
Signed-off-by: mazhuang <mazhuang@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: wangshaoxin <wangshaoxin@xiaomi.com>
This commit added dependency on CONFIG_SYSTEM_TIME64 for the hrtimer, sin
ce the hrtimer use `clock_compare` to compare 64-bit time.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit renamed the callback type to `hrtimer_entry_t`, aligning with
the `wdentry_t` in wdog..
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
The expired field can not be used to indicate the cancelled state. Because
the `UINT64_MAX` is valid expired time. A periodic hrtimer started with
the hrtimer_start_absolute(hrtimer, period_func, UINT64_MAX) can
not be cancelled via `hrtimer_cancel`.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>