MCU Chip Patching via SVC Interrupt Long Address Jump

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current patch technology for MCU chips is limited by the ability of jump instructions to only perform short address jumps, restricting the range of addressable memory locations and increasing hardware requirements and costs to support more patches.

Innovation Solution

Implementing a method that uses interrupt instructions, specifically the SVC interrupt, to enable long address jumps by storing correspondence relationships between function addresses and interrupt instructions in a hardware register, allowing for patching without the limitations of traditional jump instructions.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of operation

If jump instructions are used for patching, then the implementation is simple, but the address jump range is limited and cannot achieve long address jumps

Engineering Contradiction:
Improvepatching implementation simplicityVSAvoidaddress jump range
Core Design Contradiction:
Ease of operationVSAdaptability or versatility

Solution Approach 1:

The patent introduces an intermediary mechanism (interrupt service routine with return address modification) between the original program execution and the patch function. Instead of directly jumping to the patch function, the system uses an interrupt that redirects execution flow, allowing the patch function to be located anywhere in the memory space while maintaining simple implementation through standard interrupt handling mechanisms.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Device complexity

If traditional jump instructions are used, then the patching mechanism is straightforward, but strict requirements are imposed on storage location of replacement function

Engineering Contradiction:
Improvepatching mechanism complexityVSAvoidmemory layout flexibility
Core Design Contradiction:
Device complexityVSAdaptability or versatility

Solution Approach 1:

The patent segments the patching mechanism into two independent parts: the interrupt service routine (which handles the redirection) and the patch function (which contains the actual repair code). This segmentation allows the patch function to be placed independently in memory without being constrained by the interrupt handler's location, providing flexible memory layout design.

Inventive Principle:
Principle #1Segmentation

3Adaptability or versatility

If long address jumps are enabled, then memory layout flexibility improves, but hardware requirements and costs increase

Engineering Contradiction:
Improvememory layout flexibilityVSAvoidhardware requirements
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The system uses existing interrupt handling hardware and mechanisms to achieve long address jumps, rather than requiring specialized long-jump hardware. The interrupt service routine automatically captures the return address and modifies it to point to the patch function, utilizing self-service capabilities of the processor to eliminate the need for additional hardware components.

Inventive Principle:
Principle #25Self-service

Data Source

PatentEP4012554B1Chip patching method and chip
Publication Date: 2023.10.18 SHENZHEN GOODIX TECH CO LTD
  • EP4012554B1 patent drawingFigure 1~2
  • EP4012554B1 patent drawingFigure 3~4
  • EP4012554B1 patent drawingFigure 5~7

AI summary

An embodiment of the present application discloses a method for patching a chip and a chip, which can perform transfer through an interrupt instruction to obtain a function address of a patch function, so as to replace a function that needs to be replaced. This method does not need to carry address information of the patch function in the instruction, and thus can realize a long address jump without limitation of a jump address range. The chip includes a first program, and the method includes: when a function that needs to be replaced in the first program is run, executing an interrupt service routine according to a pre-stored correspondence relationship between an address of the function that needs to be replaced and an interrupt instruction, where the interrupt service routine is a service routine scheduled by an interrupt instruction corresponding to the function that needs to be replaced, and a return address of the interrupt service routine is an address of a patch function of the function that needs to be replaced (S410); and running the patch function according to the address of the patch function, to perform patch processing on the first program (S420).