return early due to signal interruption (EINTR). This makes the
main thread think the async operation is done, but the background
worker thread is still running—risking access to freed memory,
race conditions, crashes or undefined behavior.
Using nxsem_wait_uninterruptible():the main thread waits until the
worker thread finishes, preventing these issues.
Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
Align the writing style of arm cmake, and each compiler defines its own find library
function, otherwise use the default
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
Adds defconfig to support SDMMC over SPI for esp32c3-generic, esp32c6-devkitc,
esp32c6-devkitm and esp32h2-devkit.
Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
When the MMU is disabled (CONFIG_ARCH_USE_MMU=n) the
data passed back and forth with the TEE needs to be
synced from/to the cache, otherwise we get random data
in either world.
Fix this by cleaning before a call and invalidating after.
This has to be done both on the optee msg arg, and the shm
buffers therein. Cleaning and invalidating the page list
used to describe non-contiguous shm buffers did not seem
mandatory in my tests, but common sense says that it should
be, so we do that too.
This fix does not apply to the optee msg arg of the socket
transport (optee_socket.c), as that one _should_ be handled
by the socket send/recv methods. It does apply to all shm
buffers though, regardless of transport.
Signed-off-by: George Poulios <gpoulios@census-labs.com>
To save more space (equivalent to the size of one erase sector of
MTD device) and to achieve faster read and write speeds, a method
for direct writing was introduced at the FTL layer.
This can be accomplished simply by using the following oflags during
the open operation:
1. O_DIRECT. when this flag is passed in, ftl internally uses
the direct write strategy and no read cache is used in ftl;
otherwise, each write will be executed with the minimum
granularity of flash erase sector size which means a
"sector read back - erase sector - write sector" operation
is performed by using a read cache buffer in heap.
2. O_SYNC. When this flag is passed in, we assume that the
flash has been erased in advance and no erasure operation
will be performed internally within ftl. O_SYNC will take
effect only when both O_DIRECT and O_SYNC are passed in
simultaneously.
3. For uniformity, we remapped the mount flag in mount.h and
unified it with the open flag in fcntl.h. The repetitive
parts of their definitions were reused, and the remaining
part of the mount flag redefine to the unused bit of open
flags.
Signed-off-by: jingfei <jingfei@xiaomi.com>
This reverts commit 20fcdcf905f279a9c4527be399a90590f458db1f.
The reason is that the erase buffer isn't always used in most cases.
Signed-off-by: jingfei <jingfei@xiaomi.com>
We have adjusted the registration method for MTD devices
in nuttx/boards, replacing the previous approach using
ftl_initialize() and bchdev_register() with
register_mtddriver().
When registering MTD devices via register_mtddriver(),
FTL and BCH wrappers will be added during the open() process:
1. Character Device Mode:
When accessing the MTD device node via the open() interface,
the device will be automatically converted to a character
device. Both FTL and BCH wrappers will be implicitly added,
provided that BCH support is enabled in the configuration.
2. Block Device Mode:
When accessing the MTD device node via open_blockdriver(),
the device will be treated as a block device, with only
the FTL wrapper automatically applied.
Due to the automatic wrapping of MTD devices during the
open() process, the legacy registration methods
ftl_initialize() and bchdev_register() are no longer
required for MTD device registration for user code and should
be used only internally within fs and driver code.
Signed-off-by: jingfei <jingfei@xiaomi.com>
Updates the example documentation for a new example: local update agent.
This example allows the user to update MCUBoot image from a locally stored file.
Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
This commit creates a sbutton device that uses a single button to
create a keyboard driver that returns TAB or ENTER depending how
long the user keeps the button pressed.
Signed-off-by: Alan C. Assis <acassis@gmail.com>
In the toolchain, ARCH_TOOLCHAIN_XXX is used to select the compiler to be used. If clang is selected here, subsequent errors will occur
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
Updates the ADS1115 documentation with information about the two new
commands for triggering conversion and reading the result.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
Since the ADS1115 has a relative slow conversion rate, this additional
ioctl command makes it possible to trigger a conversion before reading
the reading the conversion result, allowing the user to perform other
computation in between instead of waiting for the conversion time to
complete. It improves sampling time.
Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
The tx int handler will call uart_xmitchars() to make a fake interrupt event,
but this is unsafe after enabling interrupts. This PR will add a critical section
to ensure that the txint process will not be interrupted by the IRQ
Signed-off-by: chao an <anchao.archer@bytedance.com>
idr_destroy() would loop over the removed and alloced
RB tree nodes freeing them but not removing them from
the trees. From the perspective of the RB tree those
nodes would remain valid, while in fact, they were free
memory, potentially reallocated for other purposes, or
otherwise overwritten by the allocator with metadata.
This would cause (seemingly random) memory corruption
crashes triggered by the RB tree code trying to access
link fields from the free'd nodes.
Fix that by removing the nodes before freeing them.
Signed-off-by: George Poulios <gpoulios@census-labs.com>
This commit adds support for the HX711 ADC in the STM32F401RC-RS485
board and updates the board documentation accordingly.
Signed-off-by: Rodrigo Sim <rcsim10@gmail.com>
AVR uses Hardward architecture with separate address space for program
memory (flash) and data memory (RAM). Normal program flow can only
access data memory which means that all variables - including const
variables - have to be copied into RAM to be accessible. (This happens
automatically during startup.)
It is possible to work around this limitation in software but that
can have severe impact on performance and/or API complexity. It is hardly
feasible to change NuttX interfaces in a way that would allow to make use
of this workaround.
On newer AVR families, there is an alternative option enabled by this patch.
These chips map part of their program memory (a 32kB window) into data
memory address space. This patch leverages this feature and adds support
for placing const variables into the mapped window. No copy to RAM is done
for them.
Const variables are therefore loaded directly from flash (not consuming
RAM) while still being available to be used by any NuttX interface.
Linker script of breadxavr board is changed to make use of these changes.
Tested by verifying string addresses - parameters in printf call
in a custom application (and also by running the application and verifying
its output.)
Documentation tested by build.
Signed-off-by: Kerogit <kr.git@kerogit.eu>
This patch adds a document that describes why const variables need to be
copied into the RAM in AVR architecture for normal program flow in NuttX.
It then describes options of accessing them directly from the flash without
need to do any copying.
Patch was tested by building the documentation.
Signed-off-by: Kerogit <kr.git@kerogit.eu>
Added logic to set hasdma to false. This is needed to enable or not enable interrupts on a per ADC basis. Made other minor formatting changes.
Fixed build issues with non ADC/DMA configurations.