MCUSW
Execute In Place (XIP) Application

Introduction


In situations where the internal RAM provided in device is not sufficient enough to store the applications, the application could reside in on-board memory and still be able to execute (XIP). With this mechanisim, the memory required to host an application is only limited by the on-board memory included.

This application demonstrates execute-in-place, where in CAN Profiling Application is executed from OSPI memory. i.e. The secondary boot loader, will not fetch the CAN Profiling Application from on-board Flash to RAM. Instead execute it from the on-board memory.

The section provides measured performance when operating in XIP versus executing application from internal RAM of the device

Table below list SoC/Cores on which this demo application is tested

SoC Host Core Comments
J721E MCU 1 0 MCAL could be hosted on other cores but this demo application runs only on MCU 1 0, at this point of time.
J7200 MCU 1 0 MCAL could be hosted on other cores but this demo application runs only on MCU 1 0, at this point of time.

Back To Top


Flow Chart

demo_can_profile_flowchart.png
CAN Profiling Application

Back To Top


Compile Time Configurations

  1. APP_NUM_MSG_PER_ITERATION Controls the number of messages that would be sent per iteration
  2. APP_NUM_ITERATION Number of iterations, total can messages sent would be APP_NUM_MSG_PER_ITERATION * APP_NUM_ITERATION
  3. APP_INSTANCE_1_INST_IN_CFG_ONLY Use first instance of CAN peripheral configured
  4. CAN_TX_ONLY_MODE Used to configure in CAN in tx only mode

Back To Top


Customizing Examples Application

The profiling application is configured to operate in loop-back mode by default. This application can be configured to operate in transmit-only, receive-only or loopback mode.

The below table lists the configuration changes required to change mode. Please ensure to recompile post modifications.

TX Only

For TX Only Flag Value Location
APP_INSTANCE_1_INST_IN_CFG_ONLY STD_ON mcusw\mcuss_demos\profiling\can\can_profile.h
CAN_LOOPBACK_ENABLE STD_OFF mcusw\mcuss_demos\mcal_config\Can_Demo_Cfg\output\generated\soc\j72xx\mcu1_0\include\Can_Cfg.h
CAN_TX_ONLY_MODE STD_ON mcusw\mcuss_demos\profiling\can\can_profile.h

This application would transmit CAN FD messages with extended ID (0xC0) at nominal-rate of 1 Mbps, data-rate at 5 Mbps

RX Only

For RX Only Flag Value Location
APP_INSTANCE_1_INST_IN_CFG_ONLY STD_ON mcusw\mcuss_demos\profiling\can\can_profile.h
CAN_LOOPBACK_ENABLE STD_OFF mcusw\mcuss_demos\mcal_config\Can_Demo_Cfg\output\generated\soc\j72xx\mcu1_0\include\Can_Cfg.h
CAN_TX_ONLY_MODE STD_OFF mcusw\mcuss_demos\profiling\can\can_profile.h

This application setup to receive CAN FD messages with extended ID (0xC0) at nominal-rate of 1 Mbps, data-rate at 5 Mbps

Loopback (default)

For Internal Loopback (default) Flag Value Location
APP_INSTANCE_1_INST_IN_CFG_ONLY STD_OFF mcusw\mcuss_demos\profiling\can\can_profile.h
CAN_LOOPBACK_ENABLE STD_ON mcusw\mcuss_demos\mcal_config\Can_Demo_Cfg\output\generated\soc\j72xx\mcu1_0\include\Can_Cfg.h
CAN_TX_ONLY_MODE X mcusw\mcuss_demos\profiling\can\can_profile.h

No additional connections / setup is required in this mode

Back To Top


Test Setup / Configurations used

Loopback mode

  1. Supported EVM / SoC
    Can_Profiling_CanLoopbackMode.png
    Loopback Setup

    TX Only mode

  1. CAN_HIGH of all the nodes on the bus shall be connected together. Similary CAN_LOW of all the nodes on the bus shall be connected together.
    Can_Profiling_CanTxOnlySetup.png
    DRA80X TxOnly Setup
    canbootapp_j721e_can_tx_setup_closeup.png
    J721E TxOnly Setup

Back To Top


Steps to build

We need to have the following binaries built from pdk:

  • sbl_ospi_img that loads SYSFW, initializes the OSPI flash in execute-in-place (XIP) mode

Building sbl_ospi_img

Go to (SDK Install Directory)/pdk_jacinto_07.x.x/packages/ti/build and run the following:

make sbl_ospi_img BOARD=j72xx_evm

Building can_profile_xip_app

Go to (SDK Install Directory)/mcusw/build and run the following:

make can_profile_xip_app BUILD_OS_TYPE=tirtos BOARD=j72xx_evm

Back To Top


Steps to flash

Install uniflash 6.3 from http://www.ti.com/tool/UNIFLASH

Note : Uniflash 6.3 does not support .appimage_xip file. Support for this would be added in Uniflash 6.4. Please follow the below steps after installing Uniflash.

  • cd (SDK Install Directory)/pdk_jacinto_07.x.x/packages/ti/board/utils/uniflash/host/
  • make all (Linux) or gmake all (Windows)
  • copy ProcessorSDKSerialFlash (Linux) or ProcessorSDKSerialFlash.exe (Windows) to (Uniflash Install Directory)/processors/
  • cd (SDK Install Directory)/pdk_jacinto_07.x.x/packages/ti/build/
  • make board_utils_uart_flash_programmer BOARD=j7xx_evm CORE=mcu1_0 -sj8
  • copy (SDK Install Directory)/pdk_jacinto_07.x.x/packages/ti/binary uart_j7xx_evm_flash_programmer_release.tiimage to (Uniflash Install Directory)/processors/FlashWriter/j7xx_evm

For using OSPI the SW3 switch setting should be : 0XXX_XXXX_XX

Specific SW setting for different boot modes-

Mode Switch Settings
UART SW8: 0000_0000, SW9: 0111_0000
OSPI (J721E) SW8: 0000_0000, SW9: 0100_0000
OSPI (J7200) SW8: 1000_0010, SW9: 0011_0000
  • Change the boot mode to UART boot mode.
  • Connect to the second instance of UART (/dev/ttyUSB1 in linux, COMxx in Windows) and power on. One should see 'CCC...' being printed on the console. Once validated, note down the instance number and close the instance of the UART (the UART device needs to be free to transfer data)
  • Navigate to the uniflash installed directory, dslite.sh should be present here.
  • Run the following commands to flash

    1. UART SBL and sysfw : ./dslite.sh –mode processors -c /dev/ttyUSB1 -f (Path to Uniflash Install Directory)/processors/FlashWriter/j72xx_evm/uart_j72xx_evm_flash_programmer_release.tiimage -i 0
    2. OSPI SBL : ./dslite.sh –mode processors -c /dev/ttyUSB1 -f (SDK Install Directory)/pdk_jacinto_07.x.x/packages/ti/boot/sbl/binary/j72xx_evm/ospi/bin/sbl_ospi_img_mcu1_0_release.tiimage -d 3 -o 0
    3. tifs.bin : ./dslite.sh –mode processors -c /dev/ttyUSB1 -f (SDK Install Directory)/pdk_jacinto_07.x.x/packages/ti/drv/sciclient/soc/Vx/tifs.bin -d 3 -o 80000
    4. Can Profile XIP App (RAM) : ./dslite.sh –mode processors -c /dev/ttyUSB1 -f (SDK Install Directory)/mcusw/binary/can_profile_xip_app/bin/j72xx_evm/can_profile_xip_app_mcu1_0_release.appimage -d 3 -o 100000
    5. Can Profile XIP App (XIP) : ./dslite.sh –mode processors -c /dev/ttyUSB1 -f (SDK Install Directory)/mcusw/binary/can_profile_xip_app/bin/j72xx_evm/can_profile_xip_app_mcu1_0_release.appimage_xip -d 3
    6. OSPI Phy Tuning Bin : ./dslite.sh –mode processors -c /dev/ttyUSB1 -f (SDK Install Directory)/pdk/packages/ti/board/src/flash/nor/ospi/nor_spi_patterns.bin -d 3 -o 3FC0000

    Power off the board and change the bootmode to OSPI. Connect to second instance of UART and Power on the board. You should see the logs on the MCU uart console

    Note : In Windows, dslite.bat needs to be used instead of dslite.sh and during flashing if you get any error "Unknown response from the target", please disconnect UART cable and connect once again then try to flash. Note : In case of J7200 flash OSPI Phy Tuning bin file at location 3FC0000 and for J721E at 3FE0000.

Back To Top


BIOS Care abouts to run on XIP mode

Cache needs to be always ON and following BIOS setting change should be added in sysbios cfg file.

var Cache = xdc.useModule('ti.sysbios.family.arm.v7r.Cache');

Cache.skipEarlyCacheStartup = true;

Back To Top


Document Revision History

Revision Date Author Description Status
0.1 03 Feb 2020 Sujith S Initial Version Under Review
0.2 06 Feb 2020 Sunil M S Updated Logs and Performance Nos Approved
0.3 17 Feb 2020 Sujith S Re Organized, user guide Approved
0.4 02 Nov 2020 Nikki S J7200 updated Approved
0.5 25 Jun 2021 Aditya W XIP Boot Flow Update Under Review