Flash a Hello World example

Attention

Flashing a application will overwrite the SOC init application that was flashed earlier. So if you want to load and run from CCS again, you will need to do the SOC init steps again. See SOC Initialization for more details.

Attention

As the wake-up R5 is the device manager, it needs to be started by the SBL. So it can not be loaded through CCS. It should be flashed and booted through SBL.

Note

See also Flashing Tools for more details on the flashing tools.

Introduction

In this step we will flash the application that we have build and run using CCS to the EVM flash. We can then boot this application without being connected to CCS via JTAG.

Flashing the application using Snagfactory Tool

  • Make sure you have Snagboot installed on your host PC. Snagfactory is available on pip and can be installed using:

      $ python3 -m pip install --user snagboot
      $ python3 -m pip install --user snagboot[gui]
    
  • Build all the binaries. Refer to Snagfactory Getting Ready for more details.

  • POWER-OFF the EVM.

  • Set boot mode to USB DFU BOOTMODE as shown in the image below:

../../_images/boot_pins_dfu_boot_mode.png

USB DFU BOOT MODE

  • POWER-ON the EVM. The board will enumerate as a USB DFU device on the host PC.

Flashing using the GUI

  • Open a command prompt and run the below command to generate the .cmd file and yaml configuration file.

      cd ${SDK_INSTALL_PATH}/tools/boot/snagfactory
      python3 snagfactory_flash.py --board am62px-sk --target <boot-media> --cfg-file <path-to-edited-cfg-file> --gen-cfg
    
  • Launch the Snagfactory GUI by running the below command:

      snagfactory
    
  • In the GUI, load the generated .yaml file to proceed with flashing.

  • When the flashing is in progress, you will see flashing status displayed:

../../_images/snagfactory_flashing.png

Flashing in progress

  • After all the flashing is done, you will see completion message:

../../_images/snagfactory_flash.png

Flashing complete

Flashing using the CLI

  • Open a command prompt and run the below command to flash:

      cd ${SDK_INSTALL_PATH}/tools/boot/snagfactory
      python3 snagfactory_flash.py --board am62px-sk --target <boot-media> --cfg-file <path-to-edited-cfg-file>
    
  • When the flashing is in progress, you will see detailed flashing information displayed:

../../_images/snagfactory_cli.png

Flashing via CLI

  • After all the flashing is done, you will see something like below:

      [INFO] Running snagrecover: snagrecover -s am62p -F {'tiboot3': {'path': '/mcu_plus_sdk/tools/boot/snagfactory/am62px-sk/tiboot3.bin'}} -F {'tispl': {'path': '/mcu_plus_sdk/tools/boot/snagfactory/am62px-sk/tispl.bin'}} -F {'u-boot': {'path': '/mcu_plus_sdk/tools/boot/snagfactory/am62px-sk/u-boot.img'}}
      [INFO] Starting recovery of am62p board
      [INFO] Installing firmware tiboot3
      [INFO] Searching for partition id...
      [INFO] Found DFU Functional descriptor: wTransferSize = 512
      [INFO] Downloading file...
      [INFO] Could not read status after end of manifest-sync phase
      [INFO] Done
      [INFO] Done installing firmware tiboot3
      [INFO] Installing firmware tispl
      [INFO] Searching for partition id...
      [INFO] Found DFU Functional descriptor: wTransferSize = 4096
      [INFO] Downloading file...
      [INFO] Done manifesting firmware
      [INFO] Done
      [INFO] Done installing firmware tispl
      [INFO] Installing u-boot
      [INFO] Searching for partition id...
      [INFO] Found DFU Functional descriptor: wTransferSize = 4096
      [INFO] Downloading file...
      [INFO] Done manifesting firmware
      [INFO] Done
      [INFO] Sending detach command...
      [INFO] Sending DFU_DETACH...
      [INFO] Done installing firmware u-boot
      [INFO] Installing firmware u-boot
      [INFO] Searching for partition id...
      [INFO] Found DFU Functional descriptor: wTransferSize = 4096
      [INFO] Downloading file...
      [INFO] Done manifesting firmware
      [INFO] Done
      [INFO] Sending detach command...
      [INFO] Sending DFU_DETACH...
      [INFO] Done installing firmware u-boot
      [INFO] Done recovering am62p board
      [INFO] snagrecover completed successfully.
      [INFO] Waiting for fastboot device 0451:6165 ...
      [INFO] Fastboot device detected.
      [INFO] Running snagflash: snagflash -P fastboot-uboot -p 0451:6165 -I /mcu_plus_sdk/tools/boot/snagfactory/am62px-sk/am62px-sk_emmc_hs_fs.cmd
      [INFO] [INFO] Running snagflash using protocol fastboot-uboot
      [INFO] Waiting for USB 0451:6165
      [INFO] []
      [INFO] Done
      [INFO] running commands from file /mcu_plus_sdk/tools/boot/snagfactory/am62px-sk/am62px-sk_emmc_hs_fs.cmd
      [INFO] running command set target mmc0
      setting 'target' to 'mmc0'
      [INFO] running command set fb-addr 0x82000000
      setting 'fb-addr' to '0x82000000'
      [INFO] running command set fb-size 0x7000000
      setting 'fb-size' to '0x7000000'
      [INFO] running command flash "/mcu_plus_sdk/tools/boot/sbl_prebuilt/am62px-sk/sbl_emmc_linux_stage1.release.hs_fs.tiimage" 0x0 hwpart 1
      [INFO] Running pre-flash checks...
      [INFO] fastboot OKAY
      [INFO] (bootloader) downloadsize value b'0x07000000'
      [INFO] Flashing file /mcu_plus_sdk/tools/boot/sbl_prebuilt/am62px-sk/sbl_emmc_linux_stage1.release.hs_fs.tiimage
      [INFO] Flashing to MMC device...
      [INFO] fastboot OKAY
      [INFO] flashed 296679/296679 bytes
      [INFO] running command flash "/mcu_plus_sdk/examples/drivers/boot/sbl_emmc_linux_multistage/sbl_emmc_linux_stage2/am62px-sk/wkup-r5fss0-0_freertos/ti-arm-clang/sbl_emmc_linux_stage2.release.appimage.hs_fs" 0x80000 hwpart 1
      [INFO] (bootloader) downloadsize value b'0x07000000'
      [INFO] Flashing file /mcu_plus_sdk/examples/drivers/boot/sbl_emmc_linux_multistage/sbl_emmc_linux_stage2/am62px-sk/wkup-r5fss0-0_freertos/ti-arm-clang/sbl_emmc_linux_stage2.release.appimage.hs_fs
      [INFO] Flashing to MMC device...
      [INFO] fastboot OKAY
      [INFO] flashed 238934/238934 bytes
      [INFO] running command flash "/mcu_plus_sdk/tools/boot/HSMAppimageGen/board/am62px-sk/hsm.appimage.hs_fs" 0x240000 hwpart 1
      [INFO] (bootloader) downloadsize value b'0x07000000'
      [INFO] Flashing file /mcu_plus_sdk/tools/boot/HSMAppimageGen/board/am62px-sk/hsm.appimage.hs_fs
      [INFO] Flashing to MMC device...
      [INFO] fastboot OKAY
      [INFO] flashed 9677/9677 bytes
      [INFO] running command flash "/mcu_plus_sdk/examples/hello_world/am62px-sk/mcu-r5fss0-0_freertos/ti-arm-clang/hello_world.release.appimage.hs_fs" 0x800000 hwpart 1
      [INFO] (bootloader) downloadsize value b'0x07000000'
      [INFO] Flashing file /mcu_plus_sdk/examples/hello_world/am62px-sk/mcu-r5fss0-0_freertos/ti-arm-clang/hello_world.release.appimage.hs_fs
      [INFO] Flashing to MMC device...
      [INFO] fastboot OKAY
      [INFO] flashed 42082/42082 bytes
      [INFO] running command flash "/mcu_plus_sdk/tools/boot/linuxAppimageGen/board/am62px-sk/linux.appimage.hs_fs" 0x1200000 hwpart 1
      [INFO] (bootloader) downloadsize value b'0x07000000'
      [INFO] Flashing file /mcu_plus_sdk/tools/boot/linuxAppimageGen/board/am62px-sk/linux.appimage.hs_fs
      [INFO] Flashing to MMC device...
      [INFO] fastboot OKAY
      [INFO] flashed 1080926/1080926 bytes
      [INFO] running command flash "/mcu_plus_sdk/tools/boot/linuxAppimageGen/board/am62px-sk/u-boot.img" 0x280000 hwpart 1
      [INFO] (bootloader) downloadsize value b'0x07000000'
      [INFO] Flashing file /mcu_plus_sdk/tools/boot/linuxAppimageGen/board/am62px-sk/u-boot.img
      [INFO] Flashing to MMC device...
      [INFO] fastboot OKAY
      [INFO] flashed 1440471/1440471 bytes
      [INFO] running command exit
      Leaving interactive snagflash session...
      [INFO] snagflash completed successfully.
      [INFO] Flash complete!
    
  • If flashing has failed, see Flashing Tools for error messages and solutions, and resolve the errors.

  • If flashing is successful, do the next steps.

Running the flashed application (Snagfactory)

  • POWER-OFF the EVM

  • Switch the EVM boot mode to appropriate target Boot Mode. As shown in EVM Setup

  • Re-connect the UART terminal in CCS window.

  • POWER-ON the EVM

  • You should see the application output in MCU UART terminal as below:

      Hello World!
    
  • You should see the application output in WKUP UART terminal as below:

      Sciserver Testapp Built On: Jun 30 2026 11:38:29
      Sciserver Version: v2023.11.0.0REL.MCUSDK.MM.NN.PP.bb
      RM_PM_HAL Version: vMM.NN.PP
      Starting Sciserver..... PASSED
    
      Hello World!
    
  • You should see the following SBL output on the main UART terminal as below.

      SYSFW ABI: 4.0 (firmware rev 0x000b '11.2.10--v11.02.10 (Fancy Rat)')
      [KPI] Boot Media       : eMMC
      [KPI] Boot Media Clock : 200.000 MHz
      [KPI] Boot Image Size  : 191 KB
      [KPI] Cores present    :
      mcu-r5f0-0
      r5f0-0
      [KPI] System_init                      :      32924us
      [KPI] Board_init                       :         94us
      [KPI] Drivers_open                     :      21690us
      [KPI] Board_driversOpen                :          0us
      [KPI] Sciclient Get Version            :       6798us
      [KPI] PBIST Positive Tests             :        214us
      [KPI] PBIST Negative Tests             :        612us
      [KPI] MCU R5 Image Load                :       4541us
      [KPI] DM R5 Image Load                 :       5513us
      [KPI] SBL Total Time Taken             :      72390us
    
      Image loading done, switching to application ...
      Starting MCU-r5f and 2nd stage bootloader
    
      SYSFW ABI: 4.0 (firmware rev 0x000b '11.2.10--v11.02.10 (Fancy Rat)')
      [KPI] Boot Media       : eMMC
      [KPI] Boot Media Clock : 200.000 MHz
      [KPI] Boot Image Size  : 1380 KB
      [KPI] Cores present    :
      hsm-m4f0-0
      r5f0-0
      a530-0
      c75ss0
      [KPI] System_init                      :       1791us
      [KPI] Board_init                       :          0us
      [KPI] Drivers_open                     :      21515us
      [KPI] Board_driversOpen                :          0us
      [KPI] Sciclient Get Version            :       6796us
      [KPI] HSM Image Load                   :       3830us
      [KPI] DM R5 Image Load                 :       6358us
      [KPI] A53 Image Load                   :      17071us
      [KPI] DSP Image Load                   :       5594us
      [KPI] SBL Total Time Taken             :      62959us
    
      Image loading done, switching to application ...
      Starting linux and RTOS/Baremetal applications
    
  • Congratulations! Now the EVM is flashed with your application and you don’t need CCS anymore to run the application.

Getting ready to flash the application

  • A quick recap of steps done so far that are needed for the flashing to work

    • Make sure the UART port used for terminal is identified as mentioned in Setup UART Terminal

    • Make sure python3 is installed as mentioned in Python3

    • Make sure you have the EVM power cable and UART cable connected as shown in Cable Connections

  • Build the hello world application as mentioned in Build a Hello World example

  • As part of the build process in the final step a file with extension .appimage.hs_fs is generated for HS-FS devices or .appimage.hs for HS-SE devices. This is the file we need to flash.

    • When building with makefiles and single-core projects, this file can be found here (shown for hello world example),

      • For MCU R5F

         ${SDK_INSTALL_PATH}/examples/hello_world/am62px-sk/mcu-r5fss0-0_freertos/ti-arm-clang/hello_world.release.appimage.hs_fs
        
      • For DM R5F (WKUP R5F)

         ${SDK_INSTALL_PATH}/examples/hello_world/am62px-sk/wkup-r5fss0-0_freertos/ti-arm-clang/hello_world.release.appimage.hs_fs
        
    • When building with CCS projects, this file can be found here (shown for hello world example),

      • For MCU R5F

         ${CCS_WORKSPACE_PATH}/hello_world_am62px-sk_mcu-r5fss0-0_freertos_ti-arm-clang/Release/hello_world_am62px-sk_mcu-r5fss0-0_freertos_ti-arm-clang.appimage.hs_fs
        
      • For DM R5F (WKUP R5F)

        ${CCS_WORKSPACE_PATH}/hello_world_am62px-sk_r5fss0-0_freertos_ti-arm-clang/Release/hello_world_am62px-sk_wkup-r5fss0-0_freertos_ti-arm-clang.appimage.hs_fs
        
    • NOTE: The folder name and file name in path can have “release”, “Release” or “debug”, “Debug” based on the profile that the application is built with.

  • Next, we need to list the files to flash in a flash configuration file. A default configuration file can be found at below path. You can edit this file directly or take a copy and edit this file.

      ${SDK_INSTALL_PATH}/tools/boot/sbl_prebuilt/am62px-sk/default_sbl_ospi_linux_hs_fs.cfg
    

Note

For HS-SE device, use default_sbl_ospi_linux_hs.cfg as the cfg file.

Note

For HS-FS device, use default_sbl_ospi_linux_hs_fs.cfg as the cfg file.

  • Edit below line in the config file to point to your application .appimage file. Give the absolute path to the .appimage file or path relative to ${SDK_INSTALL_PATH}/tools/boot. Make sure to use forward slash / in the filename path.

    • For MCU R5F

      --file=../../examples/drivers/ipc/ipc_rpmsg_echo_linux/am62px-sk/mcu-r5fss0-0_freertos/ti-arm-clang/ipc_rpmsg_echo_linux.release.appimage.hs_fs --operation=flash --flash-offset=0x800000
      
    • For DM R5F (WKUP R5F)

      --file=../../examples/drivers/ipc/ipc_rpmsg_echo_linux/am62px-sk/wkup-r5fss0-0_freertos/ti-arm-clang/ipc_rpmsg_echo_linux.release.appimage.hs_fs --operation=flash --flash-offset=0xC0000
      
  • This file will additionally also list the flashing application that is run on the EVM and a OSPI flash bootloader that also needs to be flashed. You can keep this unchanged if you have not modified these applications.

  • Save and close the config file.

Building Linux app image and HSM app image

The linux and HSM app images are to be generated to flash along with your application for MCU R5.

LinuxAppImage

Note

For HS-SE device, use DEVICE_TYPE=HS option in the makefile.

  • Ensure the AM62P Processor SDK Linux path is correct in the ${SDK_INSTALL_PATH}/tools/boot/linuxAppimageGen/board/{board_name}/config.mak file.

  • Go to ${SDK_INSTALL_PATH}/tools/boot/linuxAppimageGen on terminal

  • Run the following command to build the linux app image.

    • For SK-AM62P-LP

       make BOARD=am62px-sk all
      

HSMAppImage

Note

For HS-SE device, use DEVICE_TYPE=HS option in the makefile.

  • Go to ${SDK_INSTALL_PATH}/tools/boot/HSMAppimageGen on terminal

  • Run the following command to build the HSM app image.

    • For SK-AM62P-LP

       make BOARD=am62px-sk all
      

Flashing the application

  • Build all the binaries

    • For Linux

       make DEVICE=am62px -sj
      
    • For Windows

       gmake DEVICE=am62px -sj
      
  • POWER-OFF the EVM

  • Set boot mode to UART BOOTMODE as shown in below image

../../_images/boot_pins_uart_boot_mode3.png

UART BOOT MODE

  • POWER-ON the EVM

  • You should see character “C” getting printed on the UART terminal every 2-3 seconds as shown below

../../_images/uart_rom_boot4.png

UART output in UART BOOT MODE

  • Close the UART terminal as shown below. This is important, else the UART script in next step wont be able to connect to the UART port.

../../_images/ccs_uart_close1.png

Close UART terminal

Note

For am62px-sk HS-SE device, use default_sbl_ospi_linux_hs.cfg as the cfg file.

Note

For am62px-sk HS-FS device, use default_sbl_ospi_linux_hs_fs.cfg as the cfg file.

  • Open a command prompt and run the below command to flash the SOC initialization binary to the EVM.

      cd ${SDK_INSTALL_PATH}/tools/boot
      python uart_uniflash.py -p COM13 --cfg=sbl_prebuilt/{{ VAR_BOARD_NAME_LOWER }}/default_sbl_ospi_linux_hs_fs.cfg
    
    • Here COM13 is the port name of the identified UART port in Windows.

    • On Linux,

      • The name for UART port is typically something like /dev/ttyUSB0

      • On some Linux systems, one needs to use python3 to invoke python3.x, just python command may invoke python 2.x which will not work with the flashing script.

  • When the flashing is in progress you will see something like below

../../_images/flash_soc_init_in_progress1.png

Flash in progress

  • After all the flashing is done, you will see something like below

      Parsing config file ...
      Parsing config file ... SUCCESS. Found 9 command(s) !!!
    
      Executing command 1 of 9 ...
      Found flash writer ... sending sbl_prebuilt/am62px-sk/sbl_uart_uniflash_stage1.release.hs_fs.tiimage
      Sent flashwriter sbl_prebuilt/am62px-sk/sbl_uart_uniflash_stage1.release.hs_fs.tiimage of size 286255 bytes in 28.78s.
    
      Executing command 2 of 9 ...
      Command arguments : --file=../../examples/drivers/boot/sbl_uart_uniflash_multistage/sbl_uart_uniflash_stage2/am62px-sk/wkup-r5fss0-0_nortos/ti-arm-clang/sbl_uart_uniflash_stage2.release.appimage.hs_fs --operation=flash --flash-offset=0x0
      Sent ../../examples/drivers/boot/sbl_uart_uniflash_multistage/sbl_uart_uniflash_stage2/am62px-sk/wkup-r5fss0-0_nortos/ti-arm-clang/sbl_uart_uniflash_stage2.release.appimage.hs_fs of size 123939 bytes in 15.21s.
      [STATUS] SUCCESS !!!
    
      Executing command 3 of 9 ...
      Command arguments : --operation=flash-phy-tuning-data
      Sent flash phy tuning data in 3.87s.
      [STATUS] SUCCESS !!!
    
      Executing command 4 of 9 ...
      Command arguments : --file=sbl_prebuilt/am62px-sk/sbl_ospi_linux_stage1.release.hs_fs.tiimage --operation=flash --flash-offset=0x0
      Sent sbl_prebuilt/am62px-sk/sbl_ospi_linux_stage1.release.hs_fs.tiimage of size 325935 bytes in 33.63s.
      [STATUS] SUCCESS !!!
    
      Executing command 5 of 9 ...
      Command arguments : --file=../../examples/drivers/ipc/ipc_rpmsg_echo_linux/am62px-sk/wkup-r5fss0-0_freertos/ti-arm-clang/ipc_rpmsg_echo_linux.release.appimage.hs_fs --operation=flash --flash-offset=0x80000
      Sent ../../examples/drivers/boot/sbl_ospi_linux_multistage/sbl_ospi_linux_stage2/am62px-sk/wkup-r5fss0-0_nortos/ti-arm-clang/sbl_ospi_linux_stage2.release.appimage.hs_fs of size 139483 bytes in 16.13s.
      [STATUS] SUCCESS !!!
    
      Executing command 6 of 9 ...
      Command arguments : --file=../../examples/drivers/ipc/ipc_rpmsg_echo_linux/am62px-sk/mcu-r5fss0-0_freertos/ti-arm-clang/ipc_rpmsg_echo_linux.release.appimage.hs_fs --operation=flash --flash-offset=0x800000
      Sent ../../examples/drivers/ipc/ipc_rpmsg_echo_linux/am62px-sk/mcu-r5fss0-0_freertos/ti-arm-clang/ipc_rpmsg_echo_linux.release.appimage.hs_fs of size 52687 bytes in 7.97s.
      [STATUS] SUCCESS !!!
    
      Executing command 7 of 9 ...
      Command arguments : --file=../../tools/boot/HSMAppimageGen/board/am62px-sk/hsm.appimage.hs_fs --operation=flash --flash-offset=0x240000
      Sent ../../tools/boot/HSMAppimageGen/board/am62px-sk/hsm.appimage.hs_fs of size 9646 bytes in 3.94s.
      [STATUS] SUCCESS !!!
    
      Executing command 8 of 9 ...
      Command arguments : --file=../../tools/boot/linuxAppimageGen/board/am62px-sk/linux.appimage.hs_fs --operation=flash --flash-offset=0x1200000
      Sent ../../tools/boot/linuxAppimageGen/board/am62px-sk/linux.appimage.hs_fs of size 733151 bytes in 71.71s.
      [STATUS] SUCCESS !!!
    
      Executing command 9 of 9 ...
      Command arguments : linuxAppimageGen/board/am62px-sk/u-boot.img --operation=flash --flash-offset=0x280000
      Sent linuxAppimageGen/board/am62px-sk/u-boot.img of size 1160651 bytes in 121.0s.
      [STATUS] SUCCESS !!!
    
    
      All commands from config file are executed !!!
    
  • If flashing has failed, see Flash tool error messages and solutions, and resolve the errors.

  • If flashing is successful, do the next steps …

Running the flashed application

  • POWER-OFF the EVM

  • Switch the EVM boot mode to OSPI mode as shown below,

../../_images/boot_pins_ospi_mode.png

OSPI BOOT MODE

  • Re-connect the UART terminal in CCS window as shown in Setup UART Terminal

  • POWER-ON the EVM

  • You should see the application output in MCU UART terminal as below

      Hello World!
    
  • You should see the application output in WKUP UART terminal as below

      Sciserver Testapp Built On: Feb 21 2023 17:57:59
      Sciserver Version: v2023.01.0.0REL.MCUSDK.08.06.00.16+
      RM_PM_HAL Version: REL.MCUSDK.08.06.00.16
      Starting Sciserver..... PASSED
      GTC freq: 200000000
      Hello World!
    
  • You should see the following SBL output on the main UART terminal as below.

      SYSFW Version 9.0.5--v09.00.05 (Kool Koala)
      SYSFW revision 0x9
      DMSC ABI revision 3.1
    
      [KPI] Boot Media       : FLASH
      [KPI] Boot Media Clock : 200.000 MHz
      [KPI] Boot Image Size  : 184 KB
      [KPI] Cores present    :
      wkup-r5f0-0
      [KPI] System_init                      :      39175us
      [KPI] Drivers_open                     :        191us
      [KPI] Board_driversOpen                :         87us
      [KPI] Sciclient Get Version            :       9893us
      [KPI] App_loadImages                   :       4541us
      [KPI] App_loadSelfcoreImage            :       9288us
      [KPI] SBL Total Time Taken             :      70975us
    
      Image loading done, switching to application ...
      Starting MCU-r5f and 2nd stage bootloader
    
      SYSFW Version 9.0.5--v09.00.05 (Kool Koala)
      SYSFW revision 0x9
      DMSC ABI revision 3.1
    
      [KPI] Boot Media       : FLASH
      [KPI] Boot Media Clock : 200.000 MHz
      [KPI] Boot Image Size  : 1001 KB
      [KPI] Cores present    :
      mcu-r5f0-0
      hsm-m4f0-0
      wkup-r5f0-0
      a530-0
      [KPI] System_init                      :       1801us
      [KPI] Drivers_open                     :        224us
      [KPI] Board_driversOpen                :         86us
      [KPI] Sciclient Get Version            :       9910us
      [KPI] App_loadImages                   :       2289us
      [KPI] App_loadSelfcoreImage            :       9051us
      [KPI] App_loadLinuxImages              :      40933us
      [KPI] App_loadDSPImages                :       9623us
      [KPI] SBL Total Time Taken             :      73921us
    
      Image loading done, switching to application ...
      Starting linux and RTOS/Baremetal applications
    
  • Congratulations now the EVM is flashed with your application and you don’t need CCS anymore to run the application.