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.

PROCESSOR-SDK-J784S4: Bypass OPTEE Image in tispl.bin

Part Number: PROCESSOR-SDK-J784S4

Tool/software:

Hello Team,

I have Linux SDK Version: 09.02.00.05

how to bypass OPTEE image in tispl.bin  using Yoctobuild environment ?

I used below command to build the images.

MACHINE="j784s4-evm" bitbake tisdk-tiny-image

with above command OPTEE image(bl32) is included in Bl31.bin ,can you please help with command to bypass the OPTEE image in yoctobuild?

how to build bl31.bin alone in yocto?

Regards,

Prasad

  • Hi Prasad,

    There is no simple way of removing op-tee from the tispl.bin. It's referenced within the binman.dtsi and would require editing that file and other bsp recipes.

    Is there a reason you want to remove op-tee?

    Best,
    Jared

  • Hi Jared,

    I would like to use wkup_uart0 for debug console in j784s4-evm board and I was able to do that using board-support packages. in this process I bypassed OPTEE image inclusion in BL31 using below command.

    • make CROSS_COMPILE=/home/sandra/ti/arm-gnu-toolchain-11.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=generic.

    with same changes created the patches and  built the images using yoctobuild but images are not booting.

    how to build  all the images like ti-boot3.bin, tispl.bin and bl31, bl32 , u-boot, linux, using yocto build environment? what is the command?

    any idea why wkup_uart0 changes are not working when we build images in yocto?

    Linux changes.

    From 69b19e7f7b0d5225f692d52accbc2583045186ad Mon Sep 17 00:00:00 2001
    From: Sandra RangaPrasad <rangaprasad.sandra@aptiv.com>
    Date: Thu, 30 May 2024 12:51:57 +0530
    Subject: [PATCH] cat-cv-board-uart-changes
    
    ---
     arch/arm64/boot/dts/ti/k3-j784s4-evm.dts | 88 +++++++++++++++++++-----
     1 file changed, 69 insertions(+), 19 deletions(-)
    
    diff --git a/arch/arm64/boot/dts/ti/k3-j784s4-evm.dts b/arch/arm64/boot/dts/ti/k3-j784s4-evm.dts
    index 0c1fd77fc..ca298d2ed 100644
    --- a/arch/arm64/boot/dts/ti/k3-j784s4-evm.dts
    +++ b/arch/arm64/boot/dts/ti/k3-j784s4-evm.dts
    @@ -20,9 +20,13 @@ chosen {
     	};
     
     	aliases {
    -		serial0 = &wkup_uart0;
    +		/*Note: COREIO UART feature require serial0 and serial1 UART's for Testing.*/
    +		serial0 = &main_uart3;
     		serial1 = &mcu_uart0;
    -		serial2 = &main_uart8;
    +		serial2 = &wkup_uart0;
    +		serial3 = &main_uart4;
    +		serial4 = &main_uart5;
    +		serial5 = &main_uart7;
     		mmc0 = &main_sdhci0;
     		mmc1 = &main_sdhci1;
     		i2c0 = &main_i2c0;
    @@ -377,12 +381,12 @@ J784S4_WKUP_IOPAD(0x09C, PIN_INPUT, 0) /* (N35) WKUP_I2C0_SDA */
     		>;
     	};
     
    -	mcu_uart0_pins_default: mcu-uart0-pins-default {
    +	mcu_uart0_pins_default: mcu-uart0-default-pins {
     		pinctrl-single,pins = <
    -			J784S4_WKUP_IOPAD(0x090, PIN_INPUT, 0) /* (H37) MCU_UART0_CTSn */
    -			J784S4_WKUP_IOPAD(0x094, PIN_OUTPUT, 0) /* (K37) MCU_UART0_RTSn */
    -			J784S4_WKUP_IOPAD(0x08C, PIN_INPUT, 0) /* (K38) MCU_UART0_RXD */
    -			J784S4_WKUP_IOPAD(0x088, PIN_OUTPUT, 0) /* (J37) MCU_UART0_TXD */
    +			J784S4_WKUP_IOPAD(0x020, PIN_INPUT, 4) /* (F33) MCU_OSPI1_D3.MCU_UART0_CTSn */
    +			J784S4_WKUP_IOPAD(0x028, PIN_INPUT, 4) /* (G33) MCU_OSPI1_CSn1.MCU_UART0_RTSn */
    +			J784S4_WKUP_IOPAD(0x018, PIN_INPUT, 4) /* (D31) MCU_OSPI1_D1.MCU_UART0_RXD */
    +			J784S4_WKUP_IOPAD(0x01c, PIN_INPUT, 4) /* (G31) MCU_OSPI1_D2.MCU_UART0_TXD */
     		>;
     	};
     
    @@ -572,15 +576,6 @@ J784S4_IOPAD(0x0bc, PIN_INPUT, 6) /* (AD33) MCASP1_AFSX.MDIO0_MDIO */
     		>;
     	};
     
    -	main_uart8_pins_default: main-uart8-pins-default {
    -		pinctrl-single,pins = <
    -			J784S4_IOPAD(0x040, PIN_INPUT, 14) /* (AF37) MCASP0_AXR0.UART8_CTSn */
    -			J784S4_IOPAD(0x044, PIN_OUTPUT, 14) /* (AG37) MCASP0_AXR1.UART8_RTSn */
    -			J784S4_IOPAD(0x0d0, PIN_INPUT, 11) /* (AP38) SPI0_CS1.UART8_RXD */
    -			J784S4_IOPAD(0x0d4, PIN_OUTPUT, 11) /* (AN38) SPI0_CLK.UART8_TXD */
    -		>;
    -	};
    -
     	main_i2c0_pins_default: main-i2c0-pins-default {
     		pinctrl-single,pins = <
     			J784S4_IOPAD(0x0e0, PIN_INPUT_PULLUP, 0) /* (AN36) I2C0_SCL */
    @@ -639,6 +634,36 @@ J784S4_IOPAD(0x028, PIN_INPUT, 0) /* (AE33) MCAN16_RX */
     			J784S4_IOPAD(0x024, PIN_OUTPUT, 0) /* (AH34) MCAN16_TX */
     		>;
     	};
    +
    +	main_uart4_pins_default: main-uart4-default-pins {
    +		pinctrl-single,pins = <
    +		    J784S4_IOPAD(0x094, PIN_INPUT, 11) /* (AG35) UART_JACINTO_RS232_1_DCD */
    +		    J784S4_IOPAD(0x098, PIN_INPUT, 11) /* (AH36) UART_JACINTO_RS232_1_R_DTR */
    +		    J784S4_IOPAD(0x08c, PIN_INPUT, 11) /* (AE35) MCASP0_AXR7.UART4_RXD */
    +		    J784S4_IOPAD(0x090, PIN_INPUT, 11) /* (AC35) MCASP0_AXR8.UART4_TXD */
    +		>;
    +	};
    +
    +	main_uart3_pins_default: main-uart3-default-pins {
    +		pinctrl-single,pins = <
    +		    J784S4_IOPAD(0x074, PIN_INPUT, 11) /* (AC33) MCAN2_TX.UART3_RXD */
    +		    J784S4_IOPAD(0x078, PIN_INPUT, 11) /* (AH37) MCAN2_RX.UART3_TXD */
    +		>;
    +	};
    +
    +	main_uart7_pins_default: main-uart7-default-pins {
    +		pinctrl-single,pins = <
    +		    J784S4_IOPAD(0x0a4, PIN_INPUT, 13) /* (AJ36) MCASP0_AXR13.UART7_RXD */
    +		    J784S4_IOPAD(0x0a8, PIN_INPUT, 13) /* (AF34) MCASP0_AXR14.UART7_TXD */
    +		>;
    +	};
    +
    +	main_uart5_pins_default: main-uart5-default-pins {
    +		pinctrl-single,pins = <
    +		    J784S4_IOPAD(0x09c, PIN_INPUT, 11) /* (AF35) MCASP0_AXR11.UART5_RXD */
    +		    J784S4_IOPAD(0x0a0, PIN_INPUT, 11) /* (AD34) MCASP0_AXR12.UART5_TXD */
    +		>;
    +	};
     };
     
     &wkup_pmx0 {
    @@ -693,10 +718,32 @@ J784S4_WKUP_IOPAD(0x060, PIN_INPUT, 7) /* (J35) WKUP_GPIO0_2 */
     	};
     };
     
    -&main_uart8 {
    +/* RS435 for ISO35T */
    +&main_uart3 {
    +	status = "okay";
    +	pinctrl-names = "default";
    +	pinctrl-0 = <&main_uart3_pins_default>;
    +};
    +
    +/* RS232-5 Wire for MAX3243 */
    +&main_uart4 {
    +	status = "okay";
    +	pinctrl-names = "default";
    +	pinctrl-0 = <&main_uart4_pins_default>;
    +};
    +
    +/* RS232 3-wire for MAX3243 */
    +&main_uart5 {
    +	status = "okay";
    +	pinctrl-names = "default";
    +	pinctrl-0 = <&main_uart5_pins_default>;
    +};
    +
    +/* RS232 3-wire for MAX3243 */
    +&main_uart7 {
     	status = "okay";
     	pinctrl-names = "default";
    -	pinctrl-0 = <&main_uart8_pins_default>;
    +	pinctrl-0 = <&main_uart7_pins_default>;
     };
     
     &ufs_wrapper {
    @@ -1498,12 +1545,15 @@ K3_TS_OFFSET(25, 17)
     	};
     };
     
    +/* CV BOARD Debug UART */
     &wkup_uart0 {
    -	status = "reserved";
    +	status = "okay";
     	pinctrl-names = "default";
     	pinctrl-0 = <&wkup_uart0_pins_default>;
    +	clock-frequency = <96000000>;
     };
     
    +/* CV Board CYW89310 */
     &mcu_uart0 {
     	status = "okay";
     	pinctrl-names = "default";
    -- 
    2.34.1
    
    

    u-boot changes.

    From a1d9b6e92e705aafc9ece4db8d908b8cd33e97ee Mon Sep 17 00:00:00 2001
    From: Sandra RangaPrasad <rangaprasad.sandra@aptiv.com>
    Date: Tue, 28 May 2024 14:11:28 +0530
    Subject: [PATCH] ti-wakup-uart0-changes
    
    ---
     arch/arm/dts/k3-j784s4-evm-u-boot.dtsi          | 5 +++--
     arch/arm/dts/k3-j784s4-evm.dts                  | 9 ++++++---
     arch/arm/dts/k3-j784s4-mcu-wakeup.dtsi          | 4 ----
     arch/arm/dts/k3-j784s4-r5-evm.dts               | 2 +-
     4 files changed, 10 insertions(+), 10 deletions(-)
    
    diff --git a/arch/arm/dts/k3-j784s4-evm-u-boot.dtsi b/arch/arm/dts/k3-j784s4-evm-u-boot.dtsi
    index 965aeed6..5f58ca93 100644
    --- a/arch/arm/dts/k3-j784s4-evm-u-boot.dtsi
    +++ b/arch/arm/dts/k3-j784s4-evm-u-boot.dtsi
    @@ -13,9 +13,9 @@
     
     	aliases {
     		ethernet0 = &mcu_cpsw_port1;
    -		serial0 = &wkup_uart0;
    +		serial0 = &main_uart8;
     		serial1 = &mcu_uart0;
    -		serial2 = &main_uart8;
    +		serial2 = &wkup_uart0;
     		i2c0 = &wkup_i2c0;
     		i2c1 = &mcu_i2c0;
     		i2c2 = &mcu_i2c1;
    @@ -138,6 +138,7 @@
     
     &wkup_uart0 {
     	bootph-pre-ram;
    +	status = "okay";
     };
     
     &main_sdhci0 {
    diff --git a/arch/arm/dts/k3-j784s4-evm.dts b/arch/arm/dts/k3-j784s4-evm.dts
    index 539471c8..581eb8db 100644
    --- a/arch/arm/dts/k3-j784s4-evm.dts
    +++ b/arch/arm/dts/k3-j784s4-evm.dts
    @@ -20,7 +20,7 @@
     	};
     
     	aliases {
    -		serial2 = &main_uart8;
    +		serial2 = &wkup_uart0;
     		mmc0 = &main_sdhci0;
     		mmc1 = &main_sdhci1;
     		i2c0 = &main_i2c0;
    @@ -293,6 +293,7 @@
     };
     
     &wkup_pmx2 {
    +	bootph-pre-ram;
     	mcu_cpsw_pins_default: mcu-cpsw-pins-default {
     		pinctrl-single,pins = <
     			J784S4_WKUP_IOPAD(0x02c, PIN_INPUT, 0) /* (A35) MCU_RGMII1_RD0 */
    @@ -327,6 +328,7 @@
     	};
     
     	wkup_uart0_pins_default: wkup-uart0-pins-default {
    +		bootph-pre-ram;
     		pinctrl-single,pins = <
     			J784S4_WKUP_IOPAD(0x070, PIN_INPUT, 0) /* (E25) WKUP_UART0_CTSn */
     			J784S4_WKUP_IOPAD(0x074, PIN_OUTPUT, 0) /* (F28) WKUP_UART0_RTSn */
    @@ -388,10 +390,11 @@
     	};
     };
     
    -&main_uart8 {
    +&wkup_uart0 {
     	status = "okay";
     	pinctrl-names = "default";
    -	pinctrl-0 = <&main_uart8_pins_default>;
    +	pinctrl-0 = <&wkup_uart0_pins_default>;
    +	clock-frequency = <96000000>;
     };
     
     &main_i2c0 {
    diff --git a/arch/arm/dts/k3-j784s4-mcu-wakeup.dtsi b/arch/arm/dts/k3-j784s4-mcu-wakeup.dtsi
    index ac63266e..e2d57569 100644
    --- a/arch/arm/dts/k3-j784s4-mcu-wakeup.dtsi
    +++ b/arch/arm/dts/k3-j784s4-mcu-wakeup.dtsi
    @@ -114,10 +114,6 @@
     		reg = <0x00 0x42300000 0x00 0x200>;
     		interrupts = <GIC_SPI 897 IRQ_TYPE_LEVEL_HIGH>;
     		current-speed = <115200>;
    -		clocks = <&k3_clks 397 0>;
    -		clock-names = "fclk";
    -		power-domains = <&k3_pds 397 TI_SCI_PD_EXCLUSIVE>;
    -		status = "disabled";
     	};
     
     	mcu_uart0: serial@40a00000 {
    diff --git a/arch/arm/dts/k3-j784s4-r5-evm.dts b/arch/arm/dts/k3-j784s4-r5-evm.dts
    index 269f227f..6ddd42db 100644
    --- a/arch/arm/dts/k3-j784s4-r5-evm.dts
    +++ b/arch/arm/dts/k3-j784s4-r5-evm.dts
    @@ -13,7 +13,7 @@
     / {
     	chosen {
     		firmware-loader = &fs_loader0;
    -		stdout-path = &main_uart8;
    +		stdout-path = &wkup_uart0;
     		tick-timer = &timer1;
     	};
     
    -- 
    2.34.1
    
    

    ATF changes.

    From 42f38248f75d52afb3e1517740577ab4b3afd08f Mon Sep 17 00:00:00 2001
    From: Sandra RangaPrasad <rangaprasad.sandra@aptiv.com>
    Date: Thu, 30 May 2024 14:22:36 +0530
    Subject: [PATCH] wkup-uart0-for-debug-console
    
    ---
     plat/ti/k3/include/platform_def.h | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/plat/ti/k3/include/platform_def.h b/plat/ti/k3/include/platform_def.h
    index a2cc62d34..d008169c5 100644
    --- a/plat/ti/k3/include/platform_def.h
    +++ b/plat/ti/k3/include/platform_def.h
    @@ -105,14 +105,14 @@
     
     /* Platform default console definitions */
     #ifndef K3_USART_BASE
    -#define K3_USART_BASE			(0x02800000 + 0x10000 * K3_USART)
    +#define K3_USART_BASE			(0x42300000 + 0x10000 * K3_USART)
     #endif
     
     /* USART has a default size for address space */
     #define K3_USART_SIZE 0x1000
     
     #ifndef K3_USART_CLK_SPEED
    -#define K3_USART_CLK_SPEED 48000000
    +#define K3_USART_CLK_SPEED 96000000
     #endif
     
     /* Crash console defaults */
    -- 
    2.34.1
    
    

    OPTEE changes

    I made the change in platfrom file under core folder.

    Regards,

    Prasad.

  •  Hi Prasad,

    Switching around the uart aliases shouldn't depend on whether you have op-tee or not.

    It looks like you're developing for a custom board, and the serial port has been pinned out to a different uart channel. If this is the case, I would recommend creating a new device tree for the board that has all of the hardware modifications. You would need to add a machine conf when you're done.

    A similar comparison would be the BeaglePlay and AM625-SK. The SOCs are the same, but the boards are different. The dts files are k3-am625-beagleplay.dts and k3-am625-sk.dts respectively.

    Best,
    Jared

  • Hello Jared,

    I have a requirement to change the debug console from UART8 to WKUP_UART0 on the evaluation board J784s4-evm.

    Firstly I started with modifying the source code for wkup_uart0 under  board-support/ti-linux-kernel-6.1.80+gitAUTOINC+2e423244f8-ti and board-support/ti-u-boot-2023.04+gitAUTOINC+f9b966c674.

    I built the u-boot and kernel using below commands.

    make u-boot and make linux-dtbs.

    copied the tiboot3.bin and tispl.bin and u-boot.img images to sd card and  able to see the logs on the wkup_uart0. UART changes are working in standalone build.

    same changes I tried in yocto build environment by creating our own meta layer. but the changes are not working.

    any guess why UART changes are not working in yocto build ? 

    what is the command to build tiboot3.bin in yocto?

    Regards,

    Prasad.

  • Hi Prasad,

    The command to build tiboot3.bin (with as little excess as possible) would be:

    $ MACHINE=j784s4-evm bitbake -k tisdk-core-bundle

    Does your meta layer have a recipe that you can build? If you're not building a recipe from your meta layer, I don't know how your changes would be pulled in.

    Best,
    Jared

  • Hi Jared,

    We already have working meta layer and recipes, I just added uart patches entries and built the images.

    Can you give a try with above uart changes at your end and give some feedback?

    This case is continuous from below case.

    PROCESSOR-SDK-J784S4: MAIN UART receiving(RX) not working.

    Regards,

    Prasad 

  • Hi Prasad,

    Thank you for mentioning the other E2E thread.

    $ MACHINE=j784s4-evm bitbake -k tisdk-core-bundle

    I'd like to correct this statement. You should be able to run:

    MACHINE=j784s4-evm bitbake -k u-boot

    To add your patches, I would add a bbappend file to the u-boot recipe.

    Additionally, to remove optee from the the ATF build, you chould try setting the TFA_SPD field to "" in the trusted-firmware-a.inc. I have no idea what ramifications this would have on other systems though. 

    Best,
    Jared

  • Hello Jared,

    using below command, I was not able to regenerate any images.

    I have u-boot-ti-staging recipe to build my changes.

    MACHINE=j784s4-evm bitbake -k u-boot-ti-staging,

    Additionally, to remove optee from the the ATF build, you chould try setting the TFA_SPD field to "" in the trusted-firmware-a.inc.

    by default, it is set to empty. which means OPTEE is not part of tispl.bin? if yes we should not see any prints from OPTEE but still debug prints are coming from OPTEE image.

    below command I have used to build images.

    MACHINE=j784s4-evm bitbake -C compile tisdk-base-image

    Regards,

    Prasad.

  • Hi Prasad,

    The TFA_SPD is set to opteed else outside of the recipe. The ?= sets it if it hasn't been set already.

    MACHINE=j784s4-evm bitbake -C compile tisdk-base-image

    Did this build your desired image?

    Best,
    Jared

  • Hi Jared,

    I built all the individual components using below commands with wkup_uart0 changes.

    optee-os
    ----------

    MACHINE=j784s4-evm bitbake -C compile optee-os

    ATF

    ------

    MACHINE=j784s4-evm bitbake -C comiple trusted-firmware-a

    tispl.bin, u-boot.img

    -------------------------

    MACHINE=j784s4-evm bitbake -C compile u-boot-ti-staging

    but not sure similar yocto command for tiboot3.bin, for now i managed to build tiboot3.bin using below approach.

    firstly I removed my meta layer path entry in bblayaer.conf file and cleaned the build images using below command 

    MACHINE=j784s4-evm bitbake -c  cleansstate tisdk-base-image

    again I have added my meta layer entry and rebuilt the tiboot3.bin image using below command.

    MACHINE=j784s4-evm bitbake -C compile tisdk-base-image

    I could see all the wkup_uart0 changes are getting pulled from my meta layer during the build.

    after build, i copied images to sd card , but images are not booting.

    note: same wkup_uart0 changes are working in standalone build.

    Regards,

    Prasad.

  • Hi Prasad,

    Are there any error logs being printed?

    Additionally, can you try booting with the gp and hs-fs tiboot3.bin's? Rename the tiboot3*gp*.bin to tiboot3.bin and boot, then do the same with the tiboot3*hs-fs*.bin.

    Best,
    Jared