Flash programming method and system based on Eclipse development platform
By integrating self-developed toolchain and debugger system on the Eclipse development platform, supporting a variety of JTAG emulators, the problem of inefficient writing process in domestic chip multi-architecture application scenarios is solved, and an efficient and highly compatible Flash writing method is realized.
Patent Information
- Application Number
- CN202510478192.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-16
- Publication Date
- 2025-06-03
AI Technical Summary
When dealing with domestic chip multi-architecture and high-complex application scenarios, the existing technology has defects such as poor cross-architecture adaptability, poor scalability and low efficiency in the writing process.
Based on the Eclipse development platform that integrates self-developed toolchain and self-developed debugger system, it provides a Flash writing method that supports multiple JTAG emulators. This method loads the compilation toolchain and software library through the target configuration file, generates the Flash driver, and uses the debugger system to connect to the target device to realize the writing operation of the Flash space.
It realizes Flash writing support for different types of chips, improves writing efficiency and integration, and has good scalability.
Smart Images

Figure CN120085884A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of electronic engineering, and particularly relates to a Flash programming method and system based on the Eclipse development platform, especially a Flash programming method based on a customized driver program, and a supporting development platform control method. Background Art
[0002] With the localization process of chip hardware, requirements are put forward for the supporting development software, especially the development platform. One of them is to provide a one-key Flash programming method for chips with multiple architectures having self-developed toolchains and software libraries. Eclipse provides a graphical development platform implementation solution with simple operation. It supports the transplantation and integration of development tools for various embedded models in the form of plugin installation and can carry out development work with various types of target systems. IEEE1149.1 provides a protocol with rich embedded control instructions, namely the JTAG protocol. Based on the JTAG protocol, the development platform can realize functions such as running state change, memory erasure, memory reading, memory writing, register modification, etc. By cooperating with customized FLASH driver code, programming, debugging, and verification of the FLASH modules of various target systems can be realized.
[0003] However, the existing technologies still have defects such as poor cross-architecture adaptability, poor scalability, and low efficiency of the programming process when dealing with application scenarios of domestic chips with multiple architectures and high complexity. Summary of the Invention
[0004] The purpose of the present invention is to provide a Flash programming method and system based on the Eclipse development platform. Based on the Eclipse development platform integrated with a self-developed toolchain and a self-developed debugger system, a Flash programming method that supports multiple JTAG emulators and is compatible with different types of chips is realized.
[0005] To solve the above technical problems, the present invention provides a Flash programming method based on the Eclipse development platform, including the following steps: Step S1: Based on the target configuration file, the development platform loads the compilation toolchain corresponding to the target device and locates the software library directory corresponding to the target device; Step S2: Based on the software library and the Flash driver program code, a Flash driver program executable file is compiled and generated; Step S3: The development platform connects to the target device through the debugger system, maps the Flash driver program to the RAM space of the target device and initializes it; Step S4: The target device initializes and resets the Flash space based on the Flash driver program; Step S5: Based on the memory mapping information of the target device, reuse the fixed address space in the RAM, and the development platform maps a single segment after segmenting the Flash programming program to the fixed address space through the debugger system; Step S6: Based on a single segment of the Flash programming program, the development platform updates the parameters of the Flash driver through the debugger system; Step S7: The Flash driver transfers the data in the fixed address space to the Flash space specified by the Flash programming program based on the updated parameters; Step S8: The target device responds to the running status of the Flash driver to the development platform through the JTAG emulator; Step S9: The development platform repeats the above steps S5 to S8 based on the number of segments of the Flash programming program.
[0006] Preferably, the target configuration file serves as an index file to provide a retrieval method for the target device database of the development platform. The target device database includes a compilation toolchain for the target device, a software library for the target device, and architecture information of the target device. This architecture information includes bit width, memory mapping, and encryption space address.
[0007] Preferably, the specific steps of Step S1 include: The development platform initializes the target device database, loads the data materials of all supported target devices, and forms a retrieval word list; Through the graphical interface of the development platform, determine the model of the target device and the model of the JTAG emulator; Using the model of the target device as a keyword, the development platform retrieves and loads the compilation toolchain and software library, and simultaneously retrieves and stores the architecture information of the target device.
[0008] Preferably, in Step S3, the execution of the debugger system requires a configuration file, which includes the model of the JTAG emulator and the architecture information of the target device; the development platform constructs the configuration file by reading the stored information of the target device database, initializes the debugger system, and connects to the target device.
[0009] Preferably, the Flash driver includes: An initialization function module for initializing the Flash driver; after the operation of this initialization function module, it schedules the interrupt function module; The interrupt function module is used for the interrupt operation of the target device and the synchronous pause of the Flash driver program. The Flash driver program sends a status identifier to the development platform and waits for the execution instruction of the development platform. The development platform displays the execution progress of the Flash programming method in real time based on the sent status identifier. After the operation of the interrupt function module is completed, the status update function module is scheduled; The status update function module is used to update the running parameters of the Flash driver program according to the register status of the current target device. After the operation of the status update function module is completed, the Flash driver function module is scheduled; The Flash driver function module is used to perform Flash ID acquisition, Flash erasure, Flash writing, or Flash verification operations according to the running parameters of the Flash driver program. After the operation of the Flash driver function module is completed, the interrupt function module is scheduled.
[0010] Preferably, in the step S5, segmenting the Flash programming procedure includes the following operations: The development platform retrieves the architecture information of the target device to obtain the address and size of the SRAM space in the idle state, and segments the Flash programming procedure into segments of the same size based on the size of the idle SRAM space; Then, based on the debugger system, the segmented Flash programming procedure is used to complete the Flash programming operations of each segment in sequence.
[0011] Preferably, the operation of obtaining the Flash ID includes: Based on the target address of the Flash space corresponding to a single segment of the Flash programming procedure, the Flash programming driver retrieves the ID number of the Flash sector corresponding to the address information and writes it into the FSMADDR register; The erasure operation of the Flash includes: Based on the FSMADDR register storing the ID number of the Flash sector, the Flash programming driver selects the erasure mode in the Flash working mode enable register, verifies the correctness of the erasure mode operation and returns the verification status value; if the erasure fails, the erasure error flag FLASH_ERASE_ERROR is returned. If the erasure is successful, the Flash exits the erasure mode and returns the SECTOR_ERASE completion flag; the verification status value is returned to the development platform as a response through the JTAG emulator.
[0012] Preferably, the writing operation of the Flash includes: Based on the FSMADDR register storing the ID number of the Flash sector, the Flash programming driver selects the programming mode in the Flash working mode enable register. Based on the SRAM space address information, the Flash programming driver writes data through the 64-bit write data register, verifies the correctness of the data write operation and returns a verification status value; if the programming fails, it returns the programming error flag FLASH_PROGRAM_ERROR, and if the programming is successful, it returns the PROGRAM completion flag; the verification status value is returned to the development platform as an answer through the JTAG emulator. The verification operation of the Flash includes: Based on the SRAM space address information, size, and the target address of the Flash space corresponding to a single segment of the Flash programming program, read whether the data in the verification target address is consistent with the written data; if not consistent, return the verification error flag VERIFY_ERROR; if the data is consistent, the verification is completed and the VERIFY completion flag is returned.
[0013] Preferably, when the development platform receives the answer, by matching the verification status value in the answer with the exception status value table, it checks the correctness of the running status of the Flash programming method and the Flash driver program; if correct, continue to loop and execute the Flash programming method and the Flash driver program, and the loop condition depends on the number of segments after the Flash programming program is segmented; if incorrect, terminate the Flash programming method and the Flash driver program.
[0014] The present invention also provides a Flash programming system based on the Eclipse development platform, which executes a Flash programming method based on the Eclipse development platform as described above, including: A development platform, installed with a target device database, used to retrieve the compilation toolchain for the target device, the software library for the target device, and the architecture information of the target device; A debugger system, connected to the development platform and the JTAG emulator respectively, used for the conversion between the machine interface protocol recognizable by the development platform and the JTAG protocol recognizable by the target device; A JTAG emulator, connecting the development platform and the target device, used for message answering between the development platform and the target device; A target device, executing a Flash programming driver, and the Flash programming driver is based on the toolchain for the target device and the supporting software library, and generates an executable file of the Flash driver program by compiling and linking the Flash driver program code.
[0015] Compared with the prior art, the present invention has the following beneficial effects: Based on the Eclipse development platform integrated with a self-developed toolchain and a self-developed debugger system, the present invention realizes a Flash programming method that supports multiple JTAG emulators and is compatible with different types of chips. The development platform receives the response of the Flash programming driver through the MachineInterface interface protocol, and then orderly completes the programming operation of the Flash space of the target device. This method has high efficiency, high integration, and scalable support. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a schematic structural diagram of the Flash programming system according to an embodiment of the present invention.
[0017] Figure 2 It is a schematic flow diagram of the Flash programming method according to an embodiment of the present invention.
[0018] Figure 3 It is a schematic flow diagram of the Flash driver program according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0019] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. According to the following description, the advantages and features of the present invention will be clearer. It should be noted that the drawings are all in a very simplified form and use non-precise scales, only for the purpose of facilitating and clearly assisting in explaining the purpose of the embodiments of the present invention.
[0020] As Figure 1 shown, an embodiment of the present invention provides a Flash programming system based on the Eclipse development platform, including a development platform, a debugger system, a JTAG emulator, and a target device.
[0021] The development platform is based on a self-developed toolchain for the target device and a supporting software library, and generates an executable file of the Flash driver program by compiling and linking the Flash driver program code. Further, the Flash driver program includes: an initialization function module, an interrupt function module, a status update function module, and a Flash driver function module. The development platform is installed with a target device database for retrieving the compilation toolchain for the target device, the software library for the target device, and the architecture information of the target device, such as bit width, memory mapping, and encrypted space address, etc. The development platform calls a series of Machine Interface interfaces to connect to the debugger client. Further, the target device is connected through the cooperation of the debugger system and the JTAG emulator.
[0022] The debugger system is connected to the development platform and the JTAG emulator respectively, and is used for the conversion between the machine interface protocol recognizable by the development platform and the JTAG protocol recognizable by the target device. The debugger system provides a communication means between the development platform and the target device. Further, the debugger system supports mainstream JLink emulators and FT2232 emulators.
[0023] The JTAG emulator connects the development platform and the target device and is used for message response between the development platform and the target device. The FT2232 emulator adopted by the JTAG emulator is a self-developed FT2232 emulator.
[0024] The target device executes a Flash programming driver, and the Flash programming driver is generated by compiling and linking Flash driver program code based on a self-developed toolchain for the target device and a supporting software library, so as to generate an executable file of the Flash driver program.
[0025] As Figure 2 shown, an embodiment of the present invention provides a Flash programming method based on an Eclipse development platform. Based on the running state of the Flash driver program and the Flash space programming method executed by the development platform, the Flash space of the target device is updated. The development platform displays the execution progress of the Flash programming method in real time based on the status identifier sent by the Flash driver program. The specific steps include: Based on the target configuration file, the development platform loads the compilation toolchain corresponding to the target device and locates the software library directory corresponding to the target device. Specifically, the development platform needs to first initialize the target configuration database, load the data of all supported devices, and form a retrieval word table. Through the graphical interface of the development platform, the model of the target device and the model of the JTAG emulator are determined. Using the model of the target device as a keyword, the development platform retrieves and loads the compilation toolchain and the software library, and simultaneously retrieves and stores the architecture information of the target device.
[0026] Based on the software library and the Flash driver program code, an executable file of the Flash driver program is compiled.
[0027] The development platform connects to the target device through the debugger system, maps the Flash driver program to the RAM space of the target device and completes the initialization. Specifically, the execution of the debugger system requires a configuration file, which contains information such as the model of the JTAG emulator, the memory mapping of the target device, the encrypted space address of the target device, and the bit width of the target device. The development platform constructs a configuration file by reading the information stored in the target configuration database, initializes the debugger system and connects to the target device.
[0028] Based on the Flash programming method of the development platform and the Flash driver executed by the target device, the Flash programming operation is completed. Specifically, as Figure 3 shown, the Flash programming method and Flash driver based on the development platform further include: Segmented operation of the programming procedure: The development platform retrieves the architecture information of the target device to obtain the address and size of the SRAM space in the idle state. Further, the programming procedure is segmented based on the size of the idle SRAM space. Then, based on the debugger system, the programming procedure is segmented, and the Flash programming operations of each segment are completed in sequence.
[0029] Operation of obtaining Flash ID: Based on the target address of the Flash space corresponding to a single segment of the programming procedure, the Flash programming driver retrieves the ID number of the Flash sector corresponding to this address information and writes it into the FSMADDR register.
[0030] Erase operation of Flash: Based on the FSMADDR register storing the ID number of the Flash sector, the Flash programming driver selects the erase mode in the Flash working mode enable register. Further, the correctness of this operation is verified and the verification status value is returned. If the erase fails, the erase error flag FLASH_ERASE_ERROR is returned. If the erase is successful, the Flash exits the erase mode and the SECTOR_ERASE completion flag is returned. The verification status value is returned to the development platform as a response through the JTAG interface.
[0031] Write operation of Flash: Based on the FSMADDR register storing the ID number of the Flash sector, the Flash programming driver selects the programming mode in the Flash working mode enable register. Based on the SRAM space address information, the Flash programming driver realizes data writing through the 64-bit write data register. Further, the correctness of this operation is verified and the verification status value is returned. If the programming fails, the programming error identifier FLASH_PROGRAM_ERROR is returned. If the programming is successful, the PROGRAM completion flag is returned. The verification status value is returned to the development platform as a response through the JTAG interface.
[0032] Verification operation of Flash: Based on the SRAM space address information and size, and the target address of the Flash space corresponding to a single segment of the programming procedure, it is read whether the data in the verification target address is consistent with the written data; if not, the verification error flag VERIFY_ERROR is returned; if the data is consistent, the verification is completed and the VERIFY completion flag is returned. The verification status value is returned to the development platform as a response through the JTAG interface.
[0033] When the development platform receives the said response, by matching the verification status value in the response and the exception status value table, it checks the correctness of the running status of the Flash programming method and the Flash driver. If it is correct, it continues to loop and execute the Flash programming method and the Flash driver. The condition for the loop is the number of segments of the segmented programming program. If it is incorrect, it terminates the Flash programming method and the Flash driver.
[0034] In summary, based on the Eclipse development platform integrated with the self-developed tool chain and the self-developed debugger system, the invention realizes a Flash programming method that supports multiple JTAG emulators and is compatible with different types of chips. The development platform receives the response of the Flash programming driver through the Machine Interface protocol, and then orderly completes the Flash space programming operation of the target device. This method has high efficiency, high integration, and scalable support.
[0035] The above description is only a description of the preferred embodiments of the present invention, and does not limit the scope of the present invention in any way. Any changes and modifications made by those of ordinary skill in the art of the present invention based on the above disclosure shall fall within the protection scope of the claims.
Claims
1. A Flash programming method based on Eclipse development platform, characterized in that: The steps include: Step S1: Based on the target configuration file, the development platform loads the compilation tool chain corresponding to the target device and locates the software library directory corresponding to the target device; Step S2: compile and generate a Flash driver executable file based on the software library and the Flash driver code; Step S3: the development platform connects to the target device through the debugger system, maps the Flash driver to the RAM space of the target device and initializes it; Step S4: the target device initializes and resets the Flash space based on the Flash driver; Step S5: Based on the memory mapping information of the target device, the fixed address space in the RAM is reused, and the development platform maps the single segment of the Flash burning program to the fixed address space through the debugger system; Step S6: Based on the single segment of the Flash burning program, the development platform updates the parameters of the Flash driver through the debugger system; Step S7: The Flash driver moves the data in the fixed address space to the Flash space specified by the Flash burning program based on the updated parameters; Step S8: The target device responds to the development platform via the JTAG emulator about the running status of the Flash driver; Step S9: The development platform repeats the above steps S5 to S8 based on the number of segments of the Flash program.
2. A Flash programming method based on Eclipse development platform as claimed in claim 1, characterized in that: The target configuration file serves as an index file to provide a retrieval method for a target device database for the development platform. The target device database includes a compilation tool chain for the target device, a software library for the target device, and architecture information of the target device. The architecture information includes bit width, memory mapping, and encryption space address.
3. A Flash programming method based on Eclipse development platform as claimed in claim 2, characterized in that: The step S1 specifically includes: The development platform initializes the target device database, loads the data of all supported target devices, and forms a search word list; Determine the model of the target device and the model of the JTAG emulator through the graphical interface of the development platform; Using the target device model as a keyword, the development platform retrieves and loads the compilation tool chain and software library, and retrieves and stores the architecture information of the target device.
4. A Flash programming method based on Eclipse development platform as claimed in claim 2, characterized in that: In step S3, the execution of the debugger system requires a configuration file, which includes the model of the JTAG emulator and the architecture information of the target device; the development platform reads the information stored in the target device database to construct the configuration file, initializes the debugger system and connects to the target device.
5. A Flash programming method based on Eclipse development platform as claimed in claim 1, characterized in that: The Flash driver includes: An initialization function module is used for initializing the Flash driver; after the initialization function module is completed, an interrupt function module is scheduled; The interrupt function module is used for interrupting the target device and pausing the Flash driver synchronously. The Flash driver sends a status mark to the development platform and waits for the execution instruction of the development platform. The development platform displays the execution progress of the Flash burning method in real time based on the sent status mark. After the interrupt function module completes the operation, it schedules the status update function module. A status update function module is used to update the Flash driver operation parameters according to the register status of the current target device. After the status update function module is completed, the Flash driver function module is scheduled; The Flash driver function module is used to execute Flash ID acquisition, Flash erasing, Flash writing or Flash verification operations according to the Flash driver operation parameters; the Flash driver function module schedules the interrupt function module after the operation is completed.
6. A Flash programming method based on Eclipse development platform as claimed in claim 1, characterized in that: In step S5, segmenting the Flash programming program includes the following operations: The development platform retrieves the architecture information of the target device, obtains the address and size of the SRAM space in an idle state, and segments the Flash burning program into segments of the same size based on the size of the idle SRAM space; Then, based on the debugger system, the segmented Flash programming program is completed in sequence for each segment of the Flash programming operation.
7. A Flash programming method based on Eclipse development platform as claimed in claim 5, characterized in that: The Flash ID acquisition operation includes: Based on the target address of the Flash space corresponding to a single segment of the Flash burning program, the Flash burning driver retrieves the ID number of the Flash sector corresponding to the address information and writes it into the FSMADDR register; The erasing operation of the Flash includes: Based on the FSMADDR register that stores the ID number of the Flash sector, the Flash burning driver selects the erase mode in the Flash working mode enable register, verifies the correctness of the erase mode operation and returns the verification status value; if the erase fails, the erase error flag FLASH_ERASE_ERROR is returned; if the erase is successful, the Flash exits the erase mode and returns the SECTOR_ERASE completion flag; the verification status value is returned to the development platform through the JTAG emulator as a response.
8. A Flash programming method based on Eclipse development platform as claimed in claim 7, characterized in that: The writing operation of the Flash includes: Based on the FSMADDR register storing the ID number of the Flash sector, the Flash burning driver selects the programming mode in the Flash working mode enable register, and based on the SRAM space address information, the Flash burning driver implements data writing through the 64-bit write data register, verifies the correctness of the data writing operation and returns the verification status value; if the programming fails, the programming error flag FLASH_PROGRAM_ERROR is returned, and if the programming is successful, the PROGRAM completion flag is returned; the verification status value is returned to the development platform through the JTAG emulator as a response; The verification operation of the Flash includes: Based on the SRAM space address information and size, and the target address of the Flash space corresponding to a single fragment of the Flash burning program, the data in the target address is read and verified to be consistent with the written data; if not, the verification error flag VERIFY_ERROR is returned; if the data is consistent, the verification is completed and the VERIFY completion flag is returned.
9. A Flash programming method based on Eclipse development platform as claimed in claim 8, characterized in that: The development platform receives the response and checks the correctness of the Flash programming method and the running status of the Flash driver by matching the verification status value and the abnormal status value table in the response; If it is correct, the Flash burning method and the Flash driver program are continuously executed in a loop, and the loop condition depends on the number of segments after the Flash burning program is segmented; if it is wrong, the Flash burning method and the Flash driver program are terminated.
10. A Flash burning system based on Eclipse development platform, executing a Flash burning method based on Eclipse development platform as claimed in any one of claims 1 to 9, characterized in that: include: A development platform, which is installed with a target device database for retrieving a compilation tool chain for a target device, a software library for a target device, and architecture information of a target device; A debugger system, connected to the development platform and the JTAG emulator respectively, for converting between a machine interface protocol recognizable by the development platform and a JTAG protocol recognizable by the target device; JTAG emulator, connecting the development platform and the target device, used for message response between the development platform and the target device; The target device executes the Flash burning driver, which is based on a tool chain oriented to the target device and a matching software library, and generates a Flash driver executable file by compiling and linking the Flash driver code.