You copied the Doc URL to your clipboard.

How can I modify the Cortex-M0+ Integration Kit MCU example to relocate the MTB into an executable address range?

Article ID: 103489530

Published date: 28 Feb 2018

Last updated: -

Applies to: MTB-M0+


How can I modify the Cortex-M0+ Integration Kit MCU example to relocate the MTB into an executable address range?


This knowledge article is specifically intended for chip designers who have licensed the Cortex-M0+ processor for inclusion in their chip design.

Chip design companies who license of the Cortex-M0+ processor IP receive the processor design files with an example Micro-controller Unit (MCU) design containing an instance of the Cortex-M0+ processor, and a set of test programs which can be run on that MCU design, for example, in a logic simulation. The example MCU design and set of test programs and support files is collectively called the Integration Kit (IK).

The IK MCU includes an optional instance of the CoreSight Micro Trace Buffer (MTB), MTB-Cortex-M0+, which provides a program flow trace capability when included in a design. The MTB is a separately licensed component. The MTB serves as a standard AHB-Lite bus to SRAM interface, but additionally includes the ability to reserve a programmable region of that SRAM as a circular buffer for trace data, and to automatically collect program flow trace into that buffer.

The MTB occupies two separate address ranges on the bus. Its control registers occupy a 4KB aligned block of addresses at one arbitrary address range, while the SRAM itself occupies a separate arbitrary address range corresponding to the size of the SRAM. In the IK MCU, the MTB is located at a hard-coded address range of 8KB, with the control registers 4KB block based at address 0xF000_2000 and with 4KB of SRAM in the consecutive address range based at 0xF000_3000.

The MTB SRAM can generally be used for any purpose, including for data and for executable code, but the address range chosen in the IK MCU is in a segment of the Cortex-M0+ memory map which is always non-executable.


The following steps are correct for the "r0p1-00rel0" release of Cortex-M0+ and MTB:

To configure the IK MCU with the MTB included, you must have completed the following steps:

  1. Download and install the Cortex-M0+ bundle, AT590-BU-50000-r0p1-00rel0.

  2. Download the MTB bundle TM932-BU-50000-r0p1-00rel0 and merge it into the Cortex-M0+ installation.

  3. In the integration_kit subdirectory, modify the following settings:
    "ARM_CM0PIK_MTB 1" in logical/tbench/verilog/cm0p_ik_defs.v
    "EXPECTED_MTB 1" in validation/tests/IKConfig.h

Because the IK MCU is designed with the two MTB address ranges in a contiguous block, it is easier to move the entire MTB than to split the address ranges and move only the SRAM address range. The base addresses of the two MTB regions are coded in a number of different locations within the IK, all of which need to be updated to successfully relocate the MTB. For example, to relocate the MTB to start at address 0x3000_2000 (which is by default an executable address range), the following changes are required:

  • In logical/cm0p_ik_mcu/verilog/cm0p_ik_sys.v
    "BASEADDR_MTB 32'h30002000"
    "BASEADDR_MTBSRAM 32'h30003000"

  • In validation/tests/IKConfig.h
    "EXPECTED_MTB_BASEADDR 0x30002000"

  • In validation/tests/Device/ARM/cm0pikmcu/Include/cm0pikmcu.h
    "MTBSFR_BASE 0x30002000UL"
    "MTBSRAM_BASE 0x30003000UL"

  • In validation/tests/debugdriver.c
    "MCU_MTB 0x30002000"

After these modifications are complete, it should be possible to successfully run the test programs "config_check.c" and "mtb.c" by use of the standard RunIK script as described in the Cortex-M0+ Integration and Implementation Manual (IIM), to verify the correct operation of the MTB in the relocated address range.





Related Information