Project

General

Profile

Hello World on the R5F

Objectives

  • Build a hello world program for the mcu
  • Load the program over JTAG, step through the program, see the output
  • Load the program using the remoteproc system
  • Load the program at boot time

Reference Documentation

Prerequisites

  • Install CCS and SDK
  • Monitor the M4 uart
    • Use your favorite terminal connection program
      • Code Composer Terminal View
      • tera-term
      • putty
  • Setup a name (target_62p) for your target

Steps - building the hello world program

  • Navigate to toolbar>View>Project Explorer
    • In the project explorer window go to import projects.
      • Hit the drop down arrow for the "Code Composer Studio" Folder and click "CCS Projects"
        • Click the browse button and open the following folder <MCU_PLUS_SDK_INSTALL_DIR>/ti/mcu_plus_sdk_{am62a/p}_10_01_00_33/examples/hello_world/{am62ax/px}-sk/mcu-r5fss0-0_freertos/ti-arm-clang
        • Right Click the opened project and select "Build Project"
  • Create new target configuration at toolbar>View>Target Configuration.
    • Right Click on "User Defined" and select "New Target Configuration"
      • Name the file {som name}_XDS2XX.ccxml.
        • Under the "General Setup" section, next to "Connection" open the drop-down arrow and select "Texas Instruments XDS2xx USB Debug Probe"
        • Under the "General Setup" section, next to "Board or Device" scroll and select AM62P or AM62A.
        • Click the "Save" button under the "Save Configuration" section.
    • Right click on target configuration you just made and select "Launch Selected Configuration"
  • In the debug window right click on "Texas Instruments XDS2xx USB Debug Probe_0/MCU_R5FSS0_0(Disconnected:Unkown) and select "Connect Target"
    • In the debug toolbar navigate to the CPU reset drop-down arrow and select CPU Reset
      • Navigate to toolbar>Run>Load>Load Program and select "Browse project..."
        • Select the following file hello_world_{am62ax/px}-sk_mcu-r5fss0-0_freertos_ti-arm-clang/Debug/hello_world_{am62ax/px}-sk_mcu-r5fss0-0_freertos_ti-arm-clang.out
        • The program is now paused and must be resumed. Go to toolbar>Run>Resume
        • You should now see "Hello World!" printed to the CCS and MCU Console

CCS Console

{som name}_XDS2XX.ccxml:CIO
[MCU_R5FSS0_0] Hello World!

MCU Console

[IPC RPMSG ECHO] Version: REL.MCUSDK.K3.10.01.00.10+ (Nov 14 2024 14:00:57):
[IPC RPMSG ECHO] Remote Core waiting for messages at end point 13 ... !!!
[IPC RPMSG ECHO] Remote Core waiting for messages at end point 14 ... !!!
Hello World!

Steps - Load the program using the remoteproc system

  • Apply patches to the imported project
    • Without the patches, the program can be loaded via JTAG but not through the remoteproc process.
    • With the patches, the program can be loaded through the remoteproc process, but not through JTAG.
    • See m4_hello_world_patches_for_use_with_remoteproc
  • Build release version
  • Copy release version to /lib/firmware/hello_world/
    ssh target_62p mkdir -p /lib/firmware/hello_world
    scp Release/hello_world_am62px-sk_mcu-r5fss0-0_freertos_ti-arm-clang.out target_62p:/lib/firmware/hello_world
    
  • link /lib/firmware/am62p-mcu-r5f0_0-fw to hello_world
    ssh target_62p ln -sf /lib/firmware/hello_world/hello_world_am62px-sk_mcu-r5fss0-0_freertos_ti-arm-clang.out /lib/firmware/am62p-mcu-r5f0_0-fw
    
  • On the target
    • See the different remote processors
      cd /sys/class/remoteproc
      
      root@mitysom-am62x:/sys/class/remoteproc# tail */name
      ==> /sys/class/remoteproc/remoteproc0/name <==
      79000000.r5f
      
      ==> /sys/class/remoteproc/remoteproc1/name <==
      78000000.r5f
      
    • Pick out the one for the mcu. e.g. remoteproc0
    • See the current state of the processor.
      tail *0/state
      running
      
    • Stop the processor
      echo 'stop' > *0/state
      [73439.834056] remoteproc remoteproc0: stopped remote processor 5000000.m4fss
      
    • Start the processor (will load the new program)
      echo 'start' > *0/state
      [73473.037249] remoteproc remoteproc0: powering up 5000000.m4fss
      [73473.044197] remoteproc remoteproc0: Booting fw image am62-mcu-m4f0_0-fw, size 79552
      [73473.052693]  remoteproc0#vdev0buffer: assigned reserved memory node m4f-dma-memory@9cb00000
      [73473.061740] virtio_rpmsg_bus virtio0: rpmsg host is online
      [73473.068466]  remoteproc0#vdev0buffer: registered virtio0 (type 7)
      [73473.074680] remoteproc remoteproc0: remote processor 5000000.m4fss is now up
      
    • Should see Hello World on the mcu uart.

Steps - Load the program at boot time

  • Change program to repeatedly print hello world.
    • In hello_world.c change
          DebugP_log("Hello World!\r\n");
      

      to
          for (int ii = 0; ii < 1000; ++ii)
          {
              DebugP_log("%3d: Hello World!\r\n", ii);
              ClockP_sleep(5);
          }
      
    • Build release version
    • Copy Release/hello_world_am62px-sk_mcu-r5fss0-0_freertos_ti-arm-clang.out to target at /lib/firmware/hello_world/hello_world_am62px-sk_mcu-r5fss0-0_freertos_ti-arm-clang.out
      scp Release/hello_world_am62px-sk_mcu-r5fss0-0_freertos_ti-arm-clang.out target_62p:/lib/firmware/hello_world/hello_world_am62px-sk_mcu-r5fss0-0_freertos_ti-arm-clang.out
      
    • Reboot the target
    • Monitor the mcu uart. Should see lines like:
        0: Hello World!
        1: Hello World!
        2: Hello World!
        3: Hello World!
        4: Hello World!
        5: Hello World!
        6: Hello World!
        7: Hello World!
        8: Hello World!
        9: Hello World!
       10: Hello World!
       11: Hello World!
      

      with a new line being printed every 5 seconds up to 1000 times

Summary

This wiki page has demonstrated the following:

  • Building, running and debugging hello world on the R5 processorusing a JTAG connection within Code Composer Studio
  • Starting the hello world program using remoteproc
  • Starting a hello world program when booting the target.

Go to top
Add picture from clipboard (Maximum size: 1 GB)