This patch addresses the potential issue of uninitialized elements in
the argument vector returned by `lwp_get_command_line_args()`. The
previous implementation could leave `argv` in an inconsistent state
if certain errors occurred, leading to possible undefined behavior.
Changes:
- Replaced `rt_malloc()` with `rt_calloc()` to ensure `argv` is properly initialized.
- Added a consistent error handling path using `goto error_exit` to handle memory allocation failures and string copy errors.
- Ensured `lwp_free_command_line_args()` is called before returning on error, preventing potential memory leaks.
Signed-off-by: Shell <smokewood@qq.com>
Since the completion is used to sync with ISR mostly, we should set the
default semantic to ISR-safe. So most user will be happy and don't see
any weird behavior in their codes.
Changes:
- Added `rt_completion_wait_noisr` and
`rt_completion_wait_flags_noisr` functions in `completion.h`,
`completion_comm.c`, `completion_mp.c`, and `completion_up.c`.
- The new APIs allow waiting for completions in non-ISR contexts
while ensuring thread context safety.
- Existing documentation and comments were updated to clarify
usage contexts and emphasize restrictions on ISR usage.
Signed-off-by: Shell <smokewood@qq.com>
This patch replaces SPI flash mount procedure with generic SPI API. This
patch also try to format the external flash on the first mount failure,
in case of empty or invalid flash content is present on the external SPI
flash.
Signed-off-by: Yilin Sun <imi415@imi.moe>
This patch changed SPI initialization API to standard RT-Thread SPI API.
The current code contains a minor bug which does not wait for WiFi
module ready before stack initialization, this is also fixed.
Signed-off-by: Yilin Sun <imi415@imi.moe>
* bsp: nxp/mcx/mcxn: SPI: Added missing bracket and re-format code.
The closing bracket is missing from SPI6 struct.
Introduced since commit fc1cfd6d3627ba8460d514e7913bd307e8b1d567 .
Use standard rt_spi_device->cs_pin instead of user_data pointer.
---------
Signed-off-by: Yilin Sun <imi415@imi.moe>
Updated CMakeLists.txt generator to handle private macro definitions for
source groups. Individual source groups are added as OBJECT libraries,
which does not generate actual archive but will be linked together at
final application linking stage. Source groups without source files are
added as INTERFACE libraries, which provides library dependencies to the
final application.
Signed-off-by: Yilin Sun <imi415@imi.moe>
RT_USING_STDC_ATOMIC is a user selected option on current config system.
While the RT_USING_HW_ATOMIC is a forced option selected by Kconfig
under libcpu. And the RT_USING_STDC_ATOMIC will be meaningless if we set
RT_USING_HW_ATOMIC to first priority if the arch has hw-atomic.
Changes:
- set RT_USING_STDC_ATOMIC to first priority on rttypes.h
Signed-off-by: Shell <smokewood@qq.com>
For bsp/cvitek, all drivers related files are moved to the directory
bsp/cvitek/drivers, so the drivers_path_prefix processing in the
SConstruct of the three bsp projects can be simplified.
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
Analysis: There is still an omission in the preprocessing control of
_control_rtc in 24b0a81 ("Add RT_USING_RTC conditional
compilation protection in ctimer.c")
Solution: Add RT_USING_RTC preprocessing control to missing
_control_rtc
Signed-off-by: Shicheng Chu <1468559561@qq.com>
Analysis: RT_USING_RTC preprocessing is used in 47cd52d ("修复不
使能 RT_USING_DEVICE 时编译报错") to control the reference of
rtdevice.h, as well as the implementation and call of _control_rtc,
but there are some omissions.
Solution: Add RT_USING_RTC preprocessing control to missing
_control_rtc
Signed-off-by: Shicheng Chu <1468559561@qq.com>
Reviewed-by: Chen Wang <unicorn_wang@outlook.com>