OTP Code Patching via Invalid Opcode Exception

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for patching code in one time programmable (OTP) memory are not applicable, as OTP memory cannot be reprogrammed, and existing techniques for read-only memory (ROM) require extra code and RAM space, which is unnecessary for FLASH-based systems.

Innovation Solution

A method that involves writing an invalid opcode at the beginning of a modified function in OTP memory, causing an exception that triggers an exception handler to search a RAM dictionary for the patch address, allowing the processing unit to jump to the modified function in volatile memory.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of manufacture

If OTP memory is used in network devices, then cost is reduced, but the ability to apply patches and updates after device delivery is lost

Engineering Contradiction:
ImprovecostVSAvoidability to apply patches
Core Design Contradiction:
Ease of manufactureVSAdaptability or versatility

Solution Approach 1:

The system segments the code storage into two parts: OTP memory for storing the original code ( providing cost advantage) and RAM for storing patch dictionaries and loaded patches (enabling update capability). This segmentation allows the system to leverage the cost benefit of OTP while maintaining patchability through the supplementary RAM storage.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

A patch dictionary stored in RAM acts as an intermediary between the OTP memory and the execution environment. The dictionary contains mappings from original code addresses to patched code addresses, enabling the system to redirect execution to updated code without modifying the OTP memory itself.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If jump tables are used in RAM for ROM patching, then patching capability is achieved, but extra code space and RAM space are required

Engineering Contradiction:
Improvepatching capabilityVSAvoidcode space and RAM space
Core Design Contradiction:
Adaptability or versatilityVSQuantity of substance

Solution Approach 1:

Instead of implementing a comprehensive jump table mechanism that would require extensive RAM space and code modifications, the patent applies a partial approach by only storing address mappings for patched functions in a compact dictionary structure. This reduces the space requirement compared to a full jump table implementation while maintaining essential patching capability.

Inventive Principle:
Principle #16Partial or excessive action

3Ease of manufacture

If different SDKs are maintained for FLASH-based and OTP-based devices, then device-specific optimization is achieved, but development effort and maintenance complexity increase

Engineering Contradiction:
Improvedevice-specific optimizationVSAvoiddevelopment effort
Core Design Contradiction:
Ease of manufactureVSDevice complexity

Solution Approach 1:

The patent implements a universal patching mechanism that works across both FLASH-based and OTP-based devices. By using a standardized approach of inserting invalid opcodes and resolving them through RAM-based dictionaries, the same SDK can serve multiple device types, eliminating the need for separate SDK maintenance while achieving device-specific functionality through the unified interface.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Data Source

PatentUS12204891B2Method for patching code located in one time programmable memory
Publication Date: 2025.01.21 SILICON LABORATORIES INC
  • US12204891B2 patent drawing
  • US12204891B2 patent drawing
  • US12204891B2 patent drawing

AI summary

Methods of performing updates to a software image that is disposed in a one time programmable (OTP) memory device are disclosed. The method includes writing an invalid opcode at the beginning of a function that has been modified. This invalid opcode causes an exception. The exception handler determines the address where the invalid opcode was located and searches a random access memory (RAM) dictionary. This RAM dictionary contains entries that each have an original address in the OTP Memory and the patch address in a volatile memory. The exception handler then causes the processing unit to jump to the patch address, where a modified function is located.