Method for selecting a starting program

By selecting the bootloader based on the combination of the microcontroller's register and boot pin status, the problem that the microcontroller architecture cannot select between multiple security levels is solved, flexible security mode switching and application portability are achieved, and the full utilization of system memory is ensured.

CN120611380APending Publication Date: 2025-09-09STMICROELECTRONICS INT NV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510257549.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2025-02-24
Filing Date
2025-03-05
Publication Date
2025-09-09

AI Technical Summary

Technical Problem

Existing microcontroller architectures cannot choose between multiple security levels, resulting in resource and memory isolation, which limits application development and system flexibility.

Method used

The bootloader is selected by combining the states of multiple registers and boot pins of the microcontroller, thereby selecting the bootloader from multiple memories, establishing a single security mode, allowing the register states and boot pin signals to be read during reset to constitute the selection conditions, and configuring the security mode of the microprocessor.

Benefits of technology

It enables flexible switching between multiple security levels, supports application development that does not require a high security level, ensures full utilization of system memory and application portability, eliminates system implementation of resource partitioning, and provides protection at a single security level.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120611380A_ABST
    Figure CN120611380A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a method for selecting a starting program. A method of selecting a boot program for a microprocessor of a microcontroller is provided. The method includes selecting a bootstrap from a plurality of bootstrap programs, the plurality of bootstrap programs being contained in one or more memories of the microcontroller, where a plurality of registers of the microcontroller are first read during a reset of the microprocessor, and the reading and a state of at least one signal present on a boot pin of the microcontroller constitute a condition for selecting the boot program.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims the benefit of priority from French patent application No. FR2402333, filed on March 8, 2024, entitled “Procédé de sélection deprogrammes de démarrage”, which is hereby incorporated herein by reference to the fullest extent permitted by law. Technical Field

[0003] The present disclosure generally relates to methods for selecting a boot program in a microprocessor of a microcontroller and a microcontroller implementing such methods. Background Art

[0004] Many electronic circuits, such as microcontrollers, including systems on a chip (SOCs), include an architecture that enables the selection of a security level for resources and memory used by applications implemented in these circuits.

[0005] However, some architectures make it virtually impossible to choose between multiple security levels. Summary of the Invention

[0006] It would be desirable to provide methods that enable the selection of multiple security levels to be implemented in a circuit having an architecture that does not substantially allow selection between the multiple security levels.

[0007] One embodiment overcomes all or some of the disadvantages of known methods.

[0008] One embodiment provides a method of selecting a boot program for a microprocessor of a microcontroller from a plurality of boot programs contained in one or more memories of the microcontroller, wherein a plurality of registers of the microcontroller are first read during a reset of the microprocessor, and the reading, together with the state of at least one signal present on a boot pin of the microcontroller, constitutes a condition for selecting the boot program.

[0009] According to one embodiment, the first boot program of the system memory of the microcontroller is configured to: when the first boot program of the system memory of the microcontroller is selected, configure the microprocessor so that the microprocessor is in the single security mode.

[0010] According to one embodiment, the single security mode is a first security mode in which an error is returned when a non-secure transaction requests access to a secure resource of the microprocessor.

[0011] According to one embodiment, in the first security mode, when a secure transaction requires access to a non-secure resource of the microprocessor, an error may be returned.

[0012] According to one embodiment, the first boot program is configured to modify a value of a security register so that at least the first boot program is inaccessible, the value of the security register representing a size of an access-forbidden area of ​​a system memory containing the first boot program.

[0013] According to one embodiment, the value of the security register can only be incremented.

[0014] According to one embodiment, the modification of the value of the security register comprises an increase of more than one bit.

[0015] According to one embodiment, after selecting the first boot program, at least one application may be executed from a user memory of the microcontroller, which is different from the system memory and is configured with a first security mode.

[0016] According to one embodiment, the system memory is a read-only memory or a memory configured to operate as a read-only memory.

[0017] According to one embodiment, when the system is initialized, if:

[0018] - a first option register has a first value;

[0019] - the second option register has the second value or the third value; and

[0020] - guiding the signal present on the pin to be in a first state;

[0021] Then the first boot program is selected from the system memory.

[0022] According to one embodiment, when the system is initialized, if:

[0023] - a first option register has a first value;

[0024] - the second option register has a second value; and

[0025] - directing the signal present on the pin to be in a second state;

[0026] Then the second boot program is selected from the system memory.

[0027] According to one embodiment, when the system is initialized, if:

[0028] - a first option register has a first value;

[0029] - the second option register has a value from the fourth value, the fifth value, and the sixth value; and

[0030] - guiding the signal present on the pin to be in the first state or the second state;

[0031] The first boot program is then selected from the user memory.

[0032] According to one embodiment, when the system is initialized, if:

[0033] - the first option register has a seventh value;

[0034] - the second option register has a second value; and

[0035] - guiding the signal present on the pin to be in a first state;

[0036] A third boot program is then selected from the user memory, which is different from the system memory.

[0037] According to one embodiment, when the system is initialized, if:

[0038] - the first option register has a seventh value;

[0039] - the second option register has the second value or the third value; and

[0040] - directing the signal present on the pin to be in a second state;

[0041] A boot program is then selected from the system memory, the boot program being different from the first program.

[0042] One embodiment provides a microcontroller comprising a microprocessor, system memory, and user memory, and configured to implement a method such as that described above. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The above features and advantages and other features and advantages are described in detail in the remainder of the disclosure of specific embodiments given by way of illustration and not limitation, with reference to the accompanying drawings, in which:

[0044] Figure 1 An example of an integrated circuit of the type to which the described embodiments are applicable is shown very schematically and in block form;

[0045] Figure 2 Illustration of the selection for Figure 1 An implementation mode of the method of the boot procedure of the circuit; and

[0046] Figure 3 Illustration of the selection for Figure 1Another embodiment of the method of the bootstrap program of the circuit. DETAILED DESCRIPTION

[0047] In the various drawings, the same features have been designated by the same reference numerals. In particular, structural and / or functional features common to the various embodiments may have the same reference numerals and may have the same structural, dimensional, and material properties.

[0048] For clarity, only the steps and elements that are useful for understanding the described embodiments are shown and described in detail.

[0049] Unless otherwise indicated, when two elements are referred to as being connected together, this means a direct connection without any intermediate elements other than conductors, and when two elements are referred to as being coupled together, this means the two elements may be connected or they may be coupled via one or more other elements.

[0050] In the following description, whenever absolute position qualifiers (such as "front", "back", "top", "bottom", "left", "right", etc.) or relative position qualifiers (such as "top", "bottom", "upper", "lower", etc.) or orientation qualifiers (such as "horizontal", "vertical", etc.) are mentioned, unless otherwise specified, they are with reference to the orientation of the accompanying drawings.

[0051] Unless otherwise indicated, the expressions “about”, “approximately”, “substantially” and “approximately” mean plus or minus 10% or plus or minus 10°, preferably plus or minus 5% or plus or minus 5°.

[0052] Figure 1 An example of an electronic circuit 100 of the type to which the described embodiments apply is shown very schematically and in block form.

[0053] The circuit 100 includes a non-volatile memory 104 (FLASH MEMORY), for example, a non-volatile memory of the flash memory type, which can communicate with a non-volatile memory interface 106 (FLASH INTERFACE) via a communication bus 114. The non-volatile memory interface 106 is configured to write data to the non-volatile memory 104 or read data from the non-volatile memory 104. In one example, a system program and / or an application (such as a boot program) is implemented in the memory 104.

[0054] Circuit 100 also includes, for example, a processing unit 110 (CPU), which includes one or more processors controlled by instructions stored in a system instruction memory 112 (INSTR MEM). Instruction memory 112 is, for example, a volatile random access memory (RAM). Processing unit 110 and memory 112 communicate, for example, via a system (data, address, and control) bus 140. Flash memory 104 is coupled to system bus 140 via a non-volatile memory interface 106 and via bus 114. Device 100 also includes an input / output interface 108 (I / O interface) coupled to system bus 140 for external communication.

[0055] The circuit 100 also comprises another memory 120 (USERMEM), for example of non-volatile or RAM type. This memory 120 is coupled to the system bus 140 directly or via a memory interface (not shown) having a role similar to that of the interface 106, for example.

[0056] Device 100 may integrate other circuits that implement other functions (e.g., one or more volatile and / or non-volatile memories, other processing units), which are implemented by Figure 1 Among these other circuits, circuit 100 includes, for example, a read-only memory or static memory 118 (ROM).

[0057] During the factory programming process, one or more boot programs for the circuit are transferred directly to the memory 104, for example. Once transferred to the flash memory 104, the boot program(s) cannot be modified unless the circuit 100 is reset. To this end, a boot program is provided that locks access to the flash memory area containing the boot program, making it impossible to access the flash memory area without a reboot. This is achieved, for example, by implementing a (for example, monotonically increasing) register (HDPL), the value of which represents the size of a prohibited access area of ​​the memory containing the boot program(s), making the boot program(s) inaccessible. For example, when the value of the register HDPL is 1, the boot program located in the memory area associated with the value 1 can be executed. After execution, the value HDPL is incremented to 2, which prohibits access to the boot program located in the memory area associated with the value 2. If a second boot program has been loaded into the memory in the sector between HDPL1 and HDPL2, it can be executed; after execution, the value HDPL is incremented to 3, which prohibits access to both boot programs located in the memory areas associated with the values ​​1 and 2. The application is then implemented in the memory, for example, without the same access restriction level.

[0058] In some architectures (such as v8.0-M or In an architecture of the M33 type, circuit resources or memory and certain programs can be partitioned using different security levels by selecting options during development, for example by changing the value of a user option byte. This mechanism is referred to in these examples as a "Trustzone". A first security level (secure) is implemented, for example, by establishing that when a non-secure transaction requests access to a secure resource of the microprocessor, an error is returned, for example, via bus 140; and when a secure transaction requests access to a non-secure resource of the microprocessor, an error is also returned. The rest of the circuit and / or the rest of the program is then implemented, for example, using less stringent security principles, where, for example, programs with a security level lower than the first level can only access non-secure resources and memory of the circuit 100.

[0059] In some architectures (such as In architectures of the M85 or ARMV8.1-M type, there is no option to choose whether to partition circuit resources, memory, and programs with different security levels. In these architectures, only a high security level is available. In other words, in these architectures, the "trust zone" mechanism cannot be disabled. Therefore, there is basically isolation (for example, called TZI isolation) between resources, memory, or programs with a first security level and a less secure mode. This may cause problems, making it easy to develop applications that do not need to implement security isolation (such as, for example, the "trust zone" mechanism) or applications that do not require security protection at all.

[0060] The described embodiments provide for implementing a method of selecting a boot program for a microprocessor of a microcontroller from a plurality of boot programs contained in one or more memories of the microcontroller, wherein a plurality of registers of the microcontroller are first read during a reset of the microprocessor, and the reading, together with the state of at least one signal present on a boot pin of the microcontroller, constitutes a condition for selecting the boot program.

[0061] This makes it possible, for example, to eliminate the need for implementing a system for partitioning resources, memory or programs between multiple security levels. Thus, a single security level can be achieved or the same security level can be generated for all resources, memory and programs used.

[0062] This also enables a software solution to be obtained that facilitates the development of applications that do not require a high level of security. This mode is for example called "legacy".

[0063] This also enables the manufacturer to integrate the boot program as native code directly into the system memory containing all manufacturer programs, which enables the system implementation of the resource partition system to be eliminated. The resulting advantage is that the user memory, which is different from the system memory, can thus be completely freed up.

[0064] Furthermore, this ensures portability of programs previously developed on architectures that still enable the partitioning of resources, memory or programs between multiple security levels to be activated by changing a user option byte.

[0065] Figure 2 Illustration of the selection for Figure 1More specifically, the example shown illustrates a method for selecting a boot program for a microcontroller 100 (in other words, for a microprocessor). These boot programs are present in a user memory (e.g., memory 120) or in a so-called system memory (such as memory 104 or 112).

[0066] At step 202 (start reset), the microprocessor 110 is reset, for example, by interrupting power or by executing a specific command.

[0067] At subsequent step 204 (check TZEN, PRODUCT_STATE registers and BOOT_PIN values), the state of a plurality of registers TZEN, PRODUCT_STATE of the microcontroller 100 and at least one signal present on the boot pin (BOOT_PIN) of the microcontroller 100 is first read. The value of register TZEN or PRODUCT_STATE is called a user option byte.

[0068] Register TZEN is identical to the one present on older architectures (e.g. v8.0-M or In older architectures, these registers correspond to registers in M33-type architectures. In these older architectures, they enabled the selection of whether to implement partitioning of the microprocessor's resources, for example, if TZEN = 1, partitioning was implemented, or conversely, if TZEN = 0, no partitioning was implemented. In newer architectures, such registers are no longer considered, and partitioning is essentially implemented. Here, even if the register itself is not enabled to disable basic partitioning of the microprocessor 110, the value of this register is read.

[0069] The value of the register PRODUCT_STATE corresponds to the state in the life cycle of the microcontroller 100. The register PRODUCT_STATE can include multiple values. During manufacturing, the state is entered as "OPEN", then "PROVISIONING", then "PROVISIONED", then "TZ-CLOSED", then "CLOSED" or "LOCKED". These different states of the register PRODUCT_STATE can be used to enable different subcontractors to intervene during the manufacturing of the microcontroller 100.

[0070] The "OPEN" state corresponds to the factory default state of the microcontroller. It allows the bootloader to be configured, establishing protection using a security register (HDPL) with a value indicating the size of a prohibited area of ​​system memory. In this state, debugging is open without restrictions.

[0071] The "PROVIONING" state corresponds to a state of the microcontroller in which debugging is only available to applications whose security register (HDPL) has a value greater than a given number, for example, 3. In this state, the data area containing the security key is encrypted.

[0072] The "PROVISIONED" state (also known as "iROT-PROVISIONED") corresponds to the state after the "PROVIONING" state. In this state, some programs and data used during boot are no longer accessible. Based on this state, a higher level can be updated.

[0073] The "TZ-CLOSED" state corresponds to a state in which a program that uses resources dedicated to the "secure" security mode of the "Trust Zone" architecture has been installed. In this state, applications dedicated to other "non-secure" security modes can be developed or loaded.

[0074] The "CLOSED" and "LOCKED" states correspond to the final stages of the product. In the "CLOSED" state, all debug access is closed and access is only possible with strong authentication. However, regression is possible with this strong authentication. In the "LOCKED" state, all debug access is closed, including with strong authentication.

[0075] The state of the signal(s) present on one or more boot pins BOOT_PIN of the microcontroller 100 corresponds to, for example, a high (1) state or a low (0) state. The user can choose to apply, for example, voltage VDD for a high state or ground for a low state to the pin.

[0076] After a reset, the reading from registers TZEN and PRODUCT_STATE and the reading of the status at the boot pin BOOT_PIN of microcontroller 100 are first performed.

[0077] At step 206 (selecting a boot program) following step 204 , the values ​​read from registers TZEN and PRODUCT_STATE and the value read from the state of the boot pin BOOT_PIN of the microcontroller 100 constitute conditions for selecting a boot program.

[0078] The selection operation includes implementing a boot program that is stored in one or more memory areas, each memory area being bounded by, for example, two or more memory addresses.

[0079] The selection can be performed from system memory, such as memory 104, 112 for more secure applications, but also from user memory, such as memory 120. In one example, system memory 104, 112 cannot be written to or read by a user who only has access to user memory 120.

[0080] Thus, a user, who is for example a subcontractor or a professional user who integrates the microcontroller into his product, can implement his application from the user memory 120 with the desired security level during the microcontroller customization phase.

[0081] Table 1 below corresponds, for example, to a database which is used as a reference for selecting a boot program (BOOT_SELEC) or equivalently a memory area corresponding to this program, and optionally a register called BOOT_UBE, depending on the values ​​read from registers TZEN and PRODUCT_STATE and the state on the boot pin BOOT_PIN.

[0082] [Table 1]

[0083]

[0084]

[0085] In Table 1, the value N / A means that the result of the selection does not depend on the value in the corresponding box containing N / A.

[0086] The programs ST-iNoIsolation, Bootloader, STiROT and RSS are stored, for example, in different system memory areas 104, 112. These programs are protected, for example, by the monotonically increasing value of the security register HDPL.

[0087] According to Table 1, the boot program may be selected from the user memory 120 (User mem), for example, when TZEN=1, PRODUCT_STATE=0, and BOOT_PIN=0.

[0088] According to Table 1, when the value of the option register TZEN is 0, when the value of the register PRODUCT_STATE is OPEN or PROVISIONING and the signal present on the boot pin BOOT_PIN is 0, the address area ST_iNoIsolation, or equivalently the boot program ST_iNoIsolation present in this address area, is selected from the system memory.

[0089] When the value of option register TZEN is 0 and the value of register PRODUCT_STATE is PROVISIONING, the bootloader ST_iNoIsolation is selected from the system memory regardless of the state of pin BOOT_PIN.

[0090] This applies regardless of the state of the signal present on the boot pin BOOT_PIN when the value of TZEN is 0 and the value of the second option register PRODUCT_STATE is the value PROVISIONED, CLOSED or LOCKED.

[0091] The boot program ST_iNoIsolation is configured to, when the boot program ST_iNoIsolation is selected, configure the microprocessor 110 so that the microprocessor 110 is in either a single secure security mode or a non-secure security mode, depending on the value of TZEN. By selecting the boot program ST_iNoIsolation stored in the system memory 104, 112, applications in the user memory 120 can be initialized using the same security mode. The boot program ST_iNoIsolation is also configured to initialize the entire memory (non-volatile memory and volatile memory) seen by the application in the same security mode (e.g., secure). In other words, the program ST-iNoIsolation emulates the selected security mode. Applications in the user memory 120, for example, implemented by a customer or subcontractor, will be implemented in the security mode selected using TZEN.

[0092] Optionally, the procedure ST_iNoIsolation is configured to change the value HDPL from HDPL1 to HDPL3 to prevent the functionality of the secure boot program(s) from being implemented in the system memory 104 , 112 once executed.

[0093] Optionally, the program ST_iNoIsolation is configured to allow debugging only for memory areas with a value of HDPL 3. Additionally, it can be configured to implement an authentication method for accessing debugging that is password-level rather than certificate-based.

[0094] Once the program ST_iNoIsolation has been selected, the microprocessor 110 executes the application in the user memory 120 using the security mode provided by the register TZEN.

[0095] Figure 3 Illustration of the selection for Figure 1 More particularly, the illustrated example depicts the user memory 120 and the system memories 104 and 112.

[0096] In the example shown, system memory 104, 112 is configured, for example, to emulate read-only memory (ROM).

[0097] In the example shown, system memory 104, 112 includes programs 316 (RSS), 314 (STiROT), which are, for example, boot programs that were previously loaded in succession and are protected, for example, by regions using incrementing HDPL values.

[0098] exist Figure 3 In the example, system memory 104, 112 further includes a program 312 (DebugAuthent), which is located between a memory address dedicated to program 314 (STiROT) and a memory address dedicated to program 310 (ST-iNoIsolation). Program 312 is called, for example, when authentication for debugging is provided. System memory 104, 112 further includes a program 306 (Bootloader), which is located after the program end memory address 310 (ST-iNoIsolation). In one example, the memory area in which the boot program ST-iNoIsolation is stored cannot be modified (unchangeable) once loaded.

[0099] During a reset of the microprocessor 110, the state of the registers TZEN and PRODUCT_STATE, as well as the state of the signal on the pin BOOT_PIN, is read. If these values ​​correspond to the program ST-iNoIsolation, or equivalently to a memory area corresponding to the program ST-iNoIsolation, using Table 1, the microprocessor will begin executing the program ST-iNoIsolation, which will configure the microprocessor, and possibly the entire microcontroller 100, so that it is in a single secure mode or non-secure mode, such as that defined by the value of the register TZEN. The microprocessor 110 will then execute the application 308 (Appli NoIsolation) from the user memory 120. As a result, the entire memory 120 is available to the user, such as a subcontractor.

[0100] The fact that the microprocessor 110 itself cannot natively provide an input for selecting the security mode is thus made transparent to the user, since the option is reintroduced using the register TZEN associated with the program ST-iNoIsolation.

[0101] Various embodiments and variations have been described. Those skilled in the art will appreciate that certain features of these various embodiments and variations may be combined, and that further variations will occur to those skilled in the art. In particular, the selection of a bootloader may be performed while also taking into account the value of the BOOT_UBE register, as shown in Table 1.

[0102] Finally, based on the functional indications given above, a person skilled in the art will be able to implement the described embodiments and variants in practice. In particular, with regard to the values ​​in Table 1, a person skilled in the art will be able to modify these values ​​as needed while maintaining as much transparency as possible regarding the use of register TZEN relative to previous uses.

Claims

1. A method for selecting a boot program for a microprocessor of a microcontroller from a plurality of boot programs, the plurality of boot programs being contained in one or more memories of a plurality of memories of the microcontroller, the method comprising: reading a plurality of registers of the microcontroller during a reset of the microprocessor; as well as The boot procedure is selected in response to reading one or more conditions and a state of at least one signal present on a boot pin of the microcontroller.

2. The method according to claim 1, wherein the first boot program of the system memory of the microcontroller is configured to: when the first boot program of the system memory of the microcontroller is selected, configure the microprocessor so that the microprocessor is in a single security mode.

3. The method of claim 2, wherein the single security mode is a first security mode in which an error is returned when a non-secure transaction requires access to a secure resource of the microprocessor.

4. The method according to claim 3, wherein: In the first security mode, when a secure transaction requires access to a non-secure resource of the microprocessor, an error is returned. 5 . The method according to claim 2 , wherein the first boot program is configured to modify a value of a security register so that at least the first boot program cannot access the system memory, the value of the security register indicating a size of an access-forbidden area of ​​the system memory containing the first boot program. The method of claim 5 , wherein the value of the security register can only be incremented. The method of claim 6 , wherein the modification of the value of the security register comprises an increase of greater than one bit. 8 . The method of claim 2 , wherein at least one application is executable from a user memory of the microcontroller after selecting the first boot loader, the user memory being different from the system memory and configured with a first security mode.

9. The method of claim 2, wherein the system memory is a read-only memory or a memory configured to operate as a read-only memory.

10. The method according to claim 2, further comprising: When initializing the system, the first boot program is selected from the system memory if the following conditions are met: The first option register has a first value; The second option register has the second value or the third value; and The signal present on the steering pin is in a first state.

11. The method according to claim 10, further comprising: When initializing the system, a second boot program is selected from the system memory if the following conditions are met: the first option register having the first value; The second option register has a second value; and The signal present on the steering pin is in a second state.

12. The method according to claim 10, further comprising: When initializing the system, the first boot program is selected from the system memory if the following conditions are met: the first option register having the first value; the second option register having a value from among a fourth value, a fifth value, and a sixth value; and The signal present on the boot pin is in the first state or the second state.

13. The method according to claim 10, further comprising: When initializing the system, a third boot program is selected from a user memory that is different from the system memory if the following conditions are met: the first option register having a seventh value; The second option register has a second value; and The signal present on the steering pin is in a first state.

14. The method according to claim 10, further comprising: When initializing the system, a boot program is selected from the system memory if the following conditions are met, the boot program being different from the first program: the first option register having a seventh value; the second option register has the second value or the third value; and The signal present on the steering pin is in a second state. 15 . A microcontroller comprising a microprocessor, a system memory and a user memory, and configured to implement the method according to claim 1 .

16. A method of selecting a boot program for a microprocessor of a microcontroller from a plurality of boot programs contained in one or more memories of the microcontroller, wherein: selecting a boot program after a first register and a second register of the microcontroller are first read during a reset of the microprocessor, and this reading together with the state of at least one signal present on a boot pin of the microcontroller constitutes a condition for said selection of the boot program; and The value of the first register defines whether the partitioning of the microprocessor is implemented, and the value of the second register defines the life cycle state of the microcontroller.

Citation Information

Patent Citations

  • Machine electrique de faible puissance

    FR2402333A1