CN116382794A - Code sharing method, system, device and medium - Google Patents
Code sharing method, system, device and medium Download PDFInfo
- Publication number
- CN116382794A CN116382794A CN202310290911.1A CN202310290911A CN116382794A CN 116382794 A CN116382794 A CN 116382794A CN 202310290911 A CN202310290911 A CN 202310290911A CN 116382794 A CN116382794 A CN 116382794A
- Authority
- CN
- China
- Prior art keywords
- code
- code data
- instruction
- target area
- application program
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Storage Device Security (AREA)
Abstract
The application discloses a code sharing method, a system, a device and a medium. The code sharing method comprises the following steps: responding to a first region dividing instruction of a user, and setting a corresponding first target region in a Bootloader region; receiving first code data uploaded by the user, storing the first code data to the first target area, and recording first target area address information corresponding to the first code data; responding to a link instruction issued by a user on an application program, and establishing a first call instruction corresponding to the first code data in the application program; and calling and executing the first code data in the first target area when the application program identifies the first calling instruction. The code sharing method can effectively save the storage resources of the single chip microcomputer, improve the working efficiency and simultaneously can effectively prevent the leakage of important codes. The method and the device can be widely applied to the technical field of single chip microcomputer.
Description
Technical Field
The application relates to the technical field of single-chip microcomputer, in particular to a code sharing method, a system, a device and a medium.
Background
The Single chip microcomputer (Single-Chip Microcomputer) is an integrated circuit chip, is a small and perfect microcomputer system formed by integrating functions of a CPU (central processing unit), a RAM (random access memory), a ROM (read only memory), a plurality of I/O (input/output) ports, an interrupt system, a timer/counter and the like with data processing capacity on a silicon chip by adopting a very large scale integrated circuit technology, and is widely applied to the field of industrial control. The system comprises a Bootloader part and an application program part, wherein the Bootloader is a first section of code executed by the singlechip after power-on and is used as a guide program when the system is powered on; an application is an application of a system for implementing the required logic functions of a product.
At present, a Bootloader and an application program are two relatively independent programs, the application program cannot execute instructions in the Bootloader, the Bootloader cannot execute instructions in the application program, the codes in the Bootloader and the codes in the application program are partially repeated, the same work needs to be repeated once when the application program is developed, and more storage resources are needed to be occupied when the application program is burnt to a singlechip. In addition, the application program part has a product which is provided for other people to develop secondarily, the code of the application program part is open or semi-open, and part of important code information is easy to leak.
Accordingly, there is a need for solving and optimizing the problems associated with the prior art.
Disclosure of Invention
The present application aims to solve at least one of the technical problems existing in the related art to a certain extent.
Therefore, an object of the embodiments of the present application is to provide a code sharing method, which can effectively save the storage resources of a singlechip, improve the working efficiency, and simultaneously effectively prevent the leakage of important codes.
It is another object of an embodiment of the present application to provide a code sharing system.
In order to achieve the technical purpose, the technical scheme adopted by the embodiment of the application comprises the following steps:
in a first aspect, an embodiment of the present application provides a code sharing method, including:
responding to a first region dividing instruction of a user, and setting a corresponding first target region in a Bootloader region;
receiving first code data uploaded by the user, storing the first code data to the first target area, and recording first target area address information corresponding to the first code data;
responding to a link instruction issued by a user on an application program, and establishing a first call instruction corresponding to the first code data in the application program;
and calling and executing the first code data in the first target area when the application program identifies the first calling instruction.
In addition, the method according to the above embodiment of the present application may further have the following additional technical features:
further, in one embodiment of the present application, the code sharing method further includes:
and responding to a second region dividing instruction of the user, and setting a corresponding second target region in the Bootloader region.
Further, in one embodiment of the present application, the code sharing method further includes:
and receiving second code data of the application program uploaded by the user, storing the second code data to the second target area, and recording second target area address information corresponding to the second code data.
Further, in one embodiment of the present application, the code sharing method further includes:
establishing a second call instruction corresponding to the second code data according to the second target area address information;
and calling and executing the second code data in the second target area when the application program identifies the second calling instruction.
Further, in one embodiment of the present application, the step of creating, in the application program, a first call instruction corresponding to the first code data includes:
obtaining a first target area address according to the first target area address information;
adding 1 to the first target area address to determine a first target call address;
and determining the first call instruction according to the first target call address.
Further, in one embodiment of the present application, the code sharing method further includes:
and after the first code data is called and executed, returning to the address position of the next instruction of the first calling instruction and returning an execution completion result of the first code data.
Further, in one embodiment of the present application, the code sharing method further includes:
and when the calling execution of the first code data fails, returning to the address position of the next instruction of the calling instruction and returning an execution error result of the first code data.
In a second aspect, an embodiment of the present application provides a code sharing system, including:
the first processing module is used for responding to a first region dividing instruction of a user and setting a corresponding first target region in the Bootloader region;
the recording module is used for receiving the first code data uploaded by the user, storing the first code data into the first target area and recording first target area address information corresponding to the first code data;
the second processing module is used for responding to a link instruction of a user on the application program and establishing a first calling instruction corresponding to the first code data in the application program;
and the calling module is used for calling and executing the first code data in the first target area when the application program identifies the first calling instruction.
In a third aspect, an embodiment of the present application further provides a code sharing device, including:
at least one processor;
at least one memory for storing at least one program;
the at least one program, when executed by the at least one processor, causes the at least one processor to implement the code sharing method of the first aspect described above.
In a fourth aspect, embodiments of the present application further provide a computer readable storage medium having stored therein a processor executable program for implementing the code sharing method of the first aspect described above when executed by a processor.
The advantages and benefits of the present application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the present application.
The embodiment of the application discloses a code sharing method, a system, a device and a medium, wherein a corresponding first target area is set in a Bootloader area by responding to a first area dividing instruction of a user; receiving first code data uploaded by the user, storing the first code data to the first target area, and recording first target area address information corresponding to the first code data; responding to a link instruction issued by a user on an application program, and establishing a first call instruction corresponding to the first code data in the application program; and calling and executing the first code data in the first target area when the application program identifies the first calling instruction. The code sharing method can effectively save the storage resources of the single chip microcomputer, improve the working efficiency and simultaneously can effectively prevent the leakage of important codes.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following description is made with reference to the accompanying drawings of the embodiments of the present application or the related technical solutions in the prior art, it should be understood that, in the following description, the drawings are only for convenience and clarity to describe some embodiments in the technical solutions of the present application, and other drawings may be obtained according to these drawings without any inventive effort for those skilled in the art.
Fig. 1 is a flow chart of a first code sharing method according to an embodiment of the present application;
fig. 2 is a schematic diagram of a Bootloader startup flow provided in an embodiment of the present application;
fig. 3 is a flow chart of a second code sharing method according to an embodiment of the present application;
fig. 4 is a schematic flowchart of a step 130 according to an embodiment of the present application;
fig. 5 is a flow chart of a third code sharing method according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a code sharing system according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a code sharing device according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application. The step numbers in the following embodiments are set for convenience of illustration only, and the order between the steps is not limited in any way, and the execution order of the steps in the embodiments may be adaptively adjusted according to the understanding of those skilled in the art.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the present application.
Before describing embodiments of the present application in further detail, some of the terms and expressions referred to in the embodiments of the present application are described, and are suitable for the following explanation.
Bootloader: in the singlechip, bootloader can initialize hardware equipment and establish a memory space mapping diagram, so that the software and hardware environment of the singlechip operating system is brought into a proper state, and a correct environment is prepared for finally calling the kernel of the operating system. In the singlechip, there is usually no firmware program like BIOS, so the loading and starting task of the whole system is completely completed by Bootloader.
Application program: also known as APP; in a single-chip microcomputer, an application program is to realize various automatic processing tasks such as real-time control, monitoring, management, mobile computing, data processing, and the like. The hardware of the single-chip microcomputer must be selected according to specific application tasks and indexes such as power consumption, cost, volume, reliability and processing capacity, so that the storage space of the single-chip microcomputer is extremely limited, and the code of an application program is required to be compact and reliable, and the occupied storage resource is small.
At present, a Bootloader and an application program are two relatively independent programs, the application program cannot execute instructions in the Bootloader, the Bootloader cannot execute instructions in the application program, the codes in the Bootloader and the codes in the application program are partially repeated, the same work needs to be repeated once when the application program is developed, and more storage resources are needed to be occupied when the application program is burnt to a singlechip. In addition, the application program part has a product which is provided for other people to develop secondarily, the code of the application program part is open or semi-open, and part of important code information is easy to leak.
Therefore, the code sharing method provided by the embodiment of the invention can effectively save the storage resources of the singlechip, improve the working efficiency and effectively prevent the leakage of important codes.
Referring to fig. 1, in an embodiment of the present application, a code sharing method includes:
in the step, bootloader is a first code segment executed by the singlechip after power-on, and the code segment comprises functional codes such as clock initialization, timer initialization, CAN initialization, USART initialization, application version information and backup information detection, application version upgrading, application validity judgment, USART upgrading data processing, CAN upgrading data processing, HTTP upgrading data processing and the like. The Bootloader area is the storage space of Bootloader in the singlechip. In the embodiment of the application, the corresponding first target area is selected for each part of the function codes in the Bootloader area by responding to the first area dividing instruction of the user. It should be noted that, the function codes included in the Bootloader area are only illustrated in the present application, and no limitation is imposed on the present application.
It can be understood that taking the STM32F103VE singlechip as an example, the code storage space is 512K, the bootloader part storage space is 44K, and the space address range is 0x08000000 to 0x0800AFFF. According to a first region dividing instruction of a user, a corresponding space address range is set for functional codes such as clock initialization, timer initialization, CAN initialization, USART initialization, application version information and backup information detection, application version upgrade, application validity judgment, USART upgrade data processing, CAN upgrade data processing, HTTP upgrade data processing and the like, and the corresponding space address range is used as a first target region, for example, the space address range of the clock initialization functional code may be 0x08000000 to 0x080000F, and the space address range of the initialization functional code is used as the first target region of the initialization functional code.
It CAN be understood that in the boot flow of Bootloader, clock initialization, timer initialization, CAN initialization, USART initialization are initialized as the basic hardware of the single-chip microcomputer; the functional codes such as application program version information and backup information detection, application program version upgrading, application program validity judgment, USART upgrading data processing, CAN upgrading data processing, HTTP upgrading data processing and the like are the basis for the single chip microcomputer to jump and execute the application program in the application program part. Specifically, referring to fig. 2, when the Bootloader determines that the application code is valid and allows the application to be executed, the execution of the application is skipped; it should be noted that, there are various implementations of Bootloader startup, and this application will not be repeated here.
in this step, the first code data uploaded by the user may be one of code data of functions such as clock initialization, timer initialization, CAN initialization, USART initialization, application version information and backup information detection, application version upgrade, application validity judgment, USART upgrade data processing, CAN upgrade data processing, HTTP upgrade data processing, and the like. The recorded first target area address information may be a start space address or a start space address to an end space address of the first target area corresponding to the first code data. It will be appreciated that step 120 may be performed multiple times, so as to implement uploading of functional codes such as clock initialization, timer initialization, and the like, and finally, uploading of the first code segment.
in this step, the link instruction may be issued by the user during the application program design, or may be issued by the user during the application program use process. It can be appreciated that when the link instruction is issued at the time of application programming, the user identifies the corresponding first call instruction at the time of starting or testing the application for use; when the link instruction is issued in the process of using the application program by the user, the application program identifies a corresponding first call instruction when the application program is started next time by the user.
And 140, calling and executing the first code data in the first target area when the application program identifies the first calling instruction.
In this step, corresponding program codes are executed in the start-up procedure of the application program, and when the application program identifies the first call instruction, the application program finds the first code data of the first target area in the Bootloader area according to the first call instruction and executes the first code data.
It CAN be understood that the application program start-up flow also includes clock initialization, timer initialization, CAN initialization, USART initialization, application version information and backup information detection, application version upgrade, application validity judgment, USART upgrade data processing, CAN upgrade data processing, HTTP upgrade data processing, and other functional codes. In addition, since the Bootloader and the application are both programs running on the same hardware platform, the functional code of the application is identical to the corresponding functional code on the Bootloader. It CAN be understood that, by using the code sharing method provided by the embodiment of the application, after the developer writes the functional codes such as clock initialization, timer initialization, CAN initialization and the like in Bootloader development, the developer does not need to repeatedly write the functional codes such as clock initialization, timer initialization, CAN initialization and the like in subsequent application development, and the working efficiency of the developer is improved.
It can be further understood that the storage space of the singlechip is smaller, and more storage resources are occupied by code compiling and development in the traditional mode, for example, the clock initialization function code in the Bootloader in the traditional mode needs to occupy the storage resources of a certain Bootloader area in the compiling and downloading process of the singlechip, the clock initialization function code in the application program also needs to occupy the storage resources of a certain application program area, and the rest is the same. In the embodiment of the present application, specifically, the storage space occupied by the functional codes such as Bootloader startup procedure compilation and downloading to the singlechip shown in fig. 2 is about 28K, where clock initialization, timer initialization, CAN initialization, USART initialization, application version information and backup information detection, application version upgrade, application validity judgment, USART upgrade data processing, CAN upgrade data processing, HTTP upgrade data processing and the like are about 22K, and sharing of the same codes of the application and Bootloader CAN be achieved through the steps 110, 120, 130 and 140, so that the storage space resources of the 22K application are saved.
Referring to fig. 3, in some embodiments, the code sharing method further includes:
It can be understood that the storage space resources allocated to the Bootloader region by the singlechip cannot be fully utilized, and the storage space resources required by the boot flow of the Bootloader only occupy a part of the total storage space resources of the Bootloader region. The second region dividing instruction of the user may be used to divide a second target region corresponding to the important code in the application program; since Bootloader areas are typically not open, application areas are typically open or semi-open, and application code stored in the application areas is prone to leakage. Therefore, when a user needs to provide a singlechip product for a developer for secondary development, the user can store important codes in the application program to the second target area, wherein the important codes can be codes with partial confidentiality requirements or key codes related to hardware content, so that the storage resources of the singlechip can be saved, and leakage of the important codes can be effectively prevented.
In some embodiments, the code sharing method further comprises:
It may be understood that the second code data of the application program uploaded by the user may be an important code of the application program, and the recorded second area address information may be a start space address or a start space address to an end space address of the second target area corresponding to the second code data. Specifically, when the spatial address range of the second target area is 0x0800a000 to 0x0800AFFF and the second code data is stored to the second target area, the second target area address information may be 0x0800a000 or 0x0800a000 to 0x0800AFFF.
In some embodiments, the code sharing method further comprises:
It can be understood that, in the working process of the application program, corresponding program codes are executed, and when the application program identifies the second call instruction, the application program finds the second code data of the second target area in the Bootloader area according to the second call instruction and executes the second code data. It can also be appreciated that the developer of the secondary development can only obtain the second call instruction in the application program storage space, and cannot obtain the second code data, so that leakage of the important code can be effectively prevented.
Referring to fig. 4, in some embodiments, the step 130 of creating a first call instruction corresponding to the first code data in the application program includes:
It can be understood that when the single chip microcomputer application program calls the first code data, the storage address of the first code data is called first, then the single chip microcomputer application program jumps to the execution address of the first code data to execute the corresponding code, the first target area address is the storage address of the first code data, and the first target calling address is the execution address of the first code data. Specifically, for example: the function of the first code data is void CheckCRC32 (StructCRC 32) and the first target area address information is 0x08004000, then the function of the first code data is stored to the starting position of a Bootloader area 0x08004000, when the application program runs, the application program firstly calls the void CheckCRC32 (StructCRC 32) function in the position 0x08004000, and then jumps to the position (0x08004000+1) to determine the first target call address; where 0x08004000 is the memory address and (0x08004000+1) is the execution call address. It should be noted that, the embodiment of the present application is also applicable to establishing the second call instruction corresponding to the second code data according to the second target area address information.
Referring to fig. 5, in some embodiments, the code sharing method further includes:
and step 150, returning to the address position of the next instruction of the first calling instruction and returning the execution completion result of the first code data after the first code data is called and executed.
It can be understood that the execution completion result represents that the application program successfully invokes and executes the first code data stored in the Bootloader area, and when the execution of the first code data is completed, the application program returns to the next instruction position of the first invocation, so that the application program can continue to execute the corresponding flow.
In some embodiments, the code sharing method further includes:
It will be appreciated that the execution error result represents that the application program has failed in the calling or executing process, and returning to the next instruction location of the first call can enable the application program to continue to execute the corresponding flow. It can be understood that the execution error result may be a situation of insufficient storage space, set variable error, etc., and the user may perform corresponding modification according to the provided execution error result; in addition, when the first code data call fails to execute, the next instruction address position of the call instruction is returned, so that the application program can still run under the condition of missing part of functions.
The code sharing system according to the embodiment of the present application is described in detail below with reference to the accompanying drawings.
Referring to fig. 6, a code sharing system proposed in an embodiment of the present application includes:
a first processing module 101, configured to set a corresponding first target area in a Bootloader area in response to a first area division instruction of a user;
a recording module 102, configured to receive first code data uploaded by the user, store the first code data to the first target area, and record first target area address information corresponding to the first code data;
a second processing module 103, configured to establish a first call instruction corresponding to the first code data in an application program in response to a link instruction of a user on the application program;
and a calling module 104, configured to call and execute the first code data in the first target area when the application program identifies the first calling instruction.
It can be understood that the content in the above method embodiment is applicable to the system embodiment, and the functions specifically implemented by the system embodiment are the same as those of the above method embodiment, and the achieved beneficial effects are the same as those of the above method embodiment.
Referring to fig. 7, an embodiment of the present application further provides a code sharing device, including:
at least one processor 201;
at least one memory 202 for storing at least one program;
the at least one program, when executed by the at least one processor 201, causes the at least one processor 201 to implement the code sharing method embodiment described above.
Similarly, it can be understood that the content of the above method embodiment is applicable to the embodiment of the present apparatus, and the functions specifically implemented by the embodiment of the present apparatus are the same as those of the embodiment of the above method, and the achieved beneficial effects are the same as those of the embodiment of the above method.
The present embodiment also provides a computer readable storage medium in which a program executable by the processor 201 is stored, where the program executable by the processor 201 is configured to implement the above-described code sharing method embodiment when executed by the processor 201.
Similarly, it is understood that the content of the above method embodiment is applicable to the embodiment of the computer readable storage medium, and the functions of the embodiment of the computer readable storage medium are the same as those of the embodiment of the method, and the obtained beneficial effects are the same as those of the embodiment of the method.
In some alternative embodiments, the functions/acts noted in the block diagrams may occur out of the order noted in the operational illustrations. For example, two blocks shown in succession may in fact be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality/acts involved. Furthermore, the embodiments presented and described in the flowcharts of this application are provided by way of example in order to provide a more thorough understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed, and in which sub-operations described as part of a larger operation are performed independently.
Furthermore, while the present application is described in the context of functional modules, it should be appreciated that, unless otherwise indicated, one or more of the functions and/or features may be integrated in a single physical device and/or software module or one or more of the functions and/or features may be implemented in separate physical devices or software modules. It will also be appreciated that a detailed discussion of the actual implementation of each module is not necessary to an understanding of the present application. Rather, the actual implementation of the various functional modules in the apparatus disclosed herein will be apparent to those skilled in the art from consideration of their attributes, functions and internal relationships. Thus, those of ordinary skill in the art will be able to implement the present application as set forth in the claims without undue experimentation. It is also to be understood that the specific concepts disclosed are merely illustrative and are not intended to be limiting upon the scope of the application, which is to be defined by the appended claims and their full scope of equivalents.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium may even be paper or other suitable medium upon which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
In the foregoing description of the present specification, descriptions of the terms "one embodiment/example", "another embodiment/example", "certain embodiments/examples", and the like, are intended to mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present application have been shown and described, it will be understood by those of ordinary skill in the art that: many changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the application, the scope of which is defined by the claims and their equivalents.
While the preferred embodiments of the present application have been described in detail, the present application is not limited to the embodiments, and various equivalent modifications and substitutions can be made by those skilled in the art without departing from the spirit of the present application, and these equivalent modifications and substitutions are intended to be included in the scope of the present application as defined in the appended claims.
Claims (10)
1. A code sharing method, comprising:
responding to a first region dividing instruction of a user, and setting a corresponding first target region in a Bootloader region;
receiving first code data uploaded by the user, storing the first code data to the first target area, and recording first target area address information corresponding to the first code data;
responding to a link instruction issued by a user on an application program, and establishing a first call instruction corresponding to the first code data in the application program;
and calling and executing the first code data in the first target area when the application program identifies the first calling instruction.
2. The code sharing method according to claim 1, characterized in that the code sharing method further comprises:
and responding to a second region dividing instruction of the user, and setting a corresponding second target region in the Bootloader region.
3. The code sharing method according to claim 2, characterized in that the code sharing method further comprises:
and receiving second code data of the application program uploaded by the user, storing the second code data to the second target area, and recording second target area address information corresponding to the second code data.
4. The code sharing method according to claim 3, characterized in that the code sharing method further comprises:
establishing a second call instruction corresponding to the second code data according to the second target area address information;
and calling and executing the second code data in the second target area when the application program identifies the second calling instruction.
5. The code sharing method according to claim 1, wherein the step of creating a first call instruction corresponding to the first code data in the application program comprises:
obtaining a first target area address according to the first target area address information;
adding 1 to the first target area address to determine a first target call address;
and determining the first call instruction according to the first target call address.
6. The code sharing method according to claim 1, characterized in that the code sharing method further comprises:
and after the first code data is called and executed, returning to the address position of the next instruction of the first calling instruction and returning an execution completion result of the first code data.
7. The code sharing method according to claim 1, characterized in that the code sharing method further comprises:
and when the calling execution of the first code data fails, returning to the address position of the next instruction of the calling instruction and returning an execution error result of the first code data.
8. A code sharing system, comprising:
the first processing module is used for responding to a first region dividing instruction of a user and setting a corresponding first target region in the Bootloader region;
the recording module is used for receiving the first code data uploaded by the user, storing the first code data into the first target area and recording first target area address information corresponding to the first code data;
the second processing module is used for responding to a link instruction of a user on the application program and establishing a first calling instruction corresponding to the first code data in the application program;
and the calling module is used for calling and executing the first code data in the first target area when the application program identifies the first calling instruction.
9. A code sharing apparatus, comprising:
at least one processor;
at least one memory for storing at least one program;
the at least one program, when executed by the at least one processor, causes the at least one processor to implement the code sharing method of any one of claims 1-7.
10. A computer readable storage medium, in which a processor executable program is stored, characterized in that the processor executable program is for implementing the code sharing method according to any of claims 1-7 when being executed by the processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310290911.1A CN116382794A (en) | 2023-03-14 | 2023-03-14 | Code sharing method, system, device and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310290911.1A CN116382794A (en) | 2023-03-14 | 2023-03-14 | Code sharing method, system, device and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116382794A true CN116382794A (en) | 2023-07-04 |
Family
ID=86972442
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310290911.1A Pending CN116382794A (en) | 2023-03-14 | 2023-03-14 | Code sharing method, system, device and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116382794A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118708167A (en) * | 2024-08-29 | 2024-09-27 | 青岛鼎信通讯股份有限公司 | Electric energy meter extension module architecture generation method, device, extension module and medium |
-
2023
- 2023-03-14 CN CN202310290911.1A patent/CN116382794A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118708167A (en) * | 2024-08-29 | 2024-09-27 | 青岛鼎信通讯股份有限公司 | Electric energy meter extension module architecture generation method, device, extension module and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20050015582A1 (en) | Program and information processing method | |
US7421573B2 (en) | Apparatus and method for updating firmware | |
US20030233534A1 (en) | Enhanced computer start-up methods | |
US7395420B2 (en) | Using protected/hidden region of a magnetic media under firmware control | |
KR20150052107A (en) | Layout and execution of operating systems using bpram | |
US6961848B2 (en) | System and method for supporting legacy operating system booting in a legacy-free system | |
CN104156234A (en) | Multi-core processor starting and bootloader big-little endian mode adapting method device | |
CN110716845A (en) | Method for reading log information of Android system | |
CN113238819A (en) | Dynamic loading method and system of drive file suitable for U-Boot | |
CN116382794A (en) | Code sharing method, system, device and medium | |
CN113901473A (en) | A method, apparatus, device, and readable medium for secure booting of a server | |
US7003656B2 (en) | Automatic selection of firmware for a computer that allows a plurality of process types | |
CN111290740B (en) | Application program development method and device, computer equipment and storage medium | |
CN116049207A (en) | Application SQL script processing method and device, processor and electronic equipment | |
US5963741A (en) | Information processor which rewrites instructions in program to dynamically change program structure and method therefor | |
CN112445540B (en) | Program running method, system, terminal and storage medium | |
CN115827347A (en) | Control method of embedded equipment and embedded equipment | |
CN116661879A (en) | Processor, starting method and starting device of processor | |
CN111399926A (en) | Method and device for downloading starting program | |
CN113821219B (en) | Method and system for realizing application program containerization | |
CN114510375A (en) | Flash chip data area dynamic sharing system and method | |
CN109582370B (en) | Starting method and device of NOR FLASH embedded equipment | |
KR100640389B1 (en) | Method and apparatus for executing an application in a device having a NAND flash memory | |
JP3001470B2 (en) | Boot failure detection system for personal computer | |
CN117850895B (en) | Method and device for starting equipment based on boot loader and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |