MCU-PLUS-SDK: Difference between revisions

From Variscite Wiki
No edit summary
 
(21 intermediate revisions by the same user not shown)
Line 4: Line 4:
--> {{#lst:MCU-PLUS-SDK_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:MCU-PLUS-SDK_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:MCU-PLUS-SDK_Platform_Customization|MCU-PLUS-SDK_GLOBALS}} <!--
--> {{#lst:MCU-PLUS-SDK_Platform_Customization|MCU-PLUS-SDK_GLOBALS}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - MCU-PLUS-SDK {{#var:MCU-PLUS-SDK_VERSION}}}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=MCU-PLUS-SDK}} __toc__
--> {{PageHeader|{{#var:HARDWARE_NAME}} - MCU-PLUS-SDK {{#var:MCU-PLUS-SDK_VERSION_}}}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=MCU-PLUS-SDK}} __toc__


=Overview=
=Overview=


==MCU-PLUS-SDK {{#var:MCU-PLUS-SDK_VERSION}} for for AM62X==
==MCU-PLUS-SDK {{#var:MCU-PLUS-SDK_VERSION_}} for for AM62X==
This SDK contains examples, libraries and tools to develop RTOS and no-RTOS based applications for ARM M4F CPU, ARM R5F CPU and related peripherals.<br>
This SDK contains examples, libraries and tools to develop RTOS and no-RTOS based applications for ARM M4F CPU, ARM R5F CPU and related peripherals.<br>
[[File:MCU-PLUS-SDK-block_diagram_am62x.png]]
The examples and demos supported from TI in this SDK are:<br>
This page lists all the examples and demos supported in this SDK.
1. Empty Project
2. Hello World Project
3. Hello World C++ Project
4. OS Kernel and Driver Porting Layer (DPL)
5. SOC and Board Peripheral Drivers
6. Secondary Bootloader (SBL)
7. Reset Isolation - MCU Domain
8. Extended OTP Test
9. Software Diagnostics Library (SDL)


To more details please see https://software-dl.ti.com/mcu-plus-sdk/esd/AM62X/{{#var:MCU-PLUS-SDK_VERSION}}/exports/docs/api_guide_am62x/EXAMPLES.html
[[File:MCU-PLUS-SDK-block_diagram_am62x.png.png]]


The examples are arranged as below
The examples and demos supported from TI are arranged as below
  {{#var:SDK_PATH}}/examples/{component or module}/{optional sub-module or sub-component}/{example name}/{board on which this example can run}/{cpu}_{os}/{compiler toolchain}
  {{#var:SDK_PATH}}/examples/{optional component or module}/{optional sub-module or sub-component}/{example name}/{board on which this example can run}/{cpu}_{os}/{compiler toolchain}


Not all examples are supported by Variscite, the table "Available demos" details those supported.
For example referring to ipc_rpmsg_echo_linux for {{#var:HARDWARE_NAME}}
{optional component or module}: e.g. driver
{optional sub-module or sub-component}: e.g. ipc
{example name}: e.g. ipc_rpmsg_echo_linux
{board on which this example can run}: var-som-am62
{cpu}_{os}: e.g. m4fss0-0_freertos
{compiler toolchain}: ti-arm-clang


== Boot Flow ==
For more details please see [https://software-dl.ti.com/mcu-plus-sdk/esd/AM62X/{{#var:MCU-PLUS-SDK_VERSION_}}/exports/docs/api_guide_am62x/EXAMPLES.html TI Examples and Demos]
https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/{{#var:MCU-PLUS-SDK_VERSION}}/exports/docs/linux/Foundational_Components/U-Boot/UG-General-Info.html#boot-flow
 
To see the examples supported by Variscite, please look at the table [[#Available_demos|Available demos]]:<br>
 
=Documentation=
==MCU-PLUS-SDK==
Available online from [https://software-dl.ti.com/mcu-plus-sdk/esd/AM62X/{{#var:MCU-PLUS-SDK_VERSION_}}/exports/docs/api_guide_am62x/index.html TI AM62x MCU+ SDK]
Locally starting documentation server
  "cd {{#var:SDK_PATH}}"
  "python3 -m http.server 8080 &"
  open web browser to "http://<ip where documentation server is running>:8080/docs/api_guide_am62x/index.html"
 
== Other useful informations ==
https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/{{#var:SDK_LINUX_RELEASE}}/exports/docs/linux/Foundational_Components/U-Boot/UG-General-Info.html#boot-flow
https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/{{#var:SDK_LINUX_RELEASE}}/exports/docs/linux/Foundational_Components_IPC62x.html
 
=Prerequisites=
 
Before starting, prepare a [[{{#var:HARDWARE_NAME}} | Yocto]] boot SD.


=Installing required packages=
=Installing required packages=
Line 49: Line 61:
  $ git clone {{#var:SDK_GIT_URL}} -b {{#var:SDK_GIT_BRANCH}} {{#var:SDK_PATH}}
  $ git clone {{#var:SDK_GIT_URL}} -b {{#var:SDK_GIT_BRANCH}} {{#var:SDK_PATH}}


=Documentation=
=Demos pins for M4F CPU=
https://software-dl.ti.com/mcu-plus-sdk/esd/AM62X/{{#var:MCU-PLUS-SDK_VERSION}}/exports/docs/api_guide_am62x/index.html
Original TI documentation is available at https://software-dl.ti.com/mcu-plus-sdk/esd/AM62X/{{#var:MCU-PLUS-SDK_VERSION}}/exports/docs/api_guide_am62x/EXAMPLES.html.<br>
Available also locally at {{#var:SDK_PATH}}/{{#var:DOCS_FOLDER}}/index.html.<br>
Available also starting documentation server running "cd {{#var:SDK_PATH}}" "python3 -m http.server 8080 &" and then open web browser to "http://<ip where documentation server is running>:8080/docs/api_guide_am62x/index.html"
 
=Demos pins for M4F core=
{{#lst:MCU-PLUS-SDK_Platform_Customization|{{#var:PINS_SECTION_M4F}}}}
{{#lst:MCU-PLUS-SDK_Platform_Customization|{{#var:PINS_SECTION_M4F}}}}


=Demos pins for R5F core=
=Demos pins for R5F CPU=
{{#lst:MCU-PLUS-SDK_Platform_Customization|{{#var:PINS_SECTION_R5F}}}}
{{#lst:MCU-PLUS-SDK_Platform_Customization|{{#var:PINS_SECTION_R5F}}}}


=Available demos=
=Available demos=
All examples are arranged as below
{{#var:SDK_PATH}}/examples/{component or module}/{optional sub-module or sub-component}/{example name}/{board on which this example can run}/{cpu}_{os}/{compiler toolchain}


All of the Variscite examples are located under the following folders
All of the Variscite examples are located under the following folders
Line 74: Line 77:
{{#lst:MCU-PLUS-SDK_Platform_Customization|{{#var:DEMOS_SECTION}}}}
{{#lst:MCU-PLUS-SDK_Platform_Customization|{{#var:DEMOS_SECTION}}}}


The folders "am62x-sk" and "am62x-sk-lp" are related to the examples for TI Starter Kit.
The folders '''am62x-sk''' and '''am62x-sk-lp''' are related to the examples for TI Starter Kit.


You can build and run the demos following official TI documentation:
You can build and run the demos following official TI documentation:
  https://software-dl.ti.com/mcu-plus-sdk/esd/AM62X/{{#var:MCU-PLUS-SDK_VERSION}}/exports/docs/api_guide_am62x/MAKEFILE_BUILD_PAGE.html
  https://software-dl.ti.com/mcu-plus-sdk/esd/AM62X/{{#var:MCU-PLUS-SDK_VERSION_}}/exports/docs/api_guide_am62x/MAKEFILE_BUILD_PAGE.html
  https://software-dl.ti.com/mcu-plus-sdk/esd/AM62X/{{#var:MCU-PLUS-SDK_VERSION}}/exports/docs/api_guide_am62x/GETTING_STARTED_BUILD.html
  https://software-dl.ti.com/mcu-plus-sdk/esd/AM62X/{{#var:MCU-PLUS-SDK_VERSION_}}/exports/docs/api_guide_am62x/GETTING_STARTED_BUILD.html


=Building a demo=
=Building a demo using makefiles=
{{Note|'''Note:''' The Linux SDK provide an pre-built example ('''ipc_rpmsg_echo_linux''') that on a target file system is soft linked by '''am62-mcu-m4f0_0-fw'''.<br>
root@am62x-var-som:~# ls -l /lib/firmware<br>
lrwxrwxrwx 1 root root      72 May 3  2023 am62-mcu-m4f0_0-fw -> /lib/firmware/pdk-ipc/ipc_echo_baremetal_test_mcu2_0_release_strip.xer5f<br>
We will use '''ipc_rpmsg_echo_linux''' as example to explain building procedure.}}


==Building hello_world for MCU M4F==
==Building ipc_rpmsg_echo_linux for M4F CPU==


  $ cd {{#var:SDK_PATH}}
  $ cd {{#var:SDK_PATH}}
  $ export PROJDIR=examples/hello_world/{{#var:BOARD_FOLDER}}/m4fss0-0_freertos/ti-arm-clang/
  $ export PROJDIR=examples/drivers/ipc/ipc_rpmsg_echo_linux/{{#var:BOARD_FOLDER}}/m4fss0-0_freertos/ti-arm-clang/
$ make -s help
  $ make -s -C ${PROJDIR} clean
  $ make -s -C ${PROJDIR} clean
  $ make -s -C ${PROJDIR}
  $ make -s -C ${PROJDIR}
  This produce the M4F binary ${PROJDIR}/am62-mcu-m4f0_0-fw for RTOS OS
  This produces the M4F binary ${PROJDIR}/am62-mcu-m4f0_0-fw for RTOS OS
To build for NO RTOS use:
$ export PROJDIR=examples/hello_world/{{#var:BOARD_FOLDER}}/m4fss0-0_nortos/ti-arm-clang/


==Building hello_world for WKUP R5F (DM R5)==
==Building ipc_rpmsg_echo_linux for R5F CPU==


  $ cd {{#var:SDK_PATH}}
  $ cd {{#var:SDK_PATH}}
  $ export PROJDIR=examples/hello_world/{{#var:BOARD_FOLDER}}/r5fss0-0_freertos/ti-arm-clang/
  $ export PROJDIR=examples/drivers/ipc/ipc_rpmsg_echo_linux/{{#var:BOARD_FOLDER}}/r5fss0-0_freertos/ti-arm-clang/
$ make -s help
  $ make -s -C ${PROJDIR} clean
  $ make -s -C ${PROJDIR} clean
  $ make -s -C ${PROJDIR}
  $ make -s -C ${PROJDIR}
  This produce the R5F binary ${PROJDIR}/am62-wkup-r5f0_0-fw for RTOS OS
  This produces the R5F binary ${PROJDIR}/am62-wkup-r5f0_0-fw for RTOS OS
   
 
  To build for NO RTOS use:
=Running a demo=
$ The hello_world NO RTOS is not available for R5F core
 
==Booting M4F CPU from linux user space using remoteproc==
{{Note|'''Note:''' The remoteproc driver is hard-coded to look for specific files ('''am62-mcu-m4f0_0-fw''') when loading the M4F core.<br>
Before to replace it with new M4F binary a copy is recommended:<br>
root@am62x-var-som:~# cp /lib/firmware/pdk-ipc/ipc_echo_baremetal_test_mcu2_0_release_strip.xer5f /lib/firmware/pdk-ipc/ipc_echo_baremetal_test_mcu2_0_release_strip.xer5f.bk}}
 
$ cd {{#var:SDK_PATH}}
$ scp ${PROJDIR}/am62-mcu-m4f0_0-fw root@<target ip>:/lib/firmware/
  Run on the target:
$ echo stop > /sys/class/remoteproc/remoteproc0/state
  $ echo start > /sys/class/remoteproc/remoteproc0/state
 
==Flashing and booting R5F CPU through SBL==
{{Note|'''Attention!:''' Be very careful to use R5F for user app. It is recommended to use M4F instead.<br>
Read [https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1193739/am625-to-test-peripherals-in-the-main-and-wakeup-domains/4528297# TI discussion] for more details}}
 
===Prerequisites===
As the wake-up R5F is the device manager, it needs to be updated and started by the SBL. It can not be loaded through linux user space using remoteproc.<br>
Building U-Boot is required. Please referring to [https://variwiki.com/index.php?title=Yocto_Build_U-Boot_TI&release={{#var:YOCTO_RELEASE_TAG}} Yocto Build U-Boot from source code guide]
 
===Flashing R5F CPU===
 
$ cp ${PROJDIR}/am62-wkup-r5f0_0-fw  $DMFW_DIR/am62xx/ipc_echo_testb_mcu1_0_release_strip.xer5f
$ make -j8 ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- ATF=$TFA_DIR/build/k3/lite/release/bl31.bin TEE=$OPTEE_DIR/out/arm-plat-k3/core/tee-pager_v2.bin DM=$DMFW_DIR/ipc_echo_testb_mcu1_0_release_strip.xer5f O=$UBOOT_DIR/out/a53
$ Update $UBOOT_DIR/out/a53/tispl.bin referring to [https://variwiki.com/index.php?title=Yocto_Build_U-Boot_TI&release={{#var:YOCTO_RELEASE_TAG}}#:~:text=4%20Update%20U%2DBoot%20on%20running%20system Update U-Boot on running system] guide
 
===Booting R5F CPU===
To boots the new flashed R5F firmware rebooting is need
$ '''reset''' command from U-Boot prompt
$ press '''RST''' key
$ power '''off/on''' cycle

Latest revision as of 08:29, 16 May 2023

VAR-SOM-AM62 - MCU-PLUS-SDK 08_06_00_18

Overview

MCU-PLUS-SDK 08_06_00_18 for for AM62X

This SDK contains examples, libraries and tools to develop RTOS and no-RTOS based applications for ARM M4F CPU, ARM R5F CPU and related peripherals.

MCU-PLUS-SDK-block diagram am62x.png.png

The examples and demos supported from TI are arranged as below

~/mcu-plus-sdk-am62x/examples/{optional component or module}/{optional sub-module or sub-component}/{example name}/{board on which this example can run}/{cpu}_{os}/{compiler toolchain}

For example referring to ipc_rpmsg_echo_linux for VAR-SOM-AM62

{optional component or module}: e.g. driver
{optional sub-module or sub-component}: e.g. ipc
{example name}: e.g. ipc_rpmsg_echo_linux
{board on which this example can run}: var-som-am62
{cpu}_{os}: e.g. m4fss0-0_freertos
{compiler toolchain}: ti-arm-clang

For more details please see TI Examples and Demos

To see the examples supported by Variscite, please look at the table Available demos:

Documentation

MCU-PLUS-SDK

Available online from TI AM62x MCU+ SDK

Locally starting documentation server
 "cd ~/mcu-plus-sdk-am62x"
 "python3 -m http.server 8080 &"
 open web browser to "http://<ip where documentation server is running>:8080/docs/api_guide_am62x/index.html"

Other useful informations

https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/08_06_00_42/exports/docs/linux/Foundational_Components/U-Boot/UG-General-Info.html#boot-flow
https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/08_06_00_42/exports/docs/linux/Foundational_Components_IPC62x.html

Prerequisites

Before starting, prepare a Yocto boot SD.

Installing required packages

Download and install TI CLANG Compiler Toolchain:

$ cd /tmp
$ wget https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-ayxs93eZNN/2.1.2.LTS/ti_cgt_armllvm_2.1.2.LTS_linux-x64_installer.bin
$ chmod +x ti_cgt_armllvm_2.1.2.LTS_linux-x64_installer.bin
$ ./ti_cgt_armllvm_2.1.2.LTS_linux-x64_installer.bin and install to ~/ti/ti-cgt-armllvm_2.1.2.LTS
$ rm ti_cgt_armllvm_2.1.2.LTS_linux-x64_installer.bin

Download MCU-PLUS-SDK for the SOM:

$ mkdir ~/mcu-plus-sdk-am62x
$ cd ~/mcu-plus-sdk-am62x
$ git clone https://github.com/varigit/ti-mcu-plus-sdk -b mcu_plus_sdk_am62x_08_06_00_18_var01 ~/mcu-plus-sdk-am62x

Demos pins for M4F CPU

Default M4F pins used by the demos are:

Function SoC balls VAR-SOM-AM62 pins Symphony pins Notes
UART2 RXD/TXD R24/R25 J1.115/J1.171 J18.7 / J18.9 The UART2 is not an instance from the MCU domain so only the polling mode is supported.
To more details: Accessing main and wakeup domain peripherals from MCU domain

Don't use /dev/ttyS2 from linux while running M4F examples to avoid conflicts.

MCU_GPIO0_14 (Input) B3 J1.155 J13.16 (HDMI connector) HDMI to header connector adapter is required
MCU_GPIO0_13 (Output) D6 J1.157 J13.18 (HDMI connector) HDMI to header connector adapter is required
MCU_MCAN1 RX/TX D4/E5 J1.154/J1.156 J13.9/J13.11 (TTL levels, CAN transceiver not mounted!) HDMI to header connector adapter is required
MCU_SPI0 CLK/D0/D1/CS1 A7/D9/C9/B8 J1.150/J1.151/J1.152/J1.153 J13.17/J13.21/J13.15/J13.23 HDMI to header connector adapter is required
MCU_I2C0 SCL/SDA A8/D10 J1.146/J1.148 J13.22/J13.24 HDMI to header connector adapter is required

Demos pins for R5F CPU

Default R5F pins used by the demos are:

Function SoC balls VAR-SOM-AM62 pins Symphony pins Notes
WKUP_UART0 RXD/TXD B4/C5 J1.145/J1.147 JJ3.8/J3.9
MCU_GPIO0_14 (Input) B3 J1.155 J13.16 (HDMI connector) HDMI to header connector adapter is required
MCU_GPIO0_13 (Output) D6 J1.157 J13.18 (HDMI connector) HDMI to header connector adapter is required
MCAN0 RX/TX E15/C15 J1.46/J1.44 J16.18 / J16.20 (CANL/CANH levels, CAN transceiver mounted!)
MCU_SPI0 CLK/D0/D1/CS1 A7/D9/C9/B8 J1.150/J1.151/J1.152/J1.153 J13.17/J13.21/J13.15/J13.23 HDMI to header connector adapter is required
WKUP_I2C0 SCL/SDA B9/A9 J1.140/J1.141 J3.15/J3.5 HDMI to header connector adapter is required

Available demos

All of the Variscite examples are located under the following folders

~/mcu-plus-sdk-am62x/examples/{component or module}/{optional sub-module or sub-component}/{example name}/var-som-am62/{cpu}_{os}/{compiler toolchain}

The available demos for VAR-SOM-AM62 are:

  • drivers/gpio/gpio_input_interrupt
  • drivers/gpio/gpio_led_blink
  • drivers/i2c/i2c_led_blink
  • drivers/i2c/i2c_read
  • drivers/i2c/i2c_temperature
  • drivers/ipc/ipc_notify_echo
  • drivers/ipc/ipc_rpmsg_echo
  • drivers/ipc/ipc_rpmsg_echo_linux
  • drivers/mcan/mcan_loopback_interrupt
  • drivers/mcan/mcan_loopback_polling
  • drivers/mcspi/mcspi_loopback
  • drivers/mcspi/mcspi_performance_32bit
  • drivers/mcspi/mcspi_performance_8bit
  • drivers/sciclient/sciclient_get_version
  • drivers/uart/uart_echo
  • drivers/uart/uart_echo_low_latency_polling
  • drivers/udma/udma_chaining
  • drivers/udma/udma_memcpy_interrupt
  • drivers/udma/udma_memcpy_polling
  • drivers/udma/udma_sw_trigger
  • empty
  • hello_world
  • hello_world_cpp
  • kernel/dpl/dpl_demo
  • kernel/freertos/posix_demo
  • kernel/freertos/task_switch

The folders am62x-sk and am62x-sk-lp are related to the examples for TI Starter Kit.

You can build and run the demos following official TI documentation:

https://software-dl.ti.com/mcu-plus-sdk/esd/AM62X/08_06_00_18/exports/docs/api_guide_am62x/MAKEFILE_BUILD_PAGE.html
https://software-dl.ti.com/mcu-plus-sdk/esd/AM62X/08_06_00_18/exports/docs/api_guide_am62x/GETTING_STARTED_BUILD.html

Building a demo using makefiles

Note: The Linux SDK provide an pre-built example (ipc_rpmsg_echo_linux) that on a target file system is soft linked by am62-mcu-m4f0_0-fw.

root@am62x-var-som:~# ls -l /lib/firmware
lrwxrwxrwx 1 root root 72 May 3 2023 am62-mcu-m4f0_0-fw -> /lib/firmware/pdk-ipc/ipc_echo_baremetal_test_mcu2_0_release_strip.xer5f

We will use ipc_rpmsg_echo_linux as example to explain building procedure.

Building ipc_rpmsg_echo_linux for M4F CPU

$ cd ~/mcu-plus-sdk-am62x
$ export PROJDIR=examples/drivers/ipc/ipc_rpmsg_echo_linux/var-som-am62/m4fss0-0_freertos/ti-arm-clang/
$ make -s -C ${PROJDIR} clean
$ make -s -C ${PROJDIR}
This produces the M4F binary ${PROJDIR}/am62-mcu-m4f0_0-fw for RTOS OS

Building ipc_rpmsg_echo_linux for R5F CPU

$ cd ~/mcu-plus-sdk-am62x
$ export PROJDIR=examples/drivers/ipc/ipc_rpmsg_echo_linux/var-som-am62/r5fss0-0_freertos/ti-arm-clang/
$ make -s -C ${PROJDIR} clean
$ make -s -C ${PROJDIR}
This produces the R5F binary ${PROJDIR}/am62-wkup-r5f0_0-fw for RTOS OS

Running a demo

Booting M4F CPU from linux user space using remoteproc

Note: The remoteproc driver is hard-coded to look for specific files (am62-mcu-m4f0_0-fw) when loading the M4F core.

Before to replace it with new M4F binary a copy is recommended:

root@am62x-var-som:~# cp /lib/firmware/pdk-ipc/ipc_echo_baremetal_test_mcu2_0_release_strip.xer5f /lib/firmware/pdk-ipc/ipc_echo_baremetal_test_mcu2_0_release_strip.xer5f.bk
$ cd ~/mcu-plus-sdk-am62x
$ scp ${PROJDIR}/am62-mcu-m4f0_0-fw root@<target ip>:/lib/firmware/
Run on the target:
$ echo stop > /sys/class/remoteproc/remoteproc0/state
$ echo start > /sys/class/remoteproc/remoteproc0/state

Flashing and booting R5F CPU through SBL

Attention!: Be very careful to use R5F for user app. It is recommended to use M4F instead.
Read TI discussion for more details

Prerequisites

As the wake-up R5F is the device manager, it needs to be updated and started by the SBL. It can not be loaded through linux user space using remoteproc.
Building U-Boot is required. Please referring to Yocto Build U-Boot from source code guide

Flashing R5F CPU

$ cp ${PROJDIR}/am62-wkup-r5f0_0-fw  $DMFW_DIR/am62xx/ipc_echo_testb_mcu1_0_release_strip.xer5f
$ make -j8 ARCH=arm CROSS_COMPILE=aarch64-none-linux-gnu- ATF=$TFA_DIR/build/k3/lite/release/bl31.bin TEE=$OPTEE_DIR/out/arm-plat-k3/core/tee-pager_v2.bin DM=$DMFW_DIR/ipc_echo_testb_mcu1_0_release_strip.xer5f O=$UBOOT_DIR/out/a53
$ Update $UBOOT_DIR/out/a53/tispl.bin referring to Update U-Boot on running system guide

Booting R5F CPU

To boots the new flashed R5F firmware rebooting is need

$ reset command from U-Boot prompt
$ press RST key
$ power off/on cycle