Method, system, electronic device and storage medium for verifying eMMC functionality
By loading an operating system into the storage device and accessing the eMMC device using the eMMC character device driver, the problem of scattered testing and difficult location in existing eMMC protocol verification is solved, achieving efficient and stable eMMC protocol verification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-21
- Publication Date
- 2026-03-27
AI Technical Summary
Existing eMMC protocol verification methods based on the Android system suffer from problems such as scattered testing and difficulty in locating errors.
By loading the operating system and mounting the root file system in the storage device, the eMMC character device driver is used to access the eMMC device at the kernel level, and protocol test cases are executed at the application layer. The test cases are isolated from other processes, and an eMMC protocol command interface is provided to achieve full coverage testing.
It improves the efficiency and accuracy of eMMC protocol verification, ensures system stability, avoids system crashes, and can change device status through private commands to enhance test coverage.
Smart Images

Figure CN115762625B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of memory, in particular to a method and system for verifying eMMC function, electronic equipment and storage medium. BACKGROUND
[0002] eMMC is the abbreviation of Embedded Multi Media Card, which is a kind of embedded non-volatile memory system composed of flash memory and flash memory controller, and is widely used in terminal products such as mobile phones and tablets.
[0003] In the process of eMMC product development, the verification of eMMC firmware protocol is particularly important, so it is necessary to verify the correctness of eMMC protocol function. The existing solution is based on Android system, and after the terminal device embedded with eMMC is normally started, the eMMC protocol is verified by using Monkey, APK recording video or playing video and other methods. However, when the eMMC protocol is verified by using APK recording video, playing video and other methods based on Android system, there will be problems of test dispersion and difficulty in positioning when eMMC test error occurs. SUMMARY
[0004] The following is a summary of the subject matter detailed herein. This summary is not intended to limit the scope of the claims.
[0005] The embodiments of the present application provide a method and system for verifying eMMC function, electronic equipment and storage medium, which can prevent other processes except test processes from accessing eMMC devices, ensure the normal operation of the system, increase the coverage of eMMC protocol testing, and accurately locate the test problems.
[0006] In a first aspect, the embodiments of the present application provide a method for verifying eMMC function, comprising:
[0007] loading an operating system in a storage device and mounting a root file system in the storage device, wherein the storage device is a secure digital card or a universal flash memory;
[0008] accessing eMMC devices by calling eMMC character device drivers, and verifying the function of the eMMC devices by executing eMMC protocol test cases, wherein the eMMC character device drivers are located in the kernel layer of the operating system, and the eMMC protocol test cases are located in the application layer of the operating system.
[0009] In a second aspect, the embodiments of the present application provide a system for verifying eMMC function, comprising:
[0010] The first processing module is configured to load an operating system in a storage device and mount a root file system to the storage device, wherein the storage device is a secure digital (SD) card or a universal flash storage (UFS).
[0011] The second processing module is configured to access an embedded multi-media card (eMMC) device by calling an eMMC character device driver and verify a function of the eMMC device by executing an eMMC protocol test case, wherein the eMMC character device driver is located in a kernel layer of the operating system, and the eMMC protocol test case is located in an application layer of the operating system.
[0012] In a third aspect, an electronic device is provided, which includes a processor, a memory, and one or more programs stored in the memory and configured to be executed by the processor, and the program, when executed by the processor, implements the method for verifying an eMMC function according to the first aspect.
[0013] In a fourth aspect, a computer readable storage medium is provided, which stores instructions, and when the instructions are executed on a computer, the computer executes the method for verifying an eMMC function according to the embodiments of the present application.
[0014] The embodiments of the present application have at least the following advantages: when verifying an eMMC protocol function, the operating system is started from an SD card or a UFS, the test case is isolated from other processes, and only the test case is allowed to access and operate the eMMC device, and even if the eMMC device has a problem during the test, the system will not crash, thereby ensuring the normal operation of the system and maintaining the stability of the system; when a problem occurs in the test, the problem can be reproduced by the eMMC protocol test case, so that the firmware developer can easily locate the problem of the eMMC device. By mounting the eMMC character device driver in the kernel space and providing all command interfaces defined by the eMMC protocol to the application layer, the eMMC protocol test case of the application layer can call these command interfaces to access the eMMC device, so that the personnel who write the application layer test case can formulate any test sequence to increase the test points and the coverage of the test case, thereby facilitating the positioning of the test problem. Since all test cases run in an automated order and stop only when an error occurs, the verification efficiency can be improved. In addition, the state of the eMMC device or firmware upgrade can be changed by defining and issuing private commands in the eMMC protocol test case. BRIEF DESCRIPTION OF DRAWINGS
[0015] Figure 1 A flowchart of a method for verifying an eMMC function according to an embodiment of the present application.
[0016] Figure 2 A framework of a test case in an embodiment of the present application.
[0017] Figure 3 A flowchart of verifying eMMC function in an embodiment of the present application.
[0018] Figure 4 A protocol screenshot captured by a logic analyzer in an embodiment of the present application.
[0019] Figure 5 A system schematic diagram of verifying eMMC function in an embodiment of the present application.
[0020] Figure 6 A structural diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0021] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0022] It should be understood that, if the orientation description is involved in the specification, the claims and the above drawings, such as the orientation or position relationship indicated by the orientation or position relationship shown in the drawings, is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application.
[0023] It should be noted that the meaning of at least one is one or more, the meaning of more than two, and greater than, less than, more than, etc. are not included in the number, and above, below, etc. are included in the number. If it is described that the first and the second are only used for distinguishing technical features for the purpose, it cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features or implicitly indicating the sequence of indicated technical features.
[0024] Reference Figure 1 A method flowchart for verifying eMMC function provided in an embodiment of the present application can include but is not limited to:
[0025] Step S100: loading an operating system in a storage device and mounting a root file system in the storage device, wherein the storage device is a secure digital card or a universal flash storage.
[0026] Specifically, starting from a secure digital card (SD card) or a universal flash memory (UFS), and mounting a root file system on the SD card or the UFS, a test environment is provided by the SD card and the UFS. The advantage of using the SD card or the UFS as the test environment is that, since other processes read and write files only operate on the SD card or the UFS, the eMMC device is not accessed and operated, so that the eMMC device can be accessed by processes other than the eMMC protocol test case, and the running of the eMMC protocol test case does not affect the running of other processes, ensuring the stability of the system.
[0027] Step S200: accessing the eMMC device by calling an eMMC character device driver, and executing an eMMC protocol test case to verify the function of the eMMC device, wherein the eMMC character device driver is located in the kernel layer of the operating system, and the eMMC protocol test case is located in the application layer of the operating system.
[0028] Specifically, the eMMC driver in the kernel space of the operating system is originally a block device driver, but since the eMMC device is accessed from the application layer through the file system, the eMMC device can only be accessed in the form of the file system to perform read and write operations, and the actual read and write logical unit addresses of the eMMC cannot be controlled, thereby causing some eMMC commands, such as cmd6 switch commands and cmd8 SEND_EXT_CSD commands, to be unable to be tested. In the embodiment of the present application, a character device driver is used to replace the original eMMC block device driver in the kernel space, and the eMMC device is accessed through the character device driver. In this way, the function of the eMMC device can be directly tested in the application layer, so that the personnel who write the test case can write the test case in the application layer, and the purpose of verifying the eMMC function can be achieved by running the test case in the application layer.
[0029] Reference Figure 2 A test case framework is provided for the embodiment of the present application. By using the framework as shown in Figure 2 , the eMMC character device driver in the kernel layer of the Linux operating system provides an eMMC character driver interface to the application layer, so that the eMMC protocol test case in the application layer can access the eMMC device by calling the eMMC character driver interface. The personnel who write the test case can provide comprehensive test coverage for various application scenarios by formulating any test sequence, and can also define various private commands in consultation with the eMMC firmware developers, which are used to change the internal state of the eMMC device, thereby improving the verification efficiency and coverage of the eMMC function.
[0030] As an example, reference is made to Figure 3A flowchart for verifying eMMC protocol function of an SD card is provided in the embodiments of the present application. The SD card is started first, then the Linux operating system is loaded into the memory, then the root file system is mounted on the SD card, and finally the eMMC protocol test case is run to test the eMMC protocol function.
[0031] In some embodiments, step S200 can include but is not limited to:
[0032] Step S201: issuing eMMC protocol commands and parameters in the eMMC protocol test case to the eMMC character device driver through the eMMC character driver interface.
[0033] The eMMC character driver interface is an interface of the eMMC protocol commands provided by the eMMC character device driver to the application layer, such as the "open", "write", "read" and "close" command interfaces. The eMMC protocol test case can pass the eMMC protocol commands and parameters to the eMMC character device driver through the character driver interface, access the eMMC device by calling the eMMC character device driver, obtain the execution result of the eMMC device on the eMMC protocol commands and parameters, and verify the execution result.
[0034] Step S202: in response to the call of the eMMC character driver interface, the eMMC character device driver issues the eMMC protocol commands and parameters to the eMMC device, obtains the execution result of the eMMC device on the eMMC protocol commands and parameters, and returns the execution result to the eMMC protocol test case.
[0035] Specifically, as an example, the eMMC protocol test case of the application layer can issue the eMMC protocol commands and parameters through the write interface, the eMMC character device driver operates the host eMMC control register, issues the eMMC protocol commands and parameters to the eMMC device, and returns the response of the eMMC device to the application layer through the read interface, so that the eMMC protocol test case can judge whether the response is correct.
[0036] Step S203: verifying whether the execution result is correct through the eMMC protocol test case.
[0037] In some embodiments, step S200 can also include but is not limited to:
[0038] Step S204: responding to the eMMC protocol commands and parameters in the eMMC protocol test case through the eMMC character device driver.
[0039] Step S205: If the eMMC protocol command contains a data transfer task, send the eMMC protocol command to the eMMC device and start the direct memory access function to execute the data transfer task.
[0040] Step S206: If the eMMC protocol command does not contain a data transfer task, send the eMMC protocol command to the eMMC device.
[0041] In some embodiments, step S200 can include but is not limited to:
[0042] Send an initialization command to the eMMC device by calling the eMMC character device driver to complete the initialization of the eMMC device.
[0043] The embodiments of the present application are further described below in conjunction with specific examples:
[0044] Example One:
[0045] The eMMC protocol test case can achieve the transparent function of all eMMC commands by calling the eMMC character device driver, so that any command can be sent to the eMMC device in the Linux application layer. For example, the eMMC protocol test case can send cmd23 and cmd25 commands to the eMMC device to read data at any logical address in the eMMC device; the eMMC protocol test case can also send cmd7 command to the eMMC device to switch the state of the eMMC device, etc.
[0046] Example Two:
[0047] The eMMC protocol test case can send some illegal commands to the eMMC device. For example, the eMMC protocol test case can send cmd5 command to make the eMMC device sleep when the eMMC device is in the transfer state, since the protocol specifies that the eMMC device in the transfer state cannot respond to the cmd5 command, so the eMMC firmware protocol function about the state diagram can be verified by checking whether the eMMC device has a response.
[0048] Example Three:
[0049] The personnel who compile the test case can define various private commands in consultation with the firmware developers to change the internal state of the eMMC device by issuing private commands. For example, the password of the RPMB partition can never be modified after it is set, and a private command can be defined to clear the password of the RPMB partition.
[0050] Through experiments, the operation of the eMMC protocol test case on the eMMC device does not affect the running of the system, and the system stability is good; the interaction command captured by the protocol analyzer is also consistent with the command issued by the eMMC protocol test case, as shown in Figure 4 FIG. 3 shows a protocol screenshot captured by a logic analyzer when the cmd23 and cmd25 commands are issued.
[0051] The embodiments of the present application at least have the following beneficial effects: when verifying the eMMC protocol function, the test case and other processes can be isolated by starting the operating system from the SD card or the UFS, and only the test case is allowed to access and operate the eMMC device, so that even if the eMMC device has a problem during the testing, the system will not crash, thereby ensuring the normal running of the system and maintaining the good stability of the system; when the testing has a problem, the problem can also be reproduced by the eMMC protocol test case, so that the firmware developer can easily locate the problem of the eMMC device. By mounting the eMMC character device driver in the kernel space and providing all the command interfaces defined by the eMMC protocol to the application layer, the eMMC protocol test case of the application layer can call these command interfaces to access the eMMC device, so that the personnel who write the application layer test case can formulate any test sequence to increase the test points and the coverage range of the test case, thereby facilitating the positioning of the test problem. Since all the test cases run in an automated order and stop only when an error occurs, the verification efficiency can be improved. In addition, the eMMC device state or firmware upgrade can be changed by defining and issuing private commands in the eMMC protocol test case.
[0052] Referring to Figure 5 The system for verifying the eMMC function provided by the embodiments of the present application can include but is not limited to:
[0053] The first processing module 501 is configured to load an operating system in a storage device and mount a root file system in the storage device, wherein the storage device is a secure digital card or a universal flash memory.
[0054] The second processing module 502 is configured to access an eMMC device by calling an eMMC character device driver and execute an eMMC protocol test case to verify the function of the eMMC device, wherein the eMMC character device driver is located in a kernel layer of the operating system, and the eMMC protocol test case is located in an application layer of the operating system.
[0055] The embodiments of the present application provide an electronic device, as shown in Figure 6As shown, the electronic device includes a memory 601 and a processor 602; the memory 601 is configured to store one or more computer programs; and the processor 602 is configured to execute the program stored in the memory 601, so as to implement the method for verifying eMMC function provided in the first aspect of the present application.
[0056] The present application provides a computer readable storage medium, which stores instructions, and when the instructions are executed on a computer, the computer executes the method for verifying eMMC function provided in the present application.
[0057] In the above embodiments, the implementation can be achieved by software, hardware, firmware or any combination thereof, entirely or partially. When implemented by software, the implementation can be achieved in the form of a computer program product, entirely or partially. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the implementation produces the processes or functions described in the embodiments of the present application, entirely or partially. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be magnetic media (such as floppy disk, hard disk, magnetic tape), optical media (such as DVD), or semiconductor media (such as solid state disk (SSD)) and the like.
[0058] It should be noted that in this document, the term "comprising" or "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such a process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of additional identical elements in the process, method, article or device including the element.
[0059] The various embodiments in the specification are described in a related manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, for electronic device and computer readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiment.
[0060] The above only describes the preferred embodiments of the present application, and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for verifying eMMC functionality, characterized in that, include: An operating system is loaded into the storage device, and a root file system is mounted on the storage device, wherein the storage device is a secure digital card or a general-purpose flash memory; The functionality of the eMMC device is verified by calling the eMMC character device driver to access the eMMC device and executing eMMC protocol test cases. The eMMC character device driver is located in the kernel layer of the operating system, and the eMMC protocol test cases are located in the application layer of the operating system.
2. The method for verifying eMMC functionality according to claim 1, characterized in that, The step of testing the functionality of the eMMC device by calling the eMMC character device driver and executing eMMC protocol test cases includes: The eMMC protocol commands and parameters in the eMMC protocol test case are sent to the eMMC character device driver through the eMMC character driver interface; In response to a call to the eMMC character driver interface, the eMMC character device driver sends the eMMC protocol commands and parameters to the eMMC device, obtains the execution result of the eMMC device on the eMMC protocol commands and parameters, and returns the execution result to the eMMC protocol test case. The execution results are verified to be correct using the eMMC protocol test cases.
3. The method for verifying eMMC functionality according to claim 1, characterized in that, The step of accessing the eMMC device through the eMMC character device driver and executing eMMC protocol test cases to verify the functionality of the eMMC device also includes: The eMMC character device driver responds to the eMMC protocol commands and parameters in the eMMC protocol test cases. If the eMMC protocol command includes a data transfer task, then the eMMC protocol command is sent to the eMMC device, and the direct memory access function is activated to execute the data transfer task; If the eMMC protocol command does not include the data transmission task, then the eMMC protocol command is sent to the eMMC device.
4. The method for verifying eMMC functionality according to claim 1, characterized in that, Also includes: The initialization of the eMMC device is completed by sending an initialization command to the eMMC device through the eMMC character device driver.
5. A system for verifying eMMC functionality, characterized in that, include: The first processing module is used to load the operating system into the storage device and mount the root file system onto the storage device, wherein the storage device is a security digital card or a general flash memory. The second processing module is used to access the eMMC device by calling the eMMC character device driver and to execute eMMC protocol test cases to verify the functionality of the eMMC device. The character device driver is located in the kernel layer of the operating system, and the eMMC protocol test cases are located in the application layer of the operating system.
6. An electronic device comprising a processor, a memory, and one or more programs stored in the memory and configured to be executed by the processor, the programs comprising a method for performing the verification of eMMC functionality as described in any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The system stores processor-executable program instructions for performing the method for verifying eMMC functionality as described in any one of claims 1-4.
Citation Information
Patent Citations
Host device and method for securely booting the host device with operating system code loaded from a storage device
CN103069384A
Method and device for mounting SD card (Secure Digital Memory Card) on multi-operating-system terminal, and terminal
CN106201565A