A method and device for switching between a SIM card and an eSIM based on a GPIO multiplexing mechanism

By using the GPIO multiplexing mechanism to dynamically switch hardware resources between SIM cards and eSIMs, the problems of hardware resource waste and insufficient design flexibility in existing technologies are solved, enabling device miniaturization and cost control, and improving resource utilization and user experience.

CN122137909APending Publication Date: 2026-06-02SICHUAN COOSEA TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SICHUAN COOSEA TECH CO LTD
Filing Date
2026-02-25
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In existing technologies, the hardware resource allocation of physical SIM cards and eSIMs is static and independent, resulting in high hardware costs, resource waste, and insufficient design flexibility, making it difficult to achieve device miniaturization and cost control.

Method used

The system employs a GPIO multiplexing mechanism, using a GPIO multiplexing module, a non-volatile storage module, and a control module to achieve dynamic switching of hardware resources. The non-volatile storage module stores the switching flag, and the control module performs GPIO switching connections when the device starts up, enabling the switching between SIM card and eSIM functions.

Benefits of technology

It reduces hardware costs, improves resource utilization, enhances device flexibility and user experience, avoids signal conflicts, and conforms to the concept of green design.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122137909A_ABST
    Figure CN122137909A_ABST
Patent Text Reader

Abstract

This invention discloses a method and apparatus for switching between SIM cards and eSIMs based on a GPIO multiplexing mechanism. The apparatus includes a GPIO multiplexing module, a non-volatile storage module, and a control module. The method includes: responding to a user's selection of a SIM card or eSIM, writing the corresponding identifier into a switching flag bit in the non-volatile storage; after the device restarts, reading the switching flag bit during the initialization phase; configuring the GPIO multiplexing controller according to its value, connecting a set of multiplexed GPIO pins to a SIM card slot controller or an eSIM chip controller; and finally initializing the connected controller and activating the corresponding functions. This invention solves the problems of high hardware cost, large space occupation, and low resource utilization caused by the independent resources of eSIM and physical SIM card slots in the prior art by combining hardware multiplexing and software switching, realizing dynamic allocation of hardware resources and significantly improving design flexibility and economic benefits.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of mobile communication terminal technology, and in particular to a method and apparatus for dynamically switching hardware resources between a physical subscriber identification module card (SIM card) and an embedded subscriber identification module (eSIM) in a smart device. Background Technology

[0002] With the rapid development of mobile communication technology, the functions of smart devices are becoming increasingly complex. The user identification module is the key to the device's access to the network. In recent years, embedded subscriber identity module (eSIM) technology has gradually become the standard configuration of smart devices due to its advantages such as small size and remote configuration. However, in device design, especially in multi-SIM devices that support multiple SIM cards, how to balance the traditional physical SIM card (especially the second SIM slot SIM2) with eSIM functions has become a challenge.

[0003] The current mainstream approach is to design a dedicated circuit for eSIM that is completely independent of the physical SIM card slot. That is, the device motherboard usually has a SIM1 card slot, a SIM2 card slot, and an eSIM chip circuit. This parallel architecture causes the eSIM function to permanently occupy a set of hardware resources, such as dedicated general-purpose input / output (GPIO) pins, power management lines, etc.

[0004] However, the aforementioned prior art has at least the following drawbacks:

[0005] 1. High hardware costs and wasted space: Two independent hardware circuits increase the complexity of motherboard wiring, the area of ​​printed circuit boards (PCBs) and material costs, which is not conducive to equipment miniaturization and cost control.

[0006] 2. Low hardware resource utilization: Most users typically only use one function of SIM2 or eSIM at any given time. However, in existing technologies, the hardware resources allocated to both are statically allocated and cannot be dynamically adjusted according to actual usage, resulting in idle and wasted resources.

[0007] 3. Insufficient design flexibility: Fixed hardware allocation limits the diversity of device form factor design. In the pursuit of thin and compact devices, reserving two sets of interface resources has become a design bottleneck.

[0008] Therefore, there is an urgent need for an innovative equipment solution that can effectively address the above problems. Summary of the Invention

[0009] The main objective of this invention is to overcome the shortcomings of the prior art and provide a SIM card and eSIM switching method and device based on GPIO multiplexing mechanism, which aims to realize dynamic sharing of hardware resources, thereby reducing costs and space occupation and improving resource utilization.

[0010] To achieve the above objectives, the present invention adopts the following technical solution: A SIM card and eSIM switching device based on GPIO multiplexing mechanism, comprising: The GPIO multiplexing module has a common terminal connected to a set of multiplexed GPIO pins, a first selection terminal connected to the SIM card controller, and a second selection terminal connected to the eSIM controller. A non-volatile storage module is used to store a switching flag bit, which is used to indicate whether the currently selected function is SIM card or eSIM; The control module is communicatively connected to the non-volatile memory module and the GPIO multiplexing module. The control module is configured to read the switching flag bit when the device starts up and generate a control signal according to the value of the flag bit to drive the GPIO multiplexing module to switch its common terminal to its first selection terminal or second selection terminal.

[0011] The SIM card and eSIM switching device based on the GPIO multiplexing mechanism, wherein the GPIO multiplexing module is a multiplexer, which is integrated inside the baseband processor or set as an independent chip on the motherboard.

[0012] The SIM card and eSIM switching device based on GPIO multiplexing mechanism, wherein the non-volatile storage module is a non-volatile storage area inside the baseband processor, a specific configuration file in the device file system, or a specific attribute item in the EFI system partition.

[0013] The aforementioned SIM card and eSIM switching device based on GPIO multiplexing mechanism, wherein the control module is specifically a modem firmware running on the baseband processor, or an operating system kernel driver running on the application processor.

[0014] The SIM card and eSIM switching device based on the GPIO multiplexing mechanism includes at least signal pins for power control, reset, clock, and data transmission in a single set of multiplexed GPIO pins.

[0015] The SIM card and eSIM switching device based on the GPIO multiplexing mechanism further includes a signal pin for card presence detection in the single set of multiplexed GPIO pins.

[0016] An electronic device includes a motherboard, a baseband processor, a SIM card slot, and an eSIM chip. The electronic device also includes a SIM card and eSIM switching device based on the GPIO multiplexing mechanism described in any one of the above-mentioned methods.

[0017] A SIM card and eSIM switching method based on GPIO multiplexing mechanism is applied in an electronic device, the electronic device including a set of multiplexed GPIO pins shared with a SIM card controller and an eSIM controller via a GPIO multiplexing module; the method includes: Status writing step: In response to the user's selection operation, write the identifier representing the selection of SIM card or eSIM into the switching flag bit in non-volatile memory; Reboot and read steps: During the initialization phase after the electronic device undergoes a reboot process, the switching flag bit in the non-volatile memory is read; Hardware configuration steps: Based on the value of the switching flag, generate a configuration instruction to the GPIO multiplexing controller, so that the electrical connection of a single set of multiplexed GPIO pins is switched to the SIM card controller or eSIM controller; Function activation steps: Initialize the connected SIM card controller or eSIM controller and activate the corresponding SIM card function or eSIM function.

[0018] The SIM card and eSIM switching method based on GPIO multiplexing mechanism further includes, after the state writing step: sending a restart prompt message to the user, indicating that the device needs to be restarted for the function switching to take effect.

[0019] The SIM card and eSIM switching method based on GPIO multiplexing mechanism is described in which the hardware configuration step is completed during the initialization phase of the baseband subsystem and before the complete loading of the operating system kernel.

[0020] The SIM card and eSIM switching method based on GPIO multiplexing mechanism includes a first value and a second value, which correspond to the SIM card and eSIM respectively. The hardware configuration step further includes: if the read switching flag is the first value, then the GPIO multiplexing controller is configured to map the multiplexed GPIO pin to the SIM card controller; if it is the second value, then it is mapped to the eSIM controller.

[0021] The SIM card and eSIM switching method based on GPIO multiplexing mechanism further includes an automatic trigger mode: when a physical SIM card is detected inserted into the SIM card slot, the switching flag is automatically written with a value representing the selected SIM card, and the user is prompted to restart.

[0022] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the SIM card and eSIM switching method based on the GPIO multiplexing mechanism as described above.

[0023] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. Significantly saves hardware resources: By reusing GPIO pins, the number of pins required by the main control chip is directly reduced, simplifying PCB routing and reducing cost and space occupation.

[0024] 2. Improve resource utilization: It enables dynamic allocation of hardware resources, avoids resource idleness, and conforms to the concept of green design.

[0025] 3. Enhanced user experience and device flexibility: Users can flexibly select functions, and the settings are effective once and for all, providing more room for diversified device forms and thinner and lighter designs.

[0026] 4. High reliability: By switching during the device startup initialization phase, signal conflicts and stability issues that may arise from dynamic switching during system operation are avoided. Attached Figure Description

[0027] Figure 1 This is a flowchart of a user's function selection via UI, provided in an embodiment of the present invention. Figure 2 This is a flowchart illustrating the function switching process after a device restart, according to an embodiment of the present invention. Figure 3 This is a hardware structure block diagram of a device provided in an embodiment of the present invention; Figure 4 This is a connection diagram of a GPIO multiplexing module (MUX) provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the hardware system of an electronic device (taking a mobile phone as an example) provided in an embodiment of the present invention. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and several specific embodiments. It should be understood that the specific embodiments described herein are merely for explaining the invention and are not intended to limit the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0029] (Example 1) Reference Figure 3As shown, this embodiment provides a SIM card and eSIM switching device based on GPIO multiplexing mechanism. The switching device 300 includes a GPIO multiplexing module 310, a non-volatile storage module 320 and a control module 330. The three modules will be described in detail below.

[0030] Specifically, the GPIO multiplexing module 310 is the core physical component for realizing hardware resource multiplexing. In this preferred embodiment, the GPIO multiplexing module 310 is implemented using a single-pole double-throw (SPDT) analog switch or multiplexer (MUX). Its common port is physically connected to a set of multiplexed GPIO pins through PCB traces. The number and definition of this set of multiplexed GPIO pins follow the international standard for SIM cards (such as ISO / IEC 7816), and it includes at least: VCC pin (for providing power), GND pin (ground), RST pin (for reset operation), CLK pin (for providing clock signal), and I / O pin (for bidirectional data transmission).

[0031] Combination Figure 4 As shown, in actual design, for the sake of functional integrity, the Card Detect (CD) signal is usually also included in the multiplexing range; the first selection terminal (Channel A) of the GPIO multiplexing module 310 is connected to the SIM card controller hardware logic block (IP core) inside the baseband processor through internal wiring; its second selection terminal (Channel B) is connected to the eSIM controller hardware logic block inside the baseband processor; the GPIO multiplexing module 310 can be integrated inside the baseband processor chip as part of its digital or analog IO unit. This integration method helps to reduce the number of external components and reduce costs.

[0032] Alternatively, the GPIO multiplexing module 310 can also be a separate multi-channel analog switch chip (such as TI's TS3A5017 or a similar model) arranged on the motherboard. This approach provides greater design flexibility and is especially suitable for scenarios where the baseband processor itself does not support internal multiplexing.

[0033] Specifically, the non-volatile storage module 320 is used for persistent storage of user mode selection; the key is that the stored information will not be lost after the device is powered off; a typical implementation is to use a non-volatile storage area (usually called Baseband NV) built into the baseband processor. This non-volatile storage area is reserved by the baseband processor manufacturer for storing various calibration parameters and configuration information of the modem.

[0034] The present invention cleverly utilizes a specific item (e.g., defining a specific NV Item ID, such as NV_ID_SIM_ESIM_SWITCH_I) to store a switching flag bit, which can be stored using one byte, for example, using a value of 0 to represent SIM card mode (first state value) and a value of 1 to represent eSIM mode (second state value).

[0035] Besides baseband NV, other implementation methods are also feasible. For example, the flag can be stored in a specific attribute file of the application processor file system (such as a file under the / persist partition of the Android system), or stored as a variable in the UEFI / EFI firmware. As for which storage location to choose, factors such as the overall architecture of the device platform, the software stack, and access permissions need to be considered.

[0036] Specifically, the control module 330 is the "brain" that executes the switching logic. In most mobile devices, the most suitable implementation carrier is the modem firmware running on the baseband processor, which is the core component that directly manages all SIM card-related operations. After the device is powered on, the baseband processor is powered on and, after performing basic hardware self-test (Booting), it will enter the modem subsystem initialization stage.

[0037] In the early stages of this initialization phase, the Modem firmware first executes a specific initialization routine containing the new logic of this invention: it reads a pre-stored switching flag from the non-volatile memory module 320 (e.g., baseband NV). Based on the read value (0 or 1), the Modem firmware controls the electronic switch inside the GPIO multiplexing module 310 by configuring the control register of the GPIO multiplexing module 310 (e.g., outputting a high or low level to a specific GPIO pin as a selection signal SEL, or configuring the register of the MUX chip via a serial bus such as I2C / SPI). This switches the physical connection of the common terminal of the GPIO multiplexing module 310 to channel A (SIM card controller) or channel B (eSIM controller). After the hardware path switching is completed, the Modem firmware on the baseband processor continues to execute the standard SIM card or eSIM initialization process (such as power activation, sending a reset signal, and negotiating the communication protocol).

[0038] Another possible implementation of the control module 330 is that it can be used as a low-level kernel driver running on the application processor, but this approach requires a more complex cross-processor communication mechanism between the application processor and the baseband processor.

[0039] (Example 2) Combining Figure 1 and Figure 2 The present invention will be further elaborated step by step on the SIM card and eSIM switching method based on GPIO multiplexing mechanism: Step S101 (User Interaction and Trigger): The user interacts through the user interface (UI) of the electronic device (such as a smartphone); for example, the user enters the "Settings" -> "Mobile Network" -> "SIM Card Management" UI interface, in which a clear option is provided for the user to choose between "Use SIM2 card slot" and "Use eSIM". This UI interface is supported by the Telephony service (or similar service) in the operating system. Step S102 (Configuration Persistence): After the user makes a selection and confirms, the upper-layer Telephony service initiates a configuration request to the lower layer (usually the baseband processor) through the Radio Interface Layer (RIL) or a similar Hardware Abstraction Layer (HAL) interface. This configuration request contains the user's selection information, such as an enumeration value. After receiving the request, the lower-layer service (such as the RIL daemon provided by the Modem firmware) converts the enumeration value into a pre-agreed value (such as 0 or 1), and then writes this value to the specified location of the non-volatile storage module 320 (such as the aforementioned NV_ID_SIM_ESIM_SWITCH_I item) through the dedicated NV write operation interface provided by the baseband processor. This step ensures that the user's selection is still retained after the device is completely powered off. Step S103 (Reboot Prompt - Optional but Recommended): Since the hardware connection switch needs to be completed during the system initialization phase, a device reboot is usually required to take effect in order to ensure system stability and software consistency. Therefore, after successfully writing the baseband NV, the system can prompt the user through a pop-up window or notification bar message: "SIM card mode has been changed and a phone reboot is required for it to take effect. Reboot now?" This can provide a better user experience. Step S201 (Device Reboot and Initialization Entry): When the user performs a reboot operation (whether it is an immediate reboot or a manual reboot later), the device begins the boot process; after the baseband processor completes its most basic boot code (Bootloader), it transfers control to the Modem firmware; Step S202 (Read persistent configuration): The modem firmware executes a sub-process as early as possible in its initialization sequence, namely, reading the switching flag bit stored in the baseband NV; this operation is usually performed before the modem firmware initializes its hardware abstraction layer (HAL) to ensure that the subsequent hardware configuration is based on the correct user intent. Step S203 (Judgment and Decision): The Modem firmware parses the read flag value, which is a simple condition judgment step; Step S204a (Configure to SIM Card Mode): If the flag value is 0 (representing SIM card mode), the Modem firmware performs the following operations: 1) By configuring the control signals of the GPIO MUX, the shared GPIO pin group can be switched to the path connected to the SIM2 controller; 2) Then, initialize the SIM2 controller hardware; 3) Send an activation signal to the SIM2 card slot and check if a physical SIM card is inserted in the slot; 4) If the card is detected, proceed with the normal SIM card authentication and network registration process; Step S204b (Configure for eSIM mode): If the flag value is 1 (representing eSIM mode), the Modem firmware performs the following operations: 1) By configuring the control signals of the GPIO MUX, the shared GPIO pin group can be switched to the path connected to the eSIM controller; 2) Then, initialize the eSIM controller hardware; 3) Establish communication with the eSIM chip and read the operator profile information stored inside it; 4) Select and activate a profile to register online; Step S205 (Function Activation and Use): Once the selected controller is successfully initialized, the corresponding SIM function (SIM2 or eSIM) is fully ready, and the user can make calls, send text messages, and use mobile data. At this time, the controllers corresponding to the unselected functions are disconnected from the GPIO pins at the hardware level, and their software drivers can be placed in an inactive state (such as low power or off state) to save power.

[0040] (Example 3) Reference Figure 5 The electronic device 500 in this embodiment is a smartphone, including an application processor 510, a baseband processor 520, a memory 530, a radio frequency module 540, an antenna 550, a SIM card slot 560, an eSIM chip 570, and the SIM card and eSIM switching device of the present invention. The core components of the switching device, the GPIO multiplexing module 580 and the switching control logic, can be integrated inside the baseband processor 520. After the device 500 is powered on, it can automatically complete the function switching according to the above method embodiment, providing users with flexible second card communication services.

[0041] (Example 4) The core idea of ​​this invention is not limited to the switching between SIM2 and eSIM. Its paradigm of "hardware reuse + non-volatile memory + boot-time configuration" can be extended to any of the following application scenarios: 1. Signal expansion: In addition to the core VCC, RST, CLK, and I / O signals, more auxiliary signals related to specific functional modules can be included in the multiplexing set to save more resources.

[0042] 2. Diverse triggering mechanisms: The switching trigger is not limited to manual selection by the user. It can be combined with sensor events (such as Hall sensor detecting the closure of the flip cover), geographical location information, time strategy, or insertion detection events as described in the manual (triggered by interrupt through the CD pin of the card slot) to automatically modify the baseband NV flag and prompt for a restart.

[0043] 3. Multiple-to-one extension: The idea of ​​this invention can be naturally extended to the "one-to-N" scenario; for example, using a single-pole multiple-throw (SPnT) MUX, the same set of GPIO pins can be switched between multiple targets such as SIM2, eSIM 1 plan, and eSIM 2 plan; at this time, the baseband NV flag bit needs to be able to store multiple states (for example, using two bytes to represent four states: 0, 1, 2, and 3), and the control logic also needs to be extended accordingly.

[0044] 4. Application Scope: The switching principle of this invention is also applicable to other scenarios that require mutually exclusive use of hardware resources; for example, in compact IoT devices, a set of GPIO pins can be reused to switch between different types of sensors (such as temperature sensors and humidity sensors); or in communication devices, antenna interfaces can be reused to switch between different RF front-end modules.

[0045] In summary, this invention provides an efficient, reliable, and low-cost dynamic allocation scheme for hardware resources through ingenious hardware and software co-design.

[0046] It should be understood that the above description is only a preferred embodiment of the present invention and is not sufficient to limit the technical solution of the present invention. For those skilled in the art, within the spirit and principles of the present invention, additions, subtractions, substitutions, transformations or improvements can be made based on the above description, and all such additions, subtractions, substitutions or improvements should fall within the protection scope of the appended claims of the present invention.

Claims

1. A SIM card and eSIM switching device based on GPIO multiplexing mechanism, characterized in that, The device includes: A GPIO multiplexing module has a common terminal, at least one first selection terminal and at least one second selection terminal. The common terminal is used to connect to a set of multiplexed GPIO pins, the first selection terminal is used to connect to a SIM card controller, and the second selection terminal is used to connect to an eSIM controller. A non-volatile storage module is used to store at least one switching flag bit, the switching flag bit being configured to have at least one first state value and one second state value, the first state value corresponding to an indication of enabling a first operating mode of the SIM card controller, and the second state value corresponding to an indication of enabling a second operating mode of the eSIM controller. A control module, communicatively connected to the non-volatile memory module and the GPIO multiplexing module, is configured to perform the following operations during the device power-on initialization process: read the current state value of the switching flag bit from the non-volatile memory module; generate and send a first control signal to the GPIO multiplexing module in response to the read current state value being the first state value, thereby driving the GPIO multiplexing module to establish an electrical connection between the common terminal and the first selected terminal; and generate and send a second control signal to the GPIO multiplexing module in response to the read current state value being the second state value, thereby driving the GPIO multiplexing module to establish an electrical connection between the common terminal and the second selected terminal.

2. The SIM card and eSIM switching device based on GPIO multiplexing mechanism according to claim 1, characterized in that: The GPIO multiplexing module is a multiplexer or an analog switch chip; the multiplexer is integrated inside the baseband processor or application processor; or, the analog switch chip is a discrete component independent of the main processor and is soldered onto the device motherboard.

3. The SIM card and eSIM switching device based on GPIO multiplexing mechanism according to claim 1, characterized in that: The physical carrier of the non-volatile storage module is selected from one of the following: a non-volatile storage area inside the baseband processor, a specific configuration file in the application processor file system, a specific variable stored in the device's unified extensible firmware interface partition, or an independent serial electrically erasable programmable read-only memory chip.

4. The SIM card and eSIM switching device based on GPIO multiplexing mechanism according to claim 1, characterized in that: The control module can be implemented in one of the following ways: modem firmware running on the baseband processor, operating system kernel driver running on the application processor, or microcode running on a coprocessor dedicated to power management and interface control.

5. The SIM card and eSIM switching device based on GPIO multiplexing mechanism according to claim 1, characterized in that: A set of multiplexed GPIO pins includes at least a power pin, a reset pin, a clock pin, and input / output data pins corresponding to the SIM card communication protocol.

6. The SIM card and eSIM switching device based on GPIO multiplexing mechanism according to claim 5, characterized in that: A set of multiplexed GPIO pins also includes signal pins for card-in-position detection; optionally, it also includes pins for programming voltage.

7. The SIM card and eSIM switching device based on GPIO multiplexing mechanism according to claim 1, characterized in that: The control module is further configured to: after establishing an electrical connection between the common terminal and the first selection terminal or the second selection terminal, initialize the corresponding SIM card controller or the eSIM controller, and execute a detection and activation process for the external hardware unit connected to the controller.

8. An electronic device, comprising a device housing, a motherboard disposed within the device housing, a baseband processor disposed on the motherboard, a radio frequency module communicatively connected to the baseband processor, a power management module providing power to the electronic device, and a user identification module interface component; characterized in that, The user identification module interface component includes a SIM card and eSIM switching device based on a GPIO multiplexing mechanism as described in any one of claims 1 to 7; wherein the user identification module interface component is configured to enable the electronic device to selectively enable the physical SIM card function or the embedded SIM card function at any time through hardware switching, without having to set completely independent GPIO pin resources for the physical SIM card function and the embedded SIM card function respectively.

9. A method for switching between SIM cards and eSIM based on a GPIO multiplexing mechanism, applied in an electronic device comprising a set of multiplexed GPIO pins, a GPIO multiplexing controller, a SIM card controller, and an eSIM controller; characterized in that, The method includes: Configuration information receiving and storage steps: In response to the received user configuration instruction, which includes selection information for a first working mode or a second working mode, wherein the first working mode corresponds to enabling the physical SIM card function and the second working mode corresponds to enabling the embedded SIM card function, the selection information is converted into a corresponding status value and written to a preset storage location in the non-volatile memory to update the switching flag bit; Initialization triggering step: When the electronic device undergoes the startup process, the hardware interface initialization process is triggered; Switching flag reading and judgment steps: In the early stage of the hardware interface initialization process, access the non-volatile memory and read the current value of the switching flag; Hardware connection dynamic configuration steps: Based on the current value of the switching flag obtained in the switching flag reading and judgment step, send a corresponding configuration command to the GPIO multiplexing controller to control the electrical connection path of the set of multiplexed GPIO pins to switch between the SIM card controller and the eSIM controller; Functional module initialization and activation steps: After completing the hardware connection dynamic configuration steps, the target controller connected via the GPIO multiplexing controller is initialized, and the communication function associated with the target controller is started.

10. The SIM card and eSIM switching method based on GPIO multiplexing mechanism according to claim 9, characterized in that, Following the configuration information receiving and storage step, a user prompting step is also included: generating and presenting a prompt message to the user, which indicates that the electronic device needs to be restarted for the working mode switch to take effect.

11. The SIM card and eSIM switching method based on GPIO multiplexing mechanism according to claim 9, characterized in that: The initialization triggering step is caused by one of the following events: a cold start of the electronic device, a warm restart of the electronic device, or a specific reset operation for the baseband processor.

12. The SIM card and eSIM switching method based on GPIO multiplexing mechanism according to claim 9, characterized in that: The hardware connection dynamic configuration step is performed before the operating system kernel is fully loaded.

13. The SIM card and eSIM switching method based on GPIO multiplexing mechanism according to claim 9, characterized in that, The method also includes an automatic selection mode, which includes: detecting the physical state of the physical SIM card slot; in response to detecting that a physical SIM card is inserted into the slot, automatically generating a user configuration instruction to select the first working mode, and performing the configuration information receiving and storage steps.

14. The SIM card and eSIM switching method based on GPIO multiplexing mechanism according to claim 9, characterized in that, In the automatic selection mode, after the selection instruction is automatically generated, the method further includes: outputting a confirmation prompt to the user, and after obtaining user confirmation, performing the operation of writing the updated switching flag bit into the non-volatile memory.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the SIM card and eSIM switching method based on the GPIO multiplexing mechanism as described in any one of claims 9 to 14.