ARM Cortex-M Boot and Remap Signal Functionality in System Design Kit
The relationship between BOOT and REMAP signals in ARM Cortex-M System Design Kits (CMSDK) is a critical aspect of system initialization and memory mapping. These signals are often misunderstood due to their nuanced behavior and the lack of explicit documentation in some design kits. This guide will provide a detailed breakdown of the functionality, possible causes of confusion, and troubleshooting steps to address issues related to these signals.
Boot and Remap Signal Behavior in CMSDK
In the ARM Cortex-M System Design Kit, the BOOT and REMAP signals play a pivotal role in determining the memory space from which the system boots and how memory regions are mapped during initialization. The BOOT signal, when present, allows the system designer to select the memory region from which the processor boots. This is typically achieved by remapping a small memory region starting at address 0x00000000 to a different memory space. The REMAP signal, on the other hand, controls whether the memory region at 0x00000000 is mapped to the boot ROM or the application ROM.
In the CMSDK, the default implementation includes only one application ROM area. However, there is an option to include a boot loader ROM. The boot loader code, if present, executes the same application image, making the BOOT configuration pin unnecessary in this context. The REMAP signal is used to control the mapping of the memory region at 0x00000000. When REMAP is set to 1, the memory region at 0x00000000 is mapped to the boot ROM. After the boot ROM program starts, the REMAP signal can be switched to 0 by software, which then maps the memory region at 0x00000000 to the user ROM or flash.
The confusion often arises when the REMAP signal is observed to be stuck at 1 and does not change during simulation. This behavior is normal in the default configuration of the CMSDK, where the boot ROM is not present, and the REMAP signal is ignored. However, if the boot ROM is enabled, the REMAP signal should transition from 1 to 0 after the boot ROM program starts.
Memory Mapping and Boot Configuration in CMSDK
The memory mapping and boot configuration in the CMSDK are controlled by several key signals and parameters. The remap_ctrl
signal is used to control the mapping of the memory region at 0x00000000. When remap_ctrl
is set to 1, the memory region at 0x00000000 is mapped to the boot ROM. After the boot ROM program starts, remap_ctrl
can be switched to 0, which maps the memory region at 0x00000000 to the user ROM or flash.
The boot_hsel
and flash_hsel
signals are used to select between the boot ROM and the user ROM or flash. The boot_hsel
signal is generated based on the address and the remap_ctrl
signal. If the address is in the range 0x00000000 to 0x0000FFFF and remap_ctrl
is 1, boot_hsel
is set to 1, selecting the boot ROM. Otherwise, boot_hsel
is set to 0, selecting the user ROM or flash.
The ARM_CMSDK_BOOT_MEM_TYPE
parameter in the cmsdk_mcu_defs.v
file determines whether the boot ROM is present. If ARM_CMSDK_BOOT_MEM_TYPE
is set to AHB_ROM_NONE
, the boot ROM is not present, and the remap_ctrl
signal is ignored. In this case, BOOT_LOADER_PRESENT
is set to 0, and the system boots directly from the user ROM or flash.
Troubleshooting Boot and Remap Signal Issues in CMSDK
When troubleshooting issues related to the BOOT and REMAP signals in the CMSDK, it is essential to understand the configuration of the system and the behavior of the signals. The following steps can be taken to diagnose and resolve issues:
-
Verify the Configuration of
ARM_CMSDK_BOOT_MEM_TYPE
: Ensure that theARM_CMSDK_BOOT_MEM_TYPE
parameter in thecmsdk_mcu_defs.v
file is set correctly. If the boot ROM is not required, setARM_CMSDK_BOOT_MEM_TYPE
toAHB_ROM_NONE
. This will disable the boot ROM and ignore theremap_ctrl
signal. -
Check the Generation of
boot_hsel
andflash_hsel
Signals: Examine the logic that generates theboot_hsel
andflash_hsel
signals. Ensure that these signals are generated correctly based on the address and theremap_ctrl
signal. If the boot ROM is not present,boot_hsel
should always be 0. -
Simulate the Boot Process: Run a simulation of the boot process to observe the behavior of the
remap_ctrl
signal. If the boot ROM is enabled, theremap_ctrl
signal should transition from 1 to 0 after the boot ROM program starts. If the boot ROM is not enabled, theremap_ctrl
signal should remain at 0. -
Review the Boot Loader Code: If a boot loader is present, review the boot loader code to ensure that it correctly switches the
remap_ctrl
signal from 1 to 0 after the boot ROM program starts. The boot loader should also correctly branch to the application code space. -
Examine the Address Decoder Logic: Ensure that the address decoder logic correctly maps the memory region at 0x00000000 to the boot ROM or the user ROM/flash based on the
remap_ctrl
signal. The address decoder should also handle the transition from the boot ROM to the user ROM/flash correctly. -
Check for Stuck Signals: If the
remap_ctrl
signal is observed to be stuck at 1, verify that the boot ROM is not enabled and that theARM_CMSDK_BOOT_MEM_TYPE
parameter is set toAHB_ROM_NONE
. If the boot ROM is enabled, ensure that the boot loader code correctly switches theremap_ctrl
signal to 0. -
Review the System Design: If the system design includes multiple application ROMs, ensure that the boot configuration pin is correctly implemented at the system level. The boot configuration pin should capture the status at reset and control the behavior of the address decoder to select the appropriate application program space.
By following these steps, you can diagnose and resolve issues related to the BOOT and REMAP signals in the ARM Cortex-M System Design Kit. Understanding the behavior of these signals and their interaction with the memory mapping and boot configuration is essential for ensuring a reliable system implementation.