1. Field of the Invention
The present invention relates to a firmware processing method, and more particularly, to a firmware updating and extending method for an application specific integrated circuit (ASIC).
2. Description of the Prior Art
In conventional application-specific integrated circuits, codes have to be masked in read-only memory for a boot up procedure of a corresponding operating system or for other procedures related to application programs after the boot-up processes have been executed. However, when program designers would like to update codes for the boot-up procedure or the application programs-related procedures for better execution or other design purposes, the program designers cannot update the codes masked in the read-only memory directly. Therefore, the program designers can only update the codes by taping out the mask on the read-only memory for generating new read-only memory having updated code for updating the boot-up procedure or updating the application programs-related procedures. The updated codes may merely have little difference with the codes masked in the old read-only memory, and taping out the mask for generating new read-only memory having updated code is obviously expensive and time-consuming.
The claimed invention provides a firmware updating and extending method for an application specific integrated circuit. The method comprises providing read only memory (ROM) and random access memory, writing an updated code into the random access memory, executing a certain address of firmware code stored in the read only memory, when executing a certain specific address of firmware code, jumping to the updated code stored in the random access memory, and after executing the updated code, jumping back to the firmware code stored in the read only memory.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
The present invention provides a code processing method, which is also a firmware updating and extending method, for updating and extending process codes without taping out a mask of read-only memory in firmware. The firmware updating and extending method takes advantages of a programmable memory such as flash memory. So the codes stored in the programmable memory can be conveniently updated, especially for codes stored in flash memory, which has high access efficiency. Besides, the firmware updating and extending method also takes advantages of random access memory (RAM) having the property of dynamic loading. Random access memory can temporarily store data according to instant requirements of a corresponding operating system, thereby random access memory is also utilized for temporarily and dynamically storing data or codes loaded from flash memory in the present invention.
The firmware updating and extending method of the present invention is simply introduced as follows. Unchangeable codes are masked in the read-only memory of the ASIC whereas changeable codes are pre-stored in the programmable memory such as a flash memory outside the ASIC. While a procedure to be updated is going to be executed by the ASIC, the updated codes related to the procedure and pre-stored in the flash memory are loaded into the random access memory. The procedure first executes unchangeable codes from the read-only memory. When the procedure executes at a specific address on the read-only memory, where an updated code relating to the specific address had been loaded to the random access memory, the procedure temporarily switches the execution to the random access memory for executing the updated code. Therefore, the procedure includes the updated code without changing unchangeable codes on the read-only memory. The aim of the firmware updating and extending method of the present invention is thus fulfilled.
Details of the firmware updating and extending method of the present invention are described as follows. In
Please refer to
The firmware updating and extending method classifies codes into two types. One type of code is regarded as fixed codes, which cannot be updated under any circumstances. The fixed codes are masked in read-only memory 102 since code stored in read-only memory cannot be changed or updated. As shown in
The random access memory 104 of the program memory 100 is utilized for dynamically loading codes from the flash memory 106 according to various instant requirements of the operating system or various procedures to be executed by the operating system. As shown in
The code replacement table 108 is utilized for storing mappings for supporting dynamic loading between the read-only memory 102 and the random access memory 104. Each mapping of the mappings stored in the code replacement table 108 comprises a source address of the read-only memory 102 and a target address of the random access memory 104, thereby, while the operating system executes a fixed code at the source address of the read-only memory 102, the operating system can immediately jump the execution to the updatable code stored at the target address of the random access memory 104 by querying the mapping comprising the source address and the target address. As shown in
Before the ASIC boots up, the operating system first loads updatable code of processes related to the boot up procedure from the flash memory 106 to the random access memory 104. Since the updatable codes stored in the flash memory 106 are classified according to various procedures in advance, the operating system can rapidly load necessary updatable code from the flash memory 106. As shown in
While the ASIC boots up, the operating system belonging to the ASIC starts sequentially executing the fixed codes related to the boot up procedure and stored in the read-only memory 102. At the same time, the operating system monitors the mappings stored in the code replacement table 108 for jumping the execution from the read-only memory 102 to the random access memory 104. When the operating system executes at a source address of the read-only memory 102, the source address matching with a mapping of the code replacement table 108, the operating system jumps the execution from the source address of the read-only memory 102 to a target address of the random access memory 104 according to the matched mapping. Then the operating system executes the updatable code at the target address of the random access memory 104. After finishing executing the updatable code in the random access memory 104, the execution directly jumps back to the source address of the read-only memory 102 or a next address of the read-only address 102. When there is a plurality of mappings corresponding to the boot up procedure in the code replacement table, it indicates that there is a corresponding plurality of jumps in the program memory 100.
When the programmer would like to update the updatable code again so that the updated updatable code can be loaded into a next-time boot up procedure, the programmer only needs to store new codes corresponding to the boot-up procedure into the flash memory 106, and when a next-time boot up procedure begins, the new codes will be executed by the operating system as mentioned above. Therefore, updating the updatable code is simply finished by updating the code stored in the flash memory 106.
The method can be easily used for skipping some block of codes in the read only memory by setting both the source and target addresses in the ROM codes. Therefore, when the source address is reached, the execution automatically jumps to the target address so that the block of codes is skipped.
Please refer to
After the ASIC boots up, the firmware code itself of the ASIC loads the three updatable codes from the flash memory 106 to the random access memory 104 as shown in
While the first procedure is going to be executed with the updatable code “Update 1”, the vector “Vector 1” is put into the first column for dynamically executing the updatable code “Update 1” since the vector “Vector 1” is able to explicitly point to the location of the updated code “Update 1” in the random access memory 104. Therefore, the functions of the vectors make the updated code easily replaced. Please refer to
The number of procedures that the firmware updating and extending method utilized in
Please refer to
Step 300: Storing updatable codes corresponding to the boot up procedure in the flash memory.
Step 302: Loading the updatable codes from the flash memory to the random access memory.
Step 304: Generating corresponding mappings between the fixed codes in the read-only memory and the updatable codes in the random access memory and putting the mappings in the code replacement table.
Step 306: While executing at source address where a fixed code to be updated is stored in the read-only memory, jumping the execution to a target address where a corresponding updatable code is loaded in the random access memory according to a corresponding mapping put in the code replacement table.
Step 308: After the updatable code is executed, jumping the execution back to the read-only memory.
Step 310: Check if the boot up procedure is completed.
Step 312: End.
The steps Step 300, 302, and 304 are performed for preparation before the boot up procedure is executed. The steps 306, 308, and 310 are performed repeatedly until the boot up procedure is completed in step 310 since there may be a plurality of fixed codes to be updated in the read-only memory.
Please refer to
Step 400: Storing updatable codes corresponding to various procedures in the flash memory.
Step 402: Loading the updatable codes from the flash memory to the random access memory.
Step 404: Preparing columns corresponding to the procedures in the random access memory.
Step 406: While a plurality of procedures is going to be executed, putting vectors corresponding to the plurality of procedures in respective columns whereas the values of the other columns are NULL.
Step 408: Jumping the execution of an executed procedure from the corresponding fixed code in the read-only memory to a corresponding column in the random access memory, the column having a vector of the executed procedure.
Step 410: Jumping the execution to a corresponding updatable code on the random access memory, the corresponding updatable code is pointed to by the vector previously put in the corresponding column.
Step 412: After the updatable code is executed, jumping the execution back to the read-only memory.
Step 414: Go to Step 404 when another combination of procedures different from the plurality of procedures is going to be executed, else, go to Step 408.
The steps Step 400, 402, 404, and 406 are performed for preparation before a plurality of procedures is going to be executed after the boot up procedure of the ASIC is completed. The steps 408, 410, 412, and 414 are performed repeatedly for instant requirements of the ASIC until a different set of updated procedures is needed. This means that the combination of procedures to be executed varies instantly according to instant requirements of the ASIC, and one combination of procedures to be executed corresponds to a single iteration of the steps 408, 410, 412, and 414.
The firmware updating and extending method of the present invention provides an easier way for updating codes of procedures in firmware using flash memory. The properties of large storage and easy updating in the flash memory are utilized. The property of rapid access in the random access memory is also utilized. By loading the updatable codes from the flash memory to the random access memory in advance, the operating system of the ASIC can easily access and execute the updatable codes, which have been updated with respect to the procedures in the firmware, and the procedures may be easily updated by executing the updated updatable codes. Therefore, even if the fixed code masked in the read-only memory cannot be updated, by updating the updatable codes, the aim of updating the procedures without changing the codes in the read-only memory of the present invention is easily fulfilled.
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.