After "utest: re-org utest framework (initial version)" (PR #10534)
was merged, adding a document to introduce how to add utest-cases
for your module.
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
Change the entry of utest's Kconfig from
'examples/utest/testcases/Kconfig' to
'Kconfig.utestcases'.
Modified the build scripts where the path name
is "examples/utest/testcases/Kconfig" and changed
it to 'Kconfig.utestcases', otherwise build
operations such 'scons --dist' may fail.
In the future, the testcase source code of
utest will be placed in each module for
maintenance, but the entry of Kconfig will all
be placed in Kconfig.utestcases for unified
maintenance. In this way, when executing menuconfig,
people can enter and configure from one place,
avoiding searching for utest configuration switches
here and there in the menuconfig interface.
For each module, you can maintain unit-test
in a unified manner in the following way:
- Create a subdirectory named 'utest' in the
directory where your module is located.
- Store the following files in the utest subdirectory:
- Unit test case program source code files for this
module.
- Kconfig file, add configuration options for the
unit test files of this module, the recommended
option is named RT_UTEST_TC_USING_XXXX, XXXX is the
global unique module name of this module.
- SConscript file, note that when adding src files,
in addition to relying on RT_UTEST_TC_USING_XXXX,
you must also rely on RT_UTEST_USING_ALL_CASES, the
two dependencies are in an "or" relationship. The
role of RT_UTEST_USING_ALL_CASES is that once this
option is turned on, all unit tests will be enabled
to avoid selecting one by one.
After completing the above steps, add the path of the
Kconfig file of utest of this module to the
Kconfig.utestcases file.
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
Append a null statement for "Any statement may be preceded by a prefix that declares an identifier as a label name."
Signed-off-by: GuEe-GUI <2991707448@qq.com>
Added a temperature sensor driver and a test file test_ts.c.
The test uses temperature sensor to measure the chip temperature,
to check if the driver works correctly.
Signed-off-by: XU HU 1337858472@qq.com
Originally, the interrupt definitions of various peripherals
were distributed in various peripheral drivers, resulting
in duplicate definitions. Now they are defined in one place.
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
Fixes: 62f3fb4ce5: fix(kernel)/improve(utest):fix the legacy issue related to the length of the object name version #10537
After this patch, if length of object name exceeds (RT_NAME_MAX - 1),
RTT will assert and oops when runing, but not in period of building.
Though I don't think it's a good solution, but don't want to argue more
about this.
Old RT_NAME_MAX is 8 for k230, and some object names, such as
"hwtimer0", which name length is 8, breaking the new rule.
Just update configuration of k230 bsp and increase RT_NAME_MAX from
8 to 16, which should be long enough for k230.
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
This commit introduces the PDMA (Peripheral DMA) driver for K230 SoC,
providing essential DMA capabilities for peripheral data transfers.
Key features implemented:
1. PDMA channel request/release management
2. Channel start/stop control
3. Interrupt callback registration
4. Data transfer between device ports and DDR memory
The driver includes:
- Core driver implementation (drv_pdma.c/h)
- Build system support (SConscript)
- Basic test cases (test_pdma.c)
Tested with:
- PDMA channel request/release
- DDR to UART TX FIFO transfers
- UART RX FIFO to DDR transfers
Signed-off-by: eatvector <2302147681@qq.com>
fixed: b084503b6d "[kernel] add UP scheduler critical switch flag."
After this commit, doxygen build with warning:
include/rtthread.h:658: warning: argument 'lock' from the argument list of rt_spin_unlock has multiple @param documentation sections
include/rtthread.h:660: warning: argument 'lock' from the argument list of rt_spin_unlock_irqrestore has multiple @param documentation sections
include/rtthread.h:660: warning: argument 'level' from the argument list of rt_spin_unlock_irqrestore has multiple @param documentation sections
Rootcasue analysis:
src/cpu_up.c and src/cpu_mp.c define two identical functions.
Because the INPUT parameter in the documentation/Doxyfile currently
compiles all source files under ./src, i.e both of them, Doxygen
automatically merges the Doxygen comments for identically named
functions if it finds the content of doxygen comments different,
resulting in multiple @param.
Previously, the API comments in both files were identical, so there
was no problem. However, the b084503b6d change only modified the
comments in src/cpu_up.c but not in src/cpu_mp.c, causing problems.
Another drawback of the b084503b6d change is that Doxygen recommends
a single line for the @brief; multiple lines are not recommended.
Solution:
Given the requirement for a single line for the @brief, this issue
is relatively simple to resolve: simply list the extra content as @note.
Regarding the warning: A perfect solution has not yet been found.
One possible approach is to write a single Doxygen comment for a kernel
API with two implementations. This approach involves writing Doxygen
comments in only one file, such as src/cpu_up.c , while omitting them
in src/cpu_mp.c .
Another solution is to add API comments to include/rtthread.h , but the
RT-Thread include/rtthread.h file is already quite large, and adding
comments there would be even more cumbersome.
A temporary solution currently in use is to ensure that the Doxygen
comments for the same API are identical in both src/cpu_up.c and
src/cpu_mp.c . This ensures that Doxygen compilation does not
generate warnings, and the files are automatically merged into a
single file in the HTML document.
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
In the serial ISR (`rt_hw_serial_isr`), the previous logic for handling a full RX FIFO was flawed. When the buffer was filled, it would increment `get_index` (`get_index += 1`).
This had two negative consequences:
1. It effectively discarded the oldest byte of data prematurely.
2. It reduced the usable capacity of a buffer of size N to N-1. For example, a 64-byte buffer could only ever hold 63 readable bytes after becoming full.
This patch corrects the behavior by implementing a standard overwriting ring buffer strategy. When the buffer is full, the logic is changed to `get_index = put_index`.
This ensures that:
- When new data arrives, it correctly overwrites the oldest data.
- The `get_index` is advanced along with the `put_index`, correctly marking the new start of the buffer.
- The full N-byte capacity of the buffer is utilized, always storing the N most recent bytes.
This change resolves the unexpected data loss and makes the buffer behavior correct and predictable.