This is a tool for associating discrete IDs with addresses.
This tool is implemented through the red-black tree method provided by <sys/tree.h>, and the time complexity when calling, searching, and deleting is optimized to O(logn)
The implementation is the moving node operation of two red-black trees
1. When applying for a node, it will first check whether there is an available node in the "removed" tree. If so, the memory address of the node will be reused and moved to the "alloced" tree.
2. If the "removed" tree is an "empty tree", then the node will be requested from the memory and added to the "alloced" tree
3. Similarly, when removing a node, we set the address pointed to in the node to "NULL" and move it to the "removed" tree. Next time we alloc the node, we can reduce the overhead caused by memory application
For now, we still have something that can be optimized, and that is the memory elimination mechanism of the "removed tree". The current implementation will only release all the content under the "removed" tree when the idtree is destroyed.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
==263401==ERROR: AddressSanitizer: stack-use-after-return on address 0xf515f260 at pc 0x042434f0 bp 0x9ac24e78 sp 0x9ac24e68
WRITE of size 4 at 0xf515f260 thread T0
#0 0x42434ef in nxsem_get_value semaphore/sem_getvalue.c:65
#1 0x413110d in work_thread wqueue/kwork_thread.c:195
#2 0x412c4f6 in nxtask_start task/task_start.c:129
#3 0x427b1fc in pre_start sim/sim_initialstate.c:52
Address 0xf515f260 is located in stack of thread T0 at offset 32 in frame
#0 0x928c9e3 in host_settimer sim/posix/sim_hosttime.c:104
This frame has 1 object(s):
[32, 48) 'it' (line 105) <== Memory access at offset 32 is inside this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
(longjmp and C++ exceptions *are* supported)
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
stack dump add new region `show stacks`, but this script is not support
now this is fixed with adding check condition for all lines contains stack word
Signed-off-by: xinbingnan <xinbingnan@xiaomi.com>
If per tick is set to 10ms, it will cause nxsig_usleep(1000) in the
sdio driver to sleep for 19ms, which is much longer than the
expected 1ms, resulting in very low write performance. Add option to
reduce CPU hogging by using sched_yield(), though it may also affect
write performance when the CPU is busy.
Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
arch/xtensa/src/esp32s3/hardware/esp32s3_sdmmc.h|esp32s3_soc.h,
boards/xtensa/esp32s3/common/include/esp32s3_board_sdmmc.h,
boards/xtensa/esp32s3/common/src/Make.defs|esp32s3_board_sdmmc.c,
boards/xtensa/esp32s3/esp32s3-devkit/src/esp32s3_bringup.c: add SD/mmc driver
Support 1-bit bus width and 4-bit bus width. Support eMMC high speed SDR mode.
Support transfer data with DMA. Support SD clock frequency up to 40MHZ.
Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
In mmcsd_cardidentify(), the clock is not enabled before issuing
CMD0, and the clock has been disabled in mmcsd_removed(). It makes
no sense to enable the clock after issuing CMD0, because when CMD0
is issued, it will exit with error due to the clock is not enabled.
Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Prompts for capacity, speed mode and bus width after eMMC
initialization is completed.
Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
According to the eMMC specification, in Backwards Compatibility
with legacy MMC card mode, the frequency of the SD clock must be
0-26 MHZ; in high speed SDR mode, it must be 0-52MHZ. So we should
switch to high speed SDR mode if the clock frequency is higher than
26MHZ.
Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
CMD6 can use these macros to set any writable EXT_CSD field, not
just the bus width, so optimize these macro definitions to make
them general.
Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
All eMMC devices support 4-bit bus width, so we should mark the
device as supporting 4-bit bus width after detecting that the
device type is eMMC.
Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
When CONFIG_NETDB_RESOLVCONF is enabled, CONFIG_NETDB_DNSSERVER_NAMESERVERS
will undefined, could cause net/icmpv6/icmpv6_input.c build error.
just add one nameserver to avoid overwrite ipv4 nameserver.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
solve the compiling problem of the third-party library,
add IN6_IS_ADDR_MC_LINKLOCAL and IN6_IS_ADDR_SITELOCAL definitions.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
(1) Keep the `.init_array` and `.ctors` symbols and sort them according to their initialization priority.
(2) Exclude symbols ending with crtend.* and crtbegin.* to support c++
application.if we not exclude crtend.* crtbegin.* frame_dummy will be
added when enable any c++ application with global variables, this symbol
execution is problematic, removing it does not affect the application.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
Traceback (most recent call last):
File nuttx/tools/parsetrace.py, line 29, in <module>
from pycstruct import pycstruct
ModuleNotFoundError: No module named 'pycstruct'
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
"libcxxmini/libxx_cxa_guard.cxx", line 47: error #77-D: this declaration has
no storage class or type specifier
__extension__ typedef int __guard __attribute__((mode(__DI__)));
^
"libcxxmini/libxx_cxa_guard.cxx", line 47: error #65: expected a ";"
__extension__ typedef int __guard __attribute__((mode(__DI__)));
^
"libcxxmini/libxx_cxa_guard.cxx", line 64: error #20: identifier "__guard" is
undefined
int __cxa_guard_acquire(FAR __guard *g)
^
"libcxxmini/libxx_cxa_guard.cxx", line 64: error #20: identifier "g" is
undefined
int __cxa_guard_acquire(FAR __guard *g)
^
"libcxxmini/libxx_cxa_guard.cxx", line 65: error #65: expected a ";"
{
^
"libcxxmini/libxx_cxa_guard.cxx", line 93: warning #12-D: parsing restarts
here after previous syntax error
}
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
CC: unistd/lib_setregid.c "/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/nuttx/irq.h", line 53: warning #193-D:
zero used for undefined preprocessing identifier "NR_IRQS"
# if NR_IRQS <= 256
^
"/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/nuttx/irq.h", line 82: warning #193-D:
zero used for undefined preprocessing identifier "NR_IRQS"
#if NR_IRQS <= 256
CC: mount/fs_umount2.c "/mnt/yang/qixinwei_vela_warnings_04_23/nuttx/include/nuttx/irq.h", line 72: warning #193-D:
zero used for undefined preprocessing identifier "NR_IRQS"
#if NR_IRQS <= 256
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
CC: src/algslib_sha256.c "comlin.c", line 189: error #1982-D: target stack alignment is insufficient to
guarantee alignment of this variable
struct can_frame lin_err_frame = comlin_rx_frame[chlId];
^
"comlin.c", line 282: error #1982-D: target stack alignment is insufficient to
guarantee alignment of this variable
struct can_frame frame;
^
"comlin.c", line 321: error #1982-D: target stack alignment is insufficient to
guarantee alignment of this variable
struct can_frame frame;
"DiagServer_IsoTp.c", line 220: error #1982-D: target stack alignment is
insufficient to guarantee alignment of this variable
struct canfd_frame frame = {0};
^
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
the greenhills compiler provide its own implementation of va_start,
va_end, va_arg, va_copy. so if we are build vela with greenhills
compiler, we should using the stdarg implementation provided by
greenhills, not our own
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
"stdio/lib_dtoa_engine.c", line 102: error #166: invalid floating constant
if (x < MIN_MANT)
^
"stdio/lib_dtoa_engine.c", line 102: warning #1626-D: concatenation with "("
in macro "PASTE" does not create a valid token
if (x < MIN_MANT)
^
"stdio/lib_dtoa_engine.c", line 102: error #109: expression preceding
parentheses of apparent call must have (pointer-to-) function type
if (x < MIN_MANT)
^
"stdio/lib_dtoa_engine.c", line 107: error #166: invalid floating constant
if (y < MAX_MANT)
^
"stdio/lib_dtoa_engine.c", line 107: warning #1626-D: concatenation with "("
in macro "PASTE" does not create a valid token
if (y < MAX_MANT)
^
"stdio/lib_dtoa_engine.c", line 107: error #109: expression preceding
parentheses of apparent call must have (pointer-to-) function type
if (y < MAX_MANT)
^
"stdio/lib_dtoa_engine.c", line 119: error #166: invalid floating constant
if (y >= MIN_MANT)
^
"stdio/lib_dtoa_engine.c", line 119: warning #1626-D: concatenation with "("
in macro "PASTE" does not create a valid token
if (y >= MIN_MANT)
^
"stdio/lib_dtoa_engine.c", line 119: error #109: expression preceding
parentheses of apparent call must have (pointer-to-) function type
if (y >= MIN_MANT)
^
"stdio/lib_dtoa_engine.c", line 144: error #166: invalid floating constant
if (x >= MAX_MANT)
^
"stdio/lib_dtoa_engine.c", line 144: warning #1626-D: concatenation with "("
in macro "PASTE" does not create a valid token
if (x >= MAX_MANT)
^
"stdio/lib_dtoa_engine.c", line 144: error #109: expression preceding
parentheses of apparent call must have (pointer-to-) function type
if (x >= MAX_MANT)
^
"stdio/lib_dtoa_engine.c", line 153: error #166: invalid floating constant
uint64_t decimal = MIN_MANT_INT;
^
"stdio/lib_dtoa_engine.c", line 153: warning #1626-D: concatenation with "("
in macro "PASTE" does not create a valid token
uint64_t decimal = MIN_MANT_INT;
^
"stdio/lib_dtoa_engine.c", line 153: error #109: expression preceding
parentheses of apparent call must have (pointer-to-) function type
uint64_t decimal = MIN_MANT_INT;
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
the mempool_alloc and mempool_free function are duplicate with the
mempool method that provided in optee_os, in order to port optee_os, so
we rename the mempool related functions in nuttx
Signed-off-by: guoshichao <guoshichao@xiaomi.com>