Executable file generation method, device, computer equipment and readable storage medium

By standardizing the initial drivers, compatible standard drivers and executable files are generated, which solves the problem of low development efficiency caused by the difference in Flash drivers and improves development efficiency and compatibility.

CN118672666BActive Publication Date: 2024-12-03CHENGDU CELIS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411163920.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-12-03
Estimated Expiration
2044-08-23

AI Technical Summary

Technical Problem

Due to the differences in Flash drivers, each chip needs to be developed and tested separately, which increases development cost and time and reduces development efficiency.

Method used

By obtaining the initial driver of the target memory chip, determining standard parameters, including standard input parameters and standard output parameters, standardized processing of the initial driver, generating standard drivers for the target memory chip, and generating can be done based on standard drivers and calling instructions Execute files to ensure compatibility between different Flash drivers.

Benefits of technology

It reduces the workload of developing new Flash drivers or modifying existing drivers, improves development efficiency, realizes unified interaction between Flash memory and upper-level applications, and reduces the difficulty of maintenance and upgrades.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118672666B_ABST
    Figure CN118672666B_ABST
Patent Text Reader

Abstract

The present application relates to the field of software technology, and in particular to an executable file generation method, device, computer equipment and readable storage medium. The method comprises: obtaining an initial driver corresponding to a target storage chip; determining standard parameters according to the processing function of the initial driver; wherein the standard parameters include standard input parameters and standard output parameters; using the standard parameters, standardizing the initial driver to obtain a standard driver for the target storage chip; generating an executable file for the target storage chip according to the standard driver and the call instruction corresponding to the standard driver.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software technology, and in particular to an executable file generation method, device, computer equipment and readable storage medium. Background Art

[0002] With the vigorous development of new energy vehicles, more and more chips need to be upgraded, and the Flash drivers of each chip may be different.

[0003] The Flash driver executable file is the bridge between the operating system or embedded system and the Flash memory, which enables the system to identify and control the Flash memory. The Flash driver of each chip may be different, resulting in a lot of duplication of work, because each chip requires separate Flash driver development and testing.

[0004] However, the above-mentioned repetitive work increases development cost and time and reduces development efficiency, so it is urgently needed to be improved. Summary of the invention

[0005] Based on this, it is necessary to provide an executable file generation method, device, computer equipment and readable storage medium that can improve the efficiency of driver development in response to the above technical problems.

[0006] In a first aspect, the present application provides a method for generating an executable file, comprising:

[0007] Get the initial driver corresponding to the target storage chip;

[0008] Determine standard parameters according to the processing function of the initial driver program; wherein the standard parameters include standard input parameters and standard output parameters;

[0009] Using standard parameters, the initial driver is standardized to obtain a standard driver for the target storage chip;

[0010] Generate an executable file of the target storage chip according to the standard driver and the calling instruction corresponding to the standard driver.

[0011] In one embodiment, generating an executable file of a target storage chip according to a standard driver and a call instruction corresponding to the standard driver includes:

[0012] In the random access memory RAM in the ECU, select the calling address corresponding to the standard driver program;

[0013] The standard driver is stored in the storage area corresponding to the calling address in RAM;

[0014] Generate an executable file for the target storage chip according to the calling instructions and calling addresses corresponding to the standard driver.

[0015] In one embodiment, generating an executable file of a target storage chip according to a call instruction and a call address corresponding to a standard driver includes:

[0016] Obtain identification information of the user end corresponding to the target storage chip;

[0017] According to the identification information, query the code language and memory configuration information of the user end;

[0018] According to the code language, the calling instructions and calling addresses corresponding to the standard driver are compiled to obtain a compiled file;

[0019] According to the memory configuration information, establish the link information between the compiled file and the user end;

[0020] Generate the executable file of the target memory chip based on the link information and compilation file.

[0021] In one embodiment, the standard parameters are determined based on the processing function of the initial driver, including:

[0022] If the processing function of the initial driver is an initialization function, a null value is used as a standard input parameter, and initialization success and initialization failure are used as standard output parameters;

[0023] If the processing function is a deinitialization function, a null value is used as a standard input parameter, and deinitialization success and deinitialization failure are used as standard output parameters;

[0024] If the processing function is an erase function, the erase address that has been verified for legality is used as a standard input parameter, and the erase result of the to-be-erased sector corresponding to the erase address is used as a standard output parameter;

[0025] If the processing function is a write function, the write address that has been verified for legality is used as a standard input parameter, and the write result of the bytes to be written corresponding to the write address is used as a standard output parameter.

[0026] When the processing function is an erase function, the initial driver is standardized using standard parameters to obtain a standard driver for the target storage chip, including:

[0027] Converting the erase address into at least one sector to be erased, and determining the sector capacity of the sector to be erased;

[0028] The minimum erasing unit in the initial driver is modified to the sector capacity to obtain a standard driver for the target storage chip.

[0029] In one embodiment, when the processing function is a write function, the initial driver is standardized using standard parameters to obtain a standard driver for the target storage chip, including:

[0030] Converting the write address into at least one byte to be written and determining the byte capacity of the byte to be written;

[0031] The minimum write unit in the initial driver is modified to byte capacity to obtain a standard driver for the target storage chip.

[0032] In one embodiment, the target storage chip is a flash memory chip.

[0033] In a second aspect, the present application further provides an executable file generating device, comprising:

[0034] An acquisition module is used to acquire an initial driver corresponding to a target storage chip;

[0035] A standardized parameter module, used for determining standard parameters according to the processing function of the initial driver program; wherein the standard parameters include standard input parameters and standard output parameters;

[0036] A standardization processing module is used to perform standardization processing on the initial driver program by using standard parameters to obtain a standard driver program for the target storage chip;

[0037] The file generation module is used to generate an executable file of a target storage chip according to a standard driver and a calling instruction corresponding to the standard driver.

[0038] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0039] Get the initial driver corresponding to the target storage chip;

[0040] Determine standard parameters according to the processing function of the initial driver program; wherein the standard parameters include standard input parameters and standard output parameters;

[0041] Using standard parameters, the initial driver is standardized to obtain a standard driver for the target storage chip;

[0042] Generate an executable file of the target storage chip according to the standard driver and the calling instruction corresponding to the standard driver.

[0043] In a fourth aspect, the present application further provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:

[0044] Get the initial driver corresponding to the target storage chip;

[0045] Determine standard parameters according to the processing function of the initial driver program; wherein the standard parameters include standard input parameters and standard output parameters;

[0046] Using standard parameters, the initial driver is standardized to obtain a standard driver for the target storage chip;

[0047] Generate an executable file of the target storage chip according to the standard driver and the calling instruction corresponding to the standard driver.

[0048] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0049] Get the initial driver corresponding to the target storage chip;

[0050] Determine standard parameters according to the processing function of the initial driver program; wherein the standard parameters include standard input parameters and standard output parameters;

[0051] Using standard parameters, the initial driver is standardized to obtain a standard driver for the target storage chip;

[0052] Generate an executable file of the target storage chip according to the standard driver and the calling instruction corresponding to the standard driver.

[0053] The above-mentioned executable file generation method, device, computer equipment and readable storage medium, the present application adopts standard parameters to standardize the initial driver, and parameter standardization ensures the compatibility between different Flash drivers. When all drivers follow the same parameter specifications, upper-layer applications can more easily interact with any Flash memory without having to worry about the specific implementation of the underlying layer; standardization reduces the workload when developing new Flash drivers or modifying existing drivers. Developers can follow the defined parameter sets and interface specifications without having to start from scratch every time, which improves development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0055] Figure 1A schematic diagram of a flow chart of a method for generating an executable file in an embodiment;

[0056] Figure 2 A flowchart of the steps of storing a standard driver program in a storage area corresponding to a calling address in RAM in one embodiment;

[0057] Figure 3 A schematic diagram of a flow chart of steps for generating an executable file of a target storage chip in an embodiment;

[0058] Figure 4 A schematic diagram of a flow chart of a step of determining standard parameters in one embodiment;

[0059] Figure 5 is a structural block diagram of an executable file generating device in one embodiment;

[0060] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0062] The rapid development of new energy vehicles has promoted the continuous innovation and upgrading of chip technology. Different new energy vehicle projects may require the use of chips of different models and different suppliers. Each chip has its own unique Flash driver requirements, which are the bridge between the chip and the software. Due to the lack of a unified Flash driver interface standard, engineers need to write specific driver code for each chip. This non-uniform interface leads to poor code maintainability and increases the difficulty of later maintenance and upgrades.

[0063] Therefore, in an exemplary embodiment, if Figure 1 As shown, a method for generating an executable file is provided, and the method is applied to a computer device as an example for description, including the following S101 to S104. Among them:

[0064] S101, obtaining an initial driver program corresponding to a target storage chip.

[0065] The initial driver corresponding to the target storage chip refers to the initial Flash driver corresponding to the target storage chip.

[0066] Specifically, the initial Flash driver may include:

[0067] 1) Initialization and configuration: Hardware initialization: including setting the necessary registers of the Flash memory, configuring its working mode, and verifying the status of the Flash. This is the basic step to ensure that the Flash memory can work properly. Parameter configuration: According to the hardware characteristics of the Flash memory, configure the relevant driver parameters, such as page size, block size, erase time, etc. These parameters will affect the execution of subsequent read and write operations.

[0068] 2) Read and write operations: Read operation: Provides the function of reading data from the Flash memory. This usually includes defining the input parameters of the read operation (such as the starting address and read length) and the return value (the data read). The read operation needs to ensure the accuracy and integrity of the data. Write operation: Since the write operation of the Flash memory usually requires erasing before writing, the write operation may include two steps: erasing and programming. The driver needs to encapsulate these steps and provide a unified write interface to the upper-level application. The input parameters of the write operation may include the write address and data, and the return value may indicate the success or failure of the operation.

[0069] 3) Erase operation: provides the function of erasing a specific area in the Flash memory. The erase operation is usually performed in units of blocks or sectors. The driver needs to define the input parameters (such as the starting address of the erase block) and the return value (operation result) of the erase operation.

[0070] 4) Interface and communication protocol Define the interface and communication protocol for communicating with the Flash memory. This includes selecting the appropriate interface standard (such as SPI, I²C, QSPI, etc.) and defining the corresponding command format, data transmission method, etc.

[0071] Furthermore, there are differences in the technical specifications of Flash chips produced by different manufacturers, specifically in terms of storage capacity, read and write speeds, and erase and write characteristics; there are also differences in the interface standards and communication protocols of Flash chips produced by different manufacturers, e.g.

[0072] On this basis, the input parameters and return values ​​of different Flash chip drivers are also different. For example: 1) Flash memory is mainly divided into two categories, NOR Flash and NAND Flash, according to the different internal storage structures. There are significant differences between these two types of Flash in terms of read and write speed, erase mechanism, lifespan, and interface standards. Therefore, the design of the driver program for different types of Flash is bound to be different, including the definition of input parameters and return values. 2) Flash chips usually communicate with the main controller through specific interfaces, such as SPI, I²C, QSPI, etc. The data transmission method and command format under different interfaces and communication protocols are different, which also requires the driver program to make corresponding changes in input parameters and return values.

[0073] S102, determining standard parameters according to the processing function of the initial driver program.

[0074] Among them, standard parameters include standard input parameters and standard output parameters.

[0075] It is understandable that the purpose of determining the standard parameters is to unify the input parameters and output results of different Flash drivers.

[0076] Specifically, the unified approach may include:

[0077] 1) Define a unified interface specification abstract layer design: Introduce an abstract Flash interface layer in the operating system or hardware platform, which defines the basic functions and parameter formats required for all Flash operations. In this way, no matter how the underlying Flash driver changes, the upper-layer application interacts with the Flash memory through this unified interface.

[0078] 2) Parameter standardization: Define a set of standard input parameters and output result formats for Flash operations. For example, for read operations, you can define unified start address and data length parameters; for write operations, you can define parameters such as start address, data buffer, and data length. The output results may include operation status codes or data.

[0079] Furthermore, different initial driving programs correspond to different standard parameters. Specifically, the different standard parameters corresponding to different initial driving programs can be stored in a comparison table.

[0080] S103, using standard parameters to perform standardization processing on the initial driver to obtain a standard driver for the target storage chip.

[0081] The standard driver of the target storage chip refers to a driver that is obtained by standardizing the initial driver according to standard parameters. The standardized driver in this embodiment may include an initialization function, a deinitialization function, a write function, and an erase function.

[0082] Optionally, a middleware layer can be developed. The middleware layer is a key software component that sits between the upper-layer application and the underlying Flash driver. This layer is responsible for converting the calls from the upper-layer application into the calls required by the specific Flash driver. The middleware can handle the conversion of input parameters and the formatting of output results, thereby ensuring that the interaction between the upper-layer application and the Flash memory remains consistent.

[0083] In this embodiment, the IAR compiler (IAR Embedded Workbench compiler) can be used to build the middleware layer; the IAR compiler is an efficient and powerful C / C++ compiler designed specifically for embedded system development.

[0084] Specifically, create a project in the IAR compiler as the middleware layer, which is the Flash driver general project. Then, select the chip type and compiler tool chain corresponding to the target memory chip in the IAR compiler to set up the project. Specifically, the project can be set up including compiler options, linker options, and debugging options, etc. These settings can be adjusted according to specific needs.

[0085] Specifically, the Flash driver general project uses standard parameters, and the following methods can be used to standardize the initial driver:

[0086] 1) Update function prototypes: Modify the prototypes of all relevant functions in the Flash driver according to the defined unified parameter set. Make sure that each function accepts the correct type and number of parameters and returns a result in a unified format (such as an operation status code).

[0087] 2) Add parameter validation: Add parameter validation logic inside the function to ensure that the parameters passed in are in the expected format and range. This helps prevent runtime errors or data corruption caused by incorrect parameters.

[0088] S104, generating an executable file of the target storage chip according to the standard driver and the calling instruction corresponding to the standard driver.

[0089] Among them, an executable file refers to a file that can be directly executed by a computer. It contains the executable code, data, and necessary meta-information (such as the entry point address, etc.) of the program. In Linux systems, executable files usually use the ELF (Executable and Linkable Format) format, while in Windows systems, they use the PE (Portable Executable) format.

[0090] For target storage chips (such as Flash memory), executable files refer to binary files designed to be executed on the chip or loaded into memory for execution. These files may be stored directly in the Flash memory and loaded into memory for execution when the system starts or as needed.

[0091] Optionally, the call instruction corresponding to the standard driver may indicate the location where the program starts to execute, that is, the address of the first instruction. The standard driver and the call instruction corresponding to the standard driver are packaged, and the resulting packaged file is the executable file of the target storage chip.

[0092] In the above executable file generation method, this application uses standard parameters to standardize the initial driver, and parameter standardization ensures compatibility between different Flash drivers. When all drivers follow the same parameter specifications, upper-layer applications can more easily interact with any Flash memory without having to worry about the specific implementation of the underlying layer; standardization reduces the workload when developing new Flash drivers or modifying existing drivers. Developers can follow defined parameter sets and interface specifications without having to start from scratch every time, which improves development efficiency.

[0093] In an exemplary embodiment, Figure 2 As shown, according to the standard driver and the calling instructions corresponding to the standard driver, an executable file of the target storage chip is generated, including:

[0094] S201, selecting a calling address corresponding to a standard driver program in a random access memory RAM in an ECU.

[0095] It is understandable that there is a significant difference in access speed between storing the above Flash-driven general project in the ECU's RAM (random access memory) and the main program storage space (usually referring to non-volatile memory such as ROM or Flash).

[0096] In this embodiment, the Flash driver general project usually only needs to be read. Although variable data needs to be stored in RAM, the variable data will be configured on the main program. This Flash driver general project can be understood as a Flash driver plug-in. Storing the Flash driver plug-in in RAM can prevent the main program from getting stuck and possibly causing the program to crash due to misoperation of the Flash driver plug-in. Each time the BootLoader is upgraded, the Flash driver plug-in needs to be downloaded to RAM first, and then the main program can call it.

[0097] For example, in the random access memory RAM in the ECU, when selecting the call address corresponding to the standard driver, it is necessary to modify the RAM start address and allocate the RAM size in the link file .icf corresponding to the Flash driver general project. The space can only be larger and not smaller, and the redundant IAR compiler will automatically remove it. The start address of the memory segment is defined as RAM_BASE, which can be specifically used in the following code:

[0098] Definesymbol RAM_BASE=0x2001F000; / / Define a symbol RAM_BASE, whose value is 0x2001F000. This symbol represents the starting address of the RAM area.

[0099] Definesymbol RAM_SIZE=0x00000600; / / Define a symbol RAM_SIZE, whose value is 0x00000600. This symbol represents the size of the RAM area.

[0100] Defineregion RAM_region=mem:[from RAM_BASE size RAM_SIZE]; / / Define a memory region RAM_region, which starts from RAM_BASE and has a size of RAM_SIZE;

[0101] Place ataddress mem:RAM_BASE{readonly section,flsvect}; / / Place the read-only section and the fast system vector table (flsvect) at the memory address RAM_BASE;

[0102] Place in RAM_region{readonly}; / / Place the read-only part (readonly) in the previously defined RAM_region area.

[0103] S202, storing the standard driver into a storage area corresponding to the calling address in the RAM.

[0104] Specifically, after storing the above-mentioned Flash driver general project to the calling address, in one implementable method, the calling address can be directly used as the calling identifier of the standard driver for the user to call; in another implementable method, through the IAR compiler, in the Flash driver general project, in the RAM space, an interrupt vector table flsvect corresponding to the standard driver is established, the interrupt vector table flsvect is configured as read-only, and the interrupt vector table flsvect is used as the calling identifier of the standard driver for the user to call.

[0105] Specifically, in the interrupt vector table, let each function entry address in the standard driver point to the specified address (i.e., the calling address). The specific process is as follows:

[0106] typedef void (*pFlashTable)(void); / / Define a function pointer type pFlashTable, which points to a function with no parameters and no return value;

[0107] #pragma section=".flsvect" / / Use compiler directives to specify that the following code or data will be placed in a section named ".flsvect";

[0108] #pragma location=".flsvect" / / Use compiler directives to specify the specific location where the following data will be placed in the ".flsvect" segment;

[0109] / / Define an array named fls_vect, which contains 10 elements of pFlashTable type, i.e. function pointers;

[0110] / / The array is declared as const, indicating that its contents will not change after initialization;

[0111] / / The array is marked as root. The array will be considered as a root symbol during linking and will not be optimized away;

[0112] __root const pFlashTable fls_vect

[10] =

[0113] { / / Initialize the first four elements of the array as pointers to specific functions;

[0114] These functions may be related to flash memory operations such as initialization, deinitialization, erase, and write;

[0115] (pFlashTable)&UDS_Flash_Ini, / / pointer to UDS_Flash_Ini function;

[0116] (pFlashTable)&UDS_Flash_DeInit, / / pointer to UDS_Flash_DeInit function;

[0117] (pFlashTable)&UDS_Flash_Erase, / / pointer to UDS_Flash_Erase function;

[0118] (pFlashTable)&UDS_Flash_Write, / / pointer to UDS_Flash_Write function;

[0119] / / The remaining elements of the array are initialized to NULL pointers, indicating that these locations do not currently point to any function;

[0120] (pFlashTable)0,

[0121] (pFlashTable)0,

[0122] (pFlashTable)0,

[0123] (pFlashTable)0,

[0124] (pFlashTable)0,

[0125] (pFlashTable)0,

[0126] };

[0127] S203, generating an executable file of the target storage chip according to the calling instruction and calling address corresponding to the standard driver.

[0128] Optionally, in the IAR compiler, according to the user end (the hardware environment of the user end) corresponding to the target memory chip, the above-mentioned interrupt vector table flsvect and the calling instructions corresponding to the standard driver are compiled and processed to obtain the executable file of the target memory chip.

[0129] Specifically, Figure 3 As shown, according to the call instructions and call addresses corresponding to the standard driver, an executable file of the target storage chip is generated, including:

[0130] S301, obtaining identification information of a user corresponding to a target storage chip.

[0131] The identification information of the user end is used to determine the usage environment information of the user end, thereby enabling the compiler to generate machine code (ie, executable file) that is compatible with the hardware.

[0132] S302: Query the code language and memory configuration information of the user end according to the identification information.

[0133] Specifically, as described in S301 , the usage environment information of the user end may include the code language and memory configuration information of the user end.

[0134] Exemplarily, in the IAR compiler, select the target memory chip model in the "Device" option.

[0135] S303, compile the calling instructions and calling addresses corresponding to the standard driver according to the code language to obtain a compiled file.

[0136] Specifically, the file type and path of the output after compilation and linking are set, and a binary file in a format such as .hex or .bin is generated according to the code language of the user end, so that the IAR compiler can generate machine code compatible with the chip.

[0137] S304: Establish link information between the compiled file and the user end according to the memory configuration information.

[0138] The memory configuration information may include memory layout, startup address and interrupt vector table.

[0139] It is understandable that the function can only run normally if the binary file address of each function is pointed to a specific starting address, because the addressing of the machine from the beginning to the end is fixed. The MCU operation needs to occupy RAM space, and a free fixed RAM space needs to be allocated to FLASH. You only need to call the starting address of the function to operate the function. This can reduce the size of the program itself and improve the security of the controller.

[0140] S305, generating an executable file of the target storage chip according to the link information and the compilation file.

[0141] Specifically, in the IAR compilation environment, the linking process is the process of linking the target file (.o file) and library file generated after compilation into the final executable file or image file.

[0142] This process is performed by the linker (ILINK) in the IAR compiler.

[0143] The linking process mainly includes the following steps:

[0144] 1) Determine which modules need to be included in the application: The linker analyzes the project settings and source code to determine which source files and object files need to be included in the final application.

[0145] 2) Select the standard library file used to link the target file: According to the project requirements, the linker will select the corresponding standard library file (such as the C standard library) for linking.

[0146] 3) Determine which sections of the target file need to be included: During the linking process, the linker will determine which sections (code segments or data segments) need to be included in the final executable file.

[0147] 4) Complete the initialization of code and variables in RAM: For variables and code segments that need to be initialized in RAM, the linker will generate corresponding initialization code.

[0148] 5) The location of each section is determined by the placement instructions of the link file: the linker will place different sections at the specified memory address according to the instructions in the link file (.icf file).

[0149] 6) Generate the final file containing the executable image and debugging information: After the link is completed, a final file (such as .out, or .bin, or .hex file) containing executable code, debugging information, etc. will be generated.

[0150] Specifically, in IAR compiler project->Options->Linker_Checksum->check Fill unusedcode memory, Fill pattern option fill in 0xFF, Start address fill in the above macro RAM_BASE, End address fill in the above macro RAM_BASE + RAM_SIZE; this function is used to fill, there is unused memory space in the compiled executable file, if not filled, there will be discontinuous addresses downloaded to the RAM space by the flash driver, causing the program to fail to work. The generated executable file format can be selected in Project->Options->Output Converter->Output.

[0151] In this embodiment, the flash universal driver project created based on the IAR compiler is suitable for all embedded chips. Due to the characteristics of the IAR compiler, the entry address generated by compiling any function points to the address space of the vector table, and the user can operate the address of the vector table to call the function.

[0152] In an exemplary embodiment, Figure 4 As shown, according to the processing function of the initial driver, standard parameters are determined, including:

[0153] S401, if the processing function of the initial driver is an initialization function, a null value is used as a standard input parameter, and initialization success and initialization failure are used as standard output parameters.

[0154] Among them, the initialization function in the standard driver in this embodiment is: uint32_t UDS_Flash_Init(void);

[0155] In this embodiment, the initialization function rules are unified without input parameters, and the return value is only E_OK (0) for successful initialization or E_NOT_OK (1) for failed initialization, to prevent different manufacturers from having different return values. If they are different, they need to be modified.

[0156] uint32_t UDS_Flash_Init(void);

[0157] { / / Define a variable ret of type uint32_t and initialize it to E_NOT_OK, indicating that the initialization fails by default;

[0158] uint32_t ret = E_NOT_OK;

[0159] / / Call the manufacturer's FLASH initialization function FLASH_Init and assign the return result to the variable ret;

[0160] / / FLASH_Init function is responsible for performing specific FLASH initialization operations;

[0161] ret = FLASH_Init(); / / Check the return value of the FLASH_Init function, if ret is not equal to E_OK;

[0162] / / It means that the initialization fails and the function returns E_NOT_OK;

[0163] if (ret != E_OK)

[0164] {

[0165] return E_NOT_OK; / / Initialization failed, return E_NOT_OK;

[0166] }

[0167] / / If the FLASH_Init function returns E_OK, it means the initialization is successful.

[0168] / / The function returns the value of ret, which is E_OK;

[0169] return ret; / / Initialization successful, return E_OK;

[0170] }

[0171] S402, if the processing function is a deinitialization function, a null value is used as a standard input parameter, and deinitialization success and deinitialization failure are used as standard output parameters.

[0172] The deinitialization function in the standard driver in this embodiment is: uint32_t UDS_Flash_DeInit (void);

[0173] In this embodiment, the deinitialization function has no input parameters, and the return value is only deinitialization success E_OK (0) or deinitialization success E_NOT_OK (1). To prevent different manufacturers from having different return values, if they are different, they need to be modified.

[0174] uint32_t UDS_Flash_DeInit(void)

[0175] { / / Define a variable ret of type uint32_t and initialize it to E_NOT_OK, setting the deinitialization operation to failure;

[0176] uint32_t ret = E_NOT_OK;

[0177] / / Call the manufacturer's FLASH to initialize the function FLASH_DeInit, and assign the return value of the function to the variable ret;

[0178] / / FLASH_DeInit function is responsible for performing specific FLASH deinitialization operations;

[0179] ret = FLASH_DeInit(); / / Check the return value of the FLASH_DeInit function. If ret is not equal to E_OK,

[0180] / / It means that the deinitialization operation fails, and the function returns E_NOT_OK;

[0181] if (ret != E_OK)

[0182] {

[0183] return E_NOT_OK; / / Deinitialization failed, return E_NOT_OK;

[0184] }

[0185] / / If the FLASH_DeInit function returns E_OK, it means the deinitialization operation is successful.

[0186] / / At this time, the function returns the value of ret, which is E_OK;

[0187] return ret; / / Deinitialization successful, return E_OK;

[0188] }

[0189] S403, if the processing function is an erase function, the erase address that has been verified for legality is used as a standard input parameter, and the erase result of the to-be-erased sector corresponding to the erase address is used as a standard output parameter.

[0190] Among them, the erase function in the standard driver in this embodiment is:

[0191] uint32_t UDS_Flash_Erase(uint32_t addr, uint32_t size);

[0192] Among them, addr is the starting address of the erased sector, size is the erased sector size; the erase function rule is that the starting address needs to be aligned to a single sector, if the size is less than a single sector, it will be erased as a single sector, multiple sectors will be erased in a loop, and the return value is only OK if the erase is successful or NOT_OK if the erase fails;

[0193] Among them, P_FLASH_START_ADDR is the legal start address of erasure, P_FLASH_END_ADDR is the legal end address of erasure, and SECTOR_SIZE is the size of a single sector. / / UDS_Flash_Erase function is used to erase the specified area in FLASH;

[0194] / / The function accepts two parameters: addr of uint32_t type, indicating the starting address to be erased;

[0195] / / size of uint32_t type, indicating the size to be erased (in bytes);

[0196] / / The function returns a value of type uint32_t, indicating the result of the erase operation;

[0197] / / The return value can be E_OK (0), indicating a successful erase, or E_NOT_OK (1), indicating a failed erase;

[0198] uint32_t UDS_Flash_Erase(uint32_t addr, uint32_t size)

[0199] {

[0200] / / Define a variable ret of type uint32_t and initialize it to E_NOT_OK, which means the erase operation fails.

[0201] uint32_t ret = E_NOT_OK;

[0202] / / Define a variable eraseCount of type uint8_t to record the number of sectors that need to be erased;

[0203] uint8_t eraseCount = 0;

[0204] / / Define a variable tempAddr of type uint32_t to calculate the end address of the erase area;

[0205] uint32_t tempAddr = addr + size;

[0206] / / Check if the erase area is within the valid range of FLASH;

[0207] if (tempAddr<= P_FLASH_END_ADDR&&addr>= P_FLASH_START_ADDR)

[0208] {

[0209] / / Check if the starting address is the starting address of the sector;

[0210] if (addr % SECTOR_SIZE == 0) /

[0211] {

[0212] / / Check if the erase size is an integer multiple of the sector size;

[0213] if (size % SECTOR_SIZE == 0)

[0214] {

[0215] / / If the erase size is exactly an integer multiple of the sector size, calculate the number of sectors that need to be erased;

[0216] eraseCount = size / SECTOR_SIZE;

[0217] }

[0218] else

[0219] {

[0220] / / If the erase size is not an integer multiple of the sector size, an additional sector needs to be erased.

[0221] / / to ensure that the erased area completely covers the required range;

[0222] eraseCount = size / SECTOR_SIZE + 1;

[0223] / / Erase each sector in a loop;

[0224] When the sector size or the last sector erased is less than one sector size, one needs to be added. For example, if the sector size is 2048 but the erase size is 500, it is still erased as one sector, and the sent data is not completely aligned.

[0225] }

[0226] for (uint16_t i = 0; i <eraseCount; i++)

[0227] {

[0228] / / Call the manufacturer's FLASH erase single sector function FLASH_EraseSector and perform the erase operation;

[0229] ret = FLASH_EraseSector(addr);

[0230] / / Update the starting address so that the next sector can be erased;

[0231] addr += SECTOR_SIZE;

[0232] / / If the erase operation fails, return E_NOT_OK;

[0233] if (ret != E_OK)

[0234] {

[0235] return E_NOT_OK;

[0236] }

[0237] }

[0238] }

[0239] else

[0240] {

[0241] / / If the starting address is not the starting address of the sector, E_NOT_OK is returned, indicating that the starting address is wrong;

[0242] ret = E_NOT_OK; / / Start address error;

[0243] }

[0244] else

[0245] {

[0246] / / If the erase area is not within the valid range of FLASH, E_NOT_OK is returned, indicating that the address is out of range;

[0247] ret = E_NOT_OK; / / Address out of range;

[0248] }

[0249] / / Return the result of the erase operation;

[0250] return ret;

[0251] }

[0252] Referring to the above code process, it can be seen that when the processing function is the erase function, the initial driver is standardized using standard parameters to obtain the standard driver of the target storage chip, including:

[0253] The erase address is converted into at least one sector to be erased, and the sector capacity of the sector to be erased is determined; the minimum erase unit in the initial driver is modified to the sector capacity, and a standard driver of the target storage chip is obtained.

[0254] S404, if the processing function is a write function, the write address that has been verified for legality is used as a standard input parameter, and the write result of the bytes to be written corresponding to the write address is used as a standard output parameter.

[0255] Among them, the write function in this embodiment is:

[0256] uint32_t UDS_Flash_Write(uint32_t addr, const uint8_t *src, uint32_tsize);

[0257] Where addr is the starting address for writing, src is the write buffer address, and size is the length of the written data. The write function rule is that the write address and size must be aligned to 4 bytes, and the return value is only OK if the write is successful or NOT_OK if the write fails.

[0258] To prevent differences among different manufacturers, P_FLASH_START_ADDR is the legal start address of erase, and P_FLASH_END_ADDR is the legal end address of erase.

[0259] / / UDS_Flash_Write function is used to write data to FLASH;

[0260] / / The function accepts three parameters:

[0261] / / - addr of uint32_t type, indicating the starting address of writing;

[0262] / / - const uint8_t * type src, pointer to the data to be written;

[0263] / / - size of uint32_t type, indicating the size of the data to be written (in bytes);

[0264] / / The function returns a value of type uint32_t, indicating the result of the write operation;

[0265] / / The return value can be E_OK (0), indicating successful writing, or E_NOT_OK (1), indicating failure;

[0266] uint32_t UDS_Flash_Write(uint32_t addr, const uint8_t *src, uint32_tsize)

[0267] {

[0268] / / Define a variable ret of type uint32_t and initialize it to E_NOT_OK, which means the write operation fails.

[0269] uint32_t ret = E_NOT_OK;

[0270] / / Define a variable tempAddr of type uint32_t to calculate the end address of the write area;

[0271] uint32_t tempAddr = addr + size;

[0272] / / Check if the write area is within the valid range of FLASH, where ">" is used instead of ">=" to ensure that the address is not exactly equal to the start address;

[0273] if (tempAddr<= P_FLASH_END_ADDR&&addr>P_FLASH_START_ADDR)

[0274] {

[0275] / / Call the manufacturer's FLASH write function FLASH_Program to perform the write operation;

[0276] ret = FLASH_Program(addr, size, src);

[0277] / / If the write operation fails, set ret to E_NOT_OK;

[0278] if (ret != E_OK)

[0279] {

[0280] ret = E_NOT_OK;

[0281] }

[0282] }

[0283] else

[0284] {

[0285] / / If the write area is not within the valid range of FLASH, ret is set to E_NOT_OK, indicating that the address is out of range;

[0286] ret = E_NOT_OK; / / Address out of range;

[0287] }

[0288] / / Return the result of the write operation;

[0289] return ret;

[0290] }

[0291] Referring to the above code process, it can be seen that when the processing function is a write function, the initial driver is standardized using standard parameters to obtain a standard driver for the target storage chip, including:

[0292] The write address is converted into at least one byte to be written, and the byte capacity of the byte to be written is determined; the minimum write unit in the initial driver is modified to the byte capacity, and a standard driver of the target storage chip is obtained.

[0293] In this embodiment, the initial driver function of the target storage chip is standardized through the above-mentioned standard parameters. Each time, only the running RAM starting address needs to be modified, and the manufacturer's flash driver can be converted to generate a new flash driver executable file. This method can not only increase the portability and reliability of the flash driver, but also effectively improve development efficiency.

[0294] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0295] Based on the same inventive concept, the embodiment of the present application also provides an executable file generation device for implementing the executable file generation method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more executable file generation device embodiments provided below can refer to the limitations on the executable file generation method above, and will not be repeated here.

[0296] In an exemplary embodiment, Figure 5 As shown, an executable file generation device is provided, comprising: an acquisition module 11, a standardization parameter module 12, a standardization processing module 13 and a file generation module 14, wherein:

[0297] An acquisition module 11 is used to acquire an initial driver program corresponding to a target storage chip;

[0298] The standardized parameter module 12 is used to determine the standard parameters according to the processing function of the initial driver program; wherein the standard parameters include standard input parameters and standard output parameters;

[0299] A standardization processing module 13 is used to perform standardization processing on the initial driver program by using standard parameters to obtain a standard driver program for the target storage chip;

[0300] The file generation module 14 is used to generate an executable file of the target storage chip according to the standard driver and the calling instruction corresponding to the standard driver.

[0301] In one of the embodiments, the file generation module 14 is further used to: select a call address corresponding to the standard driver program in a random access memory RAM in the ECU;

[0302] The standard driver is stored in the storage area corresponding to the calling address in RAM;

[0303] Generate an executable file for the target storage chip according to the calling instructions and calling addresses corresponding to the standard driver.

[0304] In one embodiment, the file generation module 14 is further used to: obtain identification information of a user corresponding to the target storage chip;

[0305] According to the identification information, query the code language and memory configuration information of the user end;

[0306] According to the code language, the calling instructions and calling addresses corresponding to the standard driver are compiled to obtain a compiled file;

[0307] According to the memory configuration information, establish the link information between the compiled file and the user end;

[0308] Generate the executable file of the target memory chip based on the link information and compilation file.

[0309] In one embodiment, the standardized parameter module 12 is used to: if the processing function of the initial driver is an initialization function, use a null value as a standard input parameter, and use initialization success and initialization failure as standard output parameters;

[0310] If the processing function is a deinitialization function, a null value is used as a standard input parameter, and deinitialization success and deinitialization failure are used as standard output parameters;

[0311] If the processing function is an erase function, the erase address that has been verified for legality is used as a standard input parameter, and the erase result of the to-be-erased sector corresponding to the erase address is used as a standard output parameter;

[0312] If the processing function is a write function, the write address that has been verified for legality is used as a standard input parameter, and the write result of the bytes to be written corresponding to the write address is used as a standard output parameter.

[0313] In one embodiment, the standardization processing module 13 is further used to: convert the erase address into at least one sector to be erased, and determine the sector capacity of the sector to be erased;

[0314] The minimum erasing unit in the initial driver is modified to the sector capacity to obtain a standard driver for the target storage chip.

[0315] In one embodiment, the standardization processing module 13 is further used to: convert the write address into at least one byte to be written, and determine the byte capacity of the byte to be written;

[0316] The minimum write unit in the initial driver is modified to byte capacity to obtain a standard driver for the target storage chip.

[0317] In one embodiment, the target storage chip is a flash memory chip.

[0318] Each module in the above executable file generation device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0319] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, an executable file generation method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0320] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0321] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0322] Obtain an initial driver program corresponding to a target memory chip; determine standard parameters according to the processing function of the initial driver program; wherein the standard parameters include standard input parameters and standard output parameters; use the standard parameters to perform standard processing on the initial driver program to obtain a standard driver program for the target memory chip; generate an executable file for the target memory chip according to the standard driver program and the calling instructions corresponding to the standard driver program.

[0323] In one embodiment, when the processor executes the computer program, the following steps are also implemented: in the random access memory RAM in the ECU, a call address corresponding to the standard driver is selected; the standard driver is stored in the storage area corresponding to the call address in the RAM; and an executable file of the target storage chip is generated according to the call instruction and call address corresponding to the standard driver.

[0324] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining identification information of the user end corresponding to the target storage chip; querying the code language and memory configuration information of the user end based on the identification information; compiling the call instructions and call addresses corresponding to the standard driver according to the code language to obtain a compiled file; establishing link information between the compiled file and the user end according to the memory configuration information; and generating an executable file of the target storage chip based on the link information and the compiled file.

[0325] In one embodiment, the processor further implements the following steps when executing the computer program: if the processing function of the initial driver is an initialization function, a null value is used as a standard input parameter, and initialization success and initialization failure are used as standard output parameters; if the processing function is a deinitialization function, a null value is used as a standard input parameter, and deinitialization success and deinitialization failure are used as standard output parameters; if the processing function is an erase function, an erase address that has been verified for legality is used as a standard input parameter, and an erase result of the sector to be erased corresponding to the erase address is used as a standard output parameter; if the processing function is a write function, a write address that has been verified for legality is used as a standard input parameter, and a write result of the byte to be written corresponding to the write address is used as a standard output parameter.

[0326] In one embodiment, when the processor executes the computer program, the following steps are also implemented: converting the erase address into at least one sector to be erased, and determining the sector capacity of the sector to be erased; modifying the minimum erase unit in the initial driver program to the sector capacity, and obtaining a standard driver program for the target storage chip.

[0327] In one embodiment, when the processor executes the computer program, the following steps are also implemented: converting the write address into at least one byte to be written and determining the byte capacity of the byte to be written; modifying the minimum write unit in the initial driver to the byte capacity to obtain a standard driver for the target storage chip.

[0328] In one embodiment, the target storage chip is a flash memory chip.

[0329] In one embodiment, a readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0330] Obtain an initial driver program corresponding to a target memory chip; determine standard parameters according to the processing function of the initial driver program; wherein the standard parameters include standard input parameters and standard output parameters; use the standard parameters to perform standard processing on the initial driver program to obtain a standard driver program for the target memory chip; generate an executable file for the target memory chip according to the standard driver program and the calling instructions corresponding to the standard driver program.

[0331] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in the random access memory RAM in the ECU, a calling address corresponding to the standard driver is selected; the standard driver is stored in the storage area corresponding to the calling address in the RAM; and an executable file of the target storage chip is generated according to the calling instruction and calling address corresponding to the standard driver.

[0332] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining identification information of the user end corresponding to the target storage chip; querying the code language and memory configuration information of the user end based on the identification information; compiling the call instructions and call addresses corresponding to the standard driver according to the code language to obtain a compiled file; establishing link information between the compiled file and the user end according to the memory configuration information; generating an executable file of the target storage chip based on the link information and the compiled file.

[0333] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: if the processing function of the initial driver is an initialization function, a null value is used as a standard input parameter, and initialization success and initialization failure are used as standard output parameters; if the processing function is a deinitialization function, a null value is used as a standard input parameter, and deinitialization success and deinitialization failure are used as standard output parameters; if the processing function is an erase function, an erase address that has been verified for legality is used as a standard input parameter, and an erase result of the sector to be erased corresponding to the erase address is used as a standard output parameter; if the processing function is a write function, a write address that has been verified for legality is used as a standard input parameter, and a write result of the byte to be written corresponding to the write address is used as a standard output parameter.

[0334] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: converting the erase address into at least one sector to be erased, and determining the sector capacity of the sector to be erased; modifying the minimum erase unit in the initial driver program to the sector capacity, and obtaining a standard driver program for the target storage chip.

[0335] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: converting the write address into at least one byte to be written and determining the byte capacity of the byte to be written; modifying the minimum write unit in the initial driver program to the byte capacity to obtain a standard driver program for the target storage chip.

[0336] In one embodiment, the target storage chip is a flash memory chip.

[0337] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0338] Obtain an initial driver program corresponding to a target memory chip; determine standard parameters according to the processing function of the initial driver program; wherein the standard parameters include standard input parameters and standard output parameters; use the standard parameters to perform standard processing on the initial driver program to obtain a standard driver program for the target memory chip; generate an executable file for the target memory chip according to the standard driver program and the calling instructions corresponding to the standard driver program.

[0339] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in the random access memory RAM in the ECU, a calling address corresponding to the standard driver is selected; the standard driver is stored in the storage area corresponding to the calling address in the RAM; and an executable file of the target storage chip is generated according to the calling instruction and calling address corresponding to the standard driver.

[0340] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining identification information of the user end corresponding to the target storage chip; querying the code language and memory configuration information of the user end based on the identification information; compiling the call instructions and call addresses corresponding to the standard driver according to the code language to obtain a compiled file; establishing link information between the compiled file and the user end according to the memory configuration information; generating an executable file of the target storage chip based on the link information and the compiled file.

[0341] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: if the processing function of the initial driver is an initialization function, a null value is used as a standard input parameter, and initialization success and initialization failure are used as standard output parameters; if the processing function is a deinitialization function, a null value is used as a standard input parameter, and deinitialization success and deinitialization failure are used as standard output parameters; if the processing function is an erase function, an erase address that has been verified for legality is used as a standard input parameter, and an erase result of the sector to be erased corresponding to the erase address is used as a standard output parameter; if the processing function is a write function, a write address that has been verified for legality is used as a standard input parameter, and a write result of the byte to be written corresponding to the write address is used as a standard output parameter.

[0342] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: converting the erase address into at least one sector to be erased, and determining the sector capacity of the sector to be erased; modifying the minimum erase unit in the initial driver program to the sector capacity, and obtaining a standard driver program for the target storage chip.

[0343] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: converting the write address into at least one byte to be written and determining the byte capacity of the byte to be written; modifying the minimum write unit in the initial driver program to the byte capacity to obtain a standard driver program for the target storage chip.

[0344] In one embodiment, the target storage chip is a flash memory chip.

[0345] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0346] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0347] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for generating an executable file, characterized in that: The method comprises: Get the initial driver corresponding to the target storage chip; Determine standard parameters according to the processing functions of the initial driver program; wherein the standard parameters include standard input parameters and standard output parameters; the processing functions include at least initialization function, deinitialization function, erase function and write function; The initial driver is standardized by using the standard parameters to obtain a standard driver for the target storage chip; Generate an executable file of the target storage chip according to the standard driver and the calling instruction corresponding to the standard driver; Among them, the standard input parameter corresponding to the initialization function is a null value; the standard input parameter corresponding to the deinitialization function is a null value; the standard input parameter corresponding to the erase function is an erase address that will be verified for legality; and the standard input parameter corresponding to the write function is a write address that has been verified for legality.

2. The method according to claim 1, characterized in that The step of generating an executable file of the target storage chip according to the standard driver and the calling instruction corresponding to the standard driver comprises: In the random access memory RAM in the ECU, a calling address corresponding to the standard driver is selected; Storing the standard driver in a storage area corresponding to the calling address in the RAM; An executable file of the target storage chip is generated according to the calling instruction and the calling address corresponding to the standard driver.

3. The method according to claim 2, characterized in that The step of generating an executable file of the target storage chip according to the calling instruction and the calling address corresponding to the standard driver comprises: Obtaining identification information of a user corresponding to the target storage chip; According to the identification information, query the code language and memory configuration information of the user end; Compiling the calling instructions and calling addresses corresponding to the standard driver according to the code language to obtain a compiled file; Establishing link information between the compiled file and the user end according to the memory configuration information; An executable file of the target storage chip is generated according to the link information and the compiled file.

4. The method according to claim 1, characterized in that: The standard output parameters corresponding to the initialization function are initialization success and initialization failure; the standard output parameters corresponding to the deinitialization function are deinitialization success and deinitialization failure; the standard output parameter corresponding to the erase function is the erase result of the sector to be erased corresponding to the erase address; the standard output parameter corresponding to the write function is the write result of the byte to be written corresponding to the write address.

5. The method according to claim 4, characterized in that: In the case where the processing function is an erase function, the standardization processing of the initial driver program by using the standard parameters to obtain the standard driver program of the target storage chip includes: Converting the erase address into at least one sector to be erased, and determining the sector capacity of the sector to be erased; The minimum erasing unit in the initial driver is modified to the sector capacity to obtain a standard driver for the target storage chip.

6. The method according to claim 4, characterized in that: In the case where the processing function is a write function, the standardization processing of the initial driver program by using the standard parameters to obtain the standard driver program of the target storage chip includes: Converting the write address into at least one byte to be written, and determining the byte capacity of the byte to be written; The minimum write unit in the initial driver is modified to the byte capacity to obtain a standard driver for the target storage chip.

7. The method according to any one of claims 1 to 6, characterized in that The target storage chip is a flash memory chip.

8. An executable file generating device, characterized in that: The device comprises: An acquisition module is used to acquire an initial driver corresponding to a target storage chip; A standardized parameter module, used for determining standard parameters according to the processing functions of the initial driver program; wherein the standard parameters include standard input parameters and standard output parameters; the processing functions include at least initialization function, deinitialization function, erase function and write function; A standardization processing module, used to perform standardization processing on the initial driver program by using the standard parameters to obtain a standard driver program for the target storage chip; A file generation module, used for generating an executable file of the target storage chip according to the standard driver and the calling instruction corresponding to the standard driver; Among them, the standard input parameter corresponding to the initialization function is a null value; the standard input parameter corresponding to the deinitialization function is a null value; the standard input parameter corresponding to the erase function is an erase address that will be verified for legality; and the standard input parameter corresponding to the write function is a write address that has been verified for legality.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.