MCUSW
Execute In Place (XIP) + Firmware Over The Air (FOTA) Application

Introduction


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. In addition to the CAN Profiling Application running in XIP mode, the demo also has a separate task that does firmware update in parallel to application execution. The demo showcases concurrent write while XIP read is in progress for a non RWW Flash. The demo also showcases the state machine logic for interleaving XIP read and New Application write access.

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_xip_fota_boot_flow.png
CAN Profiling XIP+FOTA Boot Flow
demo_can_profile_xip_fota_application_flow.png
CAN Profiling XIP+FOTA Application Flow

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


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_fota_app

Create a demo directory to store the binaries for this demo.
Create a subdirectory called "P2_image".
Go to (SDK Install Directory)/mcusw/build and run the following:

make can_profile_xip_fota_app BUILD_OS_TYPE=tirtos BOARD=j72xx_evm REGION=P1
cp ../binary/can_profile_xip_fota_app/bin/j72xx_evm/can_profile_xip_fota_app_mcu1_0_release.appimage (DEMO DIRECTORY)
cp ../binary/can_profile_xip_fota_app/bin/j72xx_evm/can_profile_xip_fota_app_mcu1_0_release.appimage_xip (DEMO DIRECTORY)
make allclean
make can_profile_xip_fota_app BUILD_OS_TYPE=tirtos BOARD=j72xx_evm REGION=P2
cp ../binary/can_profile_xip_fota_app/bin/j72xx_evm/can_profile_xip_fota_app_mcu1_0_release.appimage (DEMO DIRECTORY)/P2_image/
cp ../binary/can_profile_xip_fota_app/bin/j72xx_evm/can_profile_xip_fota_app_mcu1_0_release.appimage_xip (DEMO DIRECTORY)/P2_image/
mv (DEMO DIRECTORY)/P2_image/can_profile_xip_fota_app_mcu1_0_release.appimage_xip (DEMO DIRECTORY)/P2_image/can_profile_xip_fota_app_mcu1_0_release_xip.appimage
cp ../mcuss_demos/profiling/can_profile_xip_fota_app/bk_region.bin (DEMO DIRECTORY)

Back To Top


Steps to flash

Install uniflash 6.3 from https://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. FOTA P1 RAM Image : ./dslite.sh –mode processors -c /dev/ttyUSB1 -f (Demo Directory)/can_profile_xip_app_mcu1_0_release.appimage -d 3 -o 100000
    5. FOTA P1 XIP Image : ./dslite.sh –mode processors -c /dev/ttyUSB1 -f (Demo Directory)/can_profile_xip_app_mcu1_0_release.appimage_xip -d 3
    6. FOTA P2 RAM Image : ./dslite.sh –mode processors -c /dev/ttyUSB1 -f (Demo Directory)/P2_image/can_profile_xip_app_mcu1_0_release.appimage -d 3 -o 3000000
    7. FOTA P2 XIP Image : ./dslite.sh –mode processors -c /dev/ttyUSB1 -f (Demo Directory)/P2_image/can_profile_xip_app_mcu1_0_release_xip.appimage -d 3 -o 3800000
    8. BK Region Image : ./dslite.sh –mode processors -c /dev/ttyUSB1 -f (Demo Directory)/bk_region.bin -d 3 -o 3F00000
    9. 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 25 Jun 2021 Aditya W Initial Version Under Review