CN / EN
文档反馈
感谢关注汇顶文档,期待您的宝贵建议!
感谢您的反馈,祝您愉快!
无匹配项 共计114个匹配页面

ROM Boot

ROM Boot is the initial bootloader of the chip. Its code is stored in ROM and cannot be changed by developers. Its main purpose is to boot the chip and determine how the code is executed, so that the chip can correctly jump to the application firmware.

As described in "Power Management", there are two branches in the ROM Boot, which are the cold boot and the warm boot. The cold boot requires more time and resources than the warm boot because the entire system needs to be re-established.

The figure below shows the ROM boot process.

图 39 ROM boot flowchart

The ROM Boot process are composed of six separate phases:

  • Boot Initialization
  • OTP Data Config
  • Boot Info Validation
  • APP Validation
  • Boot Deinitialization
  • Boot Jump

If an exception occurs in ROM Boot, the chip will enter the boot exception process, as described in "Boot Exception".

Boot Initialization

The boot initialization phase mainly initializes the chip to change the chip from limited known state to a more useful known state. This process includes clock initialization, eFuse data reading and configuration, default wake-up source and interrupt priority setting, Flash initialization and OTP initialization.

Because some system-related parameters are stored in eFuse, ROM Boot needs to read the parameters and apply them to the current chip. It includes SWD control, IO LDO trim value, BOD trim value and SRAM control. For the data storage format in eFuse, please refer to "eFuse".

ROM Boot will set a default priority for the interrupts of the chip as described in "Interrupt".

The firmware is usually stored in Flash so that the flash will be initialized in the ROM Boot. This ensures the normal interaction between the chip and the Flash. Because the Flash will be powered off during sleep mode to reduce power consumption, it will be re-initialized during warm boot.

There are two hook functions used for custom code in the ROM Boot. Because the hooks are not registered in the cold boot, they only take effect in warm boot. The two hook functions make customized clock management and register recovery operation possible during warm boot.

OTP Data Config

In the SoC, some trim parameters are stored in the OTP such as HFRC_192M trim value and Flash timing based on FT trim value as described in "Flash (Non-Volatile Memory)". These parameters will be read out and applied to the SoC during ROM Boot.

Boot Info Validation

Boot Info is a part of the System Configuration Area (SCA), located in the first two sectors of Flash (8 KB in total, 0x0020_0000–0x0020_2000). Boot Info stores the parameters used in the ROM Boot and other system configuration parameters. For detailed structure of the Boot Info, refer to GR533x Developer Guide.

During the Boot Info validation process, some parameters required for basic operation will be verified, such as load address, run address, and firmware size.

APP Validation

The APP verification phase is mainly to preprocess and verify the application firmware to ensure its integrity. The integrity check can be enabled or disabled by configuring the parameters in the Boot Info. Turning off the integrity check can save certain cold boot time. Additionally, if the application firmware is marked to execute on SRAM, the application firmware will be loaded into SRAM.

Boot Deinitialization

The Boot Deinitialization phase is mainly to deinitialize modules which are used in ROM Boot and to clean up the environment. During the boot deinitialization phase, the power of the eFuse is turned on. In order to reduce the power consumption, the eFuse will be deinitialized.

Boot Jump

There are three target jump modes in ROM Boot, which are XIP mode, Mirror mode and DFU mode.

  • In the XIP mode, the ROM Boot will eventually jump to flash address and the code is executed in place.
  • In the Mirror mode, the ROM Boot will eventually jump to SRAM address and the code is executed in SRAM.
  • In the DFU mode, the ROM Boot will eventually jump to the DFU service.

When the application firmware exists and no exception occurs, ROM Boot will usually jump to the XIP mode or the Mirror mode. Because the SWD interface will be lost during sleep mode, developers can hardly exit sleep mode through reset. Before ROM Boot jumps to the running address, there is a 1s delay to avoid the above situation. This delay can be turned on or off by controlling the parameters in Boot Info.

Boot Exception

Exceptions may occur during ROM Boot, causing the chip failing to jump to the application firmware. ROM Boot will record the current execution path to the SOFTWARE_REG1 register. When an exception occurs in ROM Boot, developers can read the SOFTWARE_REG1 register to analyze the cause of the exception. The recorded execution path is shown in the table below.

表 65 Execution path in ROM boot
SOFTWARE_REG1 Bit Path ID Description
0 BOOT_COLD_INIT Cold Boot in boot initialization
1 BOOT_WARM_INIT Warm Boot in boot initialization
2 BOOT_COLD_EFUSE_CFG Cold Boot in eFuse data read and config
3 BOOT_WARM_EFUSE_CFG Reserved in SoC
4 BOOT_COLD_OTP_CFG Cold Boot in OTP data config
5 SYS_WAKEUP_FLAG_POS Used for wakeup flag
6 BOOT_WARM_OTP_CFG Reserved in SoC
7 BOOT_INFO_WARM_CFG Reserved in SoC
8 BOOT_INFO_ENC_CFG Reserved in SoC
9 BOOT_INFO_PLAIN_CFG Cold Boot in Boot Info validation
10 BOOT_APP_ENC_CFG Reserved in SoC
11 BOOT_APP_PLAIN_CFG Cold Boot in APP validation
12 BOOT_APP_WARM_CFG Reserved in SoC
13 BOOT_APP_MIRROR_COPY Cold Boot in APP SRAM loaded
14 BOOT_APP_CHECK_SUM Cold Boot in APP check sum
15 BOOT_DEINIT Cold Boot in boot deinitialization
16 BOOT_DELAY Cold Boot in boot delay
17 BOOT_DFU_MODE_JUMP Jump to DFU mode
18 BOOT_MIRROR_MODE_JUMP Jump to Mirror mode
19 BOOT_XIP_MODE_JUMP Jump to XIP mode

ROM Boot will also record the current error code to specified SRAM address (0x20001C00). The error code is shown in the table below.

表 66 Error code in ROM boot
Value Error Code Description
32 BOOT_FLASH_INIT_ERROR Flash initialization failure
33 BOOT_FLASH_READ_ERROR Flash read failed
34 BOOT_OTP_READ_ERROR OTP read failed
35 BOOT_EFUSE_CTRL_DATA_ERROR Reserved in SoC
36 BOOT_EFUSE_CTRL_RESERVED_ERROR Reserved in SoC
37 BOOT_EFUSE_CTRL_CRC_ERROR Reserved in SoC
38 BOOT_INFO_MAC_ERROR Reserved in SoC
39 BOOT_INFO_RESERVED_ERROR Boot Info reserved error
40 BOOT_INFO_LOAD_ADDR_ERROR Boot Info load address error
41 BOOT_INFO_RUN_ADDR_ERROR Boot Info run address error
42 BOOT_INFO_BINSIZE_ERROR Boot Info bin size error
43 BOOT_APP_PROD_ID_ERROR Reserved in SoC
44 BOOT_APP_PLAIN_REVD_ERROR Reserved in SoC
45 BOOT_APP_PUBKEY_MAC_ERROR BOOT_APP_PUBKEY_MAC_ERROR
46 BOOT_APP_SIGNATURE_ERROR BOOT_APP_PUBKEY_MAC_ERROR
47 BOOT_APP_SUM_ERROR APP checksum error

When an exception occurs, Boot ROM will eventually jump into the DFU mode. For detailed information of the DFU mode, refer to GR5xx DFU Development Application Note.

扫描关注

打开微信,使用“扫一扫”即可关注。