README.rst
1.. zephyr:code-sample:: crc_subsys
2 :name: Cyclic Redundancy Check Subsystem (CRC Subsys)
3 :relevant-api: crc
4
5 Compute and verify a CRC computation using the CRC subsys API.
6
7Overview
8********
9
10This sample demonstrates how to use the Cyclic Redundancy Check Subsystem
11
12Configuration Options
13*********************
14
15This sample uses the following Kconfig options:
16
17- :kconfig:option:`CONFIG_CRC`: Enable CRC functionality.
18- :kconfig:option-regex:`CONFIG_CRC[0-9].*`: Force software-based CRC if a ``zephyr,crc`` property
19 has been set in the ``/chosen`` node in Devicetree; otherwise, hardware acceleration is used.
20
21These options can be modified in the project's ``prj.conf`` file or passed via CMake arguments.
22
23Building and Running
24********************
25
26Building and Running for Renesas RA8M1
27======================================
28
29The sample can be built and executed for the
30:zephyr:board:`ek_ra8m1` as follows:
31
32.. zephyr-app-commands::
33 :zephyr-app: samples/subsys/crc
34 :board: ek_ra8m1
35 :goals: build flash
36 :compact:
37
38To build for another board, change "ek_ra8m1" above to that board's name.
39
40Sample Output
41=============
42
43.. code-block:: console
44
45 subsys_crc_example: Result of CRC32 IEEE: 0xCEA4A6C2
46 subsys_crc_example: Result of CRC8 CCITT: 0x96
47 subsys_crc_example: CRC computation completed successfully
48
49.. note::
50 If the board does not support a hardware CRC driver, the computation will fall
51 back to a software-based implementation.
52
53Expected Behavior
54*****************
55
56When the sample runs, it should:
57
581. Compute the CRC32 and CRC8 values of predefined data.
592. Print the computed CRC values.
60