This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDS64EVM: TMDS64EVM: Running the GPIO Example in SD Card Boot Mode

Part Number: TMDS64EVM
Other Parts Discussed in Thread: AM6442, , UNIFLASH

Hello
I am using the TMDS64EVM(PROC101D) based on the AM6442.

MCU_SDK version: 11.01.00.17
PROCESSOR_SDK version: 10.01.10.04

/opt/ti/mcu_plus_sdk_am64x_11_01_00_17/examples/drivers/gpio/gpio_input_interrupt/am64x-evm/r5fss0-0_nortos/ti-arm-clang

I am attempting to run the MCU GPIO interrupt example following the path above.
I referred to the forum inquiry below.

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1236579/faq-am64x-how-to-route-mcu-gpio-interrupts-to-main-domain-cores-in-mcu-plus-sdk-version-6-0-above

The current status is as follows:
It uses MCU_GPIO0, and the example runs on the MAIN_0_R5_1 core.
The executable file built via CCS was run, and the hardware interrupt service routine functions correctly for the input pulse signal.
sbl_ospi is used. Below is the default_sbl_ospi.cfg code related to sbl_ospi.

--flash-writer=sbl_prebuilt/am64x-evm/sbl_uart_uniflash.release.hs_fs.tiimage
--operation=flash-phy-tuning-data
--file=/opt/ti/mcu_plus_sdk_am64x_11_01_00_17/examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/ti-arm-clang/sbl_ospi.release.hs_fs.tiimage --operation=flash --flash-offset=0x0

My primary target is as follows.
Based on this, I intend to run the example on a Linux system installed on an SD card.

Therefore, I used sbl_sd instead of sbl_ospi.
I modified sbl_sd's main.c to resemble sbl_ospi's main.c and edited default_sbl_ospi.cfg.
The modifications are as follows.

--file=/opt/ti/mcu_plus_sdk_am64x_11_01_00_17/examples/drivers/boot/sbl_ospi/am64x-evm/r5fss0-0_nortos/ti-arm-clang/sbl_ospi.release.hs_fs.tiimage --operation=flash --flash-offset=0x0

The above code was modified as follows.

--file=/opt/ti/mcu_plus_sdk_am64x_11_01_00_17/examples/drivers/boot/sbl_sd/am64x-evm/r5fss0-0_nortos/ti-arm-clang/sbl_sd.release.hs_fs.tiimage --operation=flash --flash-offset=0x0

Afterwards, I completed the flash using uart_uniflash. The relevant code is listed below.

python3 uart_uniflash.py -p /dev/ttyUSB0 --cfg=/opt/ti/mcu_plus_sdk_am64x_11_01_00_17/tools/boot/sbl_prebuilt/am64x-evm/default_sbl_ospi.cfg

The EVM boots normally.


Subsequently, I moved the GPIO-related executable file to /lib/firmware on the SD card.
Its name is gpio_input_interrupt_am64x-evm_r5fss0-0_nortos_ti-arm-clang.out.
I referenced the resource table and device tree from the URL below.
https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1432302/am6442-remoteproc-failed-bad-phdr-da
Since it must run on the MAIN_0_R5_1 core, I changed r5f0_0_sram in the above URL to r5f0_1_sram. (Only the name was changed.)

Afterwards, I used putty to perform the following steps:

==> /sys/class/remoteproc/remoteproc1/name <==
78000000.r5f


echo stop > /sys/class/remoteproc/remoteproc1/state
[  111.075905] platform 78000000.r5f: k3_r5_rproc_stop: timeout waiting for rproc completion event
[  111.076063] remoteproc remoteproc1: stopped remote processor 78000000.r5f

echo gpio_input_interrupt_am64x-evm_r5fss0-0_nortos_ti-arm-clang.out > /sys/class/remoteproc/remoteproc1/firmware

echo start > /sys/class/remoteproc/remoteproc1/state
[  154.577348] remoteproc remoteproc1: powering up 78000000.r5f
[  154.586241] remoteproc remoteproc1: Booting fw image gpio_input_interrupt_am64x-evm_r5fss0-0_nortos_ti-arm-clang.out, size 403936
[  154.587397] remoteproc remoteproc1: bad phdr da 0x70080000 mem 0xe680
[  154.587416] remoteproc remoteproc1: Failed to load program segments: -22
-sh: echo: write error: Invalid argument
[  154.588192] remoteproc remoteproc1: Boot failed: -22


Reviewing the logs confirms the boot failure.
I suspect a memory allocation error in the resource table, but despite extensive forum searches, manual checks, and code modifications, I still haven't resolved it.

To recap, my current goal is to run a GPIO example that functions correctly via CCS on an SD card-based Linux system.

I desperately need help.
Thank you.

  • The reason for using PROCESSOR_SDK version 10.01.10.04 is that when using 11.01.05.03, Remoteproc does not terminate in response to user commands. 

  • Hello Korshare,

    Graceful shutdown on Linux SDK 11.1

    I am surprised to hear that you do not see the remote processor terminating in response to shutdown commands. Does your MCU+ code have the proper software to handle a graceful shutdown request from Linux? By default, the MCU+ GPIO example project does not have graceful shutdown code in it.

    Please see this article for the reason that we require Linux to "gracefully shut down" the non-Linux core by default:
    https://dev.ti.com/tirex/explore/node?isTheia=false&node=A__AVt2qZLTY3BgKr3D4YIv8w__AM64-ACADEMY__WI1KRXP__LATEST 

    For more discussion around the topic of adding graceful shutdown to an MCU+ project, please refer to this thread:
    AM6442: Remoteproc Linux Debugging Questions

    FYI: Your code on SDK 10.1 might not work after reloading the firmware, because it does not gracefully shut down 

    See this line? It means Linux timed out after 5 seconds waiting for the MCU+ core to respond to the graceful shutdown request:
    [  111.075905] platform 78000000.r5f: k3_r5_rproc_stop: timeout waiting for rproc completion event

    But it looks like on your SDK 10.1, Linux is programmed to shut down the R5F anyway. That means the R5F core was unable to release the peripherals it owns from the device manager, and when the R5F boots back up I would expect it to fail to secure ownership of those peripherals.

    How do I get an MCU+ SDK example booted by Linux? 

    I would start by walking through the "Application Development on Remote Cores" section of the Multicore academy. I wrote it just to answer this question
    https://dev.ti.com/tirex/explore/node?isTheia=false&node=A__AfSHr0vWbFdGCnmoPeMXzg__AM64-ACADEMY__WI1KRXP__LATEST

    Regards,

    Nick