IMX8MP EVK Android Change to UART4 Console

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX8MP EVK Android Change to UART4 Console

1,493 Views
chrispeterson
Contributor IV

Hello,

In preparation for custom hardware, I want to switch the debug console from UART2 to UART4 on the iMX8M Plus EVK in Android 11 v2.6.0.   I was successful changing this with Yocto linux, however when I ported the changes over to Android, the devkit only boots to "Starting Kernel..." and then resets. As seen below.

 

U-Boot SPL 2021.04-dirty (May 05 2022 - 19:00:43 +0000)
DDRINFO: start DRAM init
DDRINFO: DRAM rate 4000MTS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
SEC0:  RNG instantiated
Normal Boot
WDT:   Not found!
Trying to boot from MMC2
NOTICE:  BL31: v2.4(release):automotive-11.0.0_2.5.0-0-g61a1ad5e5-dirty
NOTICE:  BL31: Built : 19:01:31, May  5 2022


U-Boot 2021.04-dirty (May 05 2022 - 19:00:43 +0000)

CPU:   i.MX8MP[8] rev1.1 1800 MHz (running at 1200 MHz)
CPU:   Commercial temperature grade (0C to 95C) at 34C
Reset cause: POR
Model: NXP i.MX8MPlus LPDDR4 EVK board
DRAM:  6 GiB
TCPC:  Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C2 0x50]
SNK.Power3.0 on CC1
PDO 0: type 0, 5000 mV, 3000 mA [E]
PDO 1: type 0, 9000 mV, 3000 mA []
PDO 2: type 0, 15000 mV, 3000 mA []
PDO 3: type 0, 20000 mV, 2250 mA []
Requesting PDO 3: 20000 mV, 2250 mA
Source accept request
PD source ready!
tcpc_pd_receive_message: Polling ALERT register, TCPC_ALERT_RX_STATUS bit failed, ret = -62
Power supply on USB2
TCPC:  Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C1 0x50]
MMC:   FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... *** Warning - bad CRC, using default environment

[*]-Video Link 0adv7535_mipi2hdmi adv7535@3d: Can't find cec device id=0x3c
fail to probe panel device adv7535@3d
fail to get display timings
probe video device failed, ret -19

        [0] lcd-controller@32e80000, video
        [1] mipi_dsi@32e60000, video_bridge
        [2] adv7535@3d, panel
adv7535_mipi2hdmi adv7535@3d: Can't find cec device id=0x3c
fail to probe panel device adv7535@3d
fail to get display timings
probe video device failed, ret -19
In:    serial
Out:   serial
Err:   serial

 BuildInfo:
  - ATF 61a1ad5

flash target is MMC:2
Net:   eth0: ethernet@30be0000, eth1: ethernet@30bf0000 [PRIME]
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot:  0
In boota get fastboot lock status error. Set lock status
Writing A/B metadata to disk.
 verify OK, boot 'boot_a'
Kernel load addr 0x40480000 size 28933 KiB
kernel   @ 40480000 (30670848)
ramdisk  @ 44680000 (29789589)
fdt      @ 42340400 (66082)
Moving Image from 0x40480000 to 0x40600000, end=42340000
## Flattened Device Tree blob at 42340400
   Booting using the fdt blob at 0x42340400
   Using Device Tree in place at 0000000042340400, end 0000000042353621
adv7535_mipi2hdmi adv7535@3d: Can't find cec device id=0x3c
fail to probe panel device adv7535@3d
fail to get display timings
probe video device failed, ret -19

Starting kernel ...

 

I have attached all the changes I have made in form of git diff patches.

In Yocto I also needed to modify optee-os with the UART config, however I did not find anything similar in the Android source tree.  The i.MX_Android_Security_User's_Guide.pdf does explain this process in section 3.2.5, but I cannot find the source for the Trusty os anywhere (I checked codeaurora as well). 

I did find vendor/nxp/fsl-proprietary/uboot-firmware/imx8m/tee-imx8mp.bin that, I believe, is the result of building the trusty os.  

Is there a way to get Android to boot using UART4?   What am I missing?

Thank you,

Chris

0 Kudos
8 Replies

1,480 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

This step will generate tee.bin, you can  check this step.

Qmiller_0-1652060346339.png

 

0 Kudos

1,474 Views
chrispeterson
Contributor IV

Hi @Zhiming_Liu 

Thank you for the help.  For those that may find this later, the relevant portion to get the Trusty OS code is in the Android User Guide section  8.6 Trusty OS/security configuration.

However, I rebuild after changing to use UART 4 and I am still getting the same issue where the devkit resets when trying to boot into the kernel.

Any other thoughts on why that could be?

Thank you for the help,

Chris

0 Kudos

1,469 Views
chrispeterson
Contributor IV

@Zhiming_Liu 

Using a Segger JTAG debugger and openocd, I am able to see that I am getting into the kernel and run some things in primary_entry.  But sometime after that the system crashes and resets.

I cannot seem to load the kernel symbols in gdb to debug the kernel.   uboot is working with

add-symbol-file u-boot 0x00000000bef04000

However, the following does not work with the kernel:

add-symbol-file ../KERNEL_OBJ/vmlinux 0x40600000

Appears as though the symbols are loaded at the wrong offset or something is not right.   When I attempt to set a breakpoint it give the address in the mapfile, not the proper offset address.

Any thoughts?

-Chris

0 Kudos

1,461 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport
0 Kudos

1,451 Views
chrispeterson
Contributor IV

@Zhiming_Liu 

Thank you for the link.   I am now able to debug the kernel when it gets into the virtual kernel space.

What I have found is that very soon after getting into start_kernel I am getting stuck at machine_restart.

Below is the start_kernel function

asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
{
	char *command_line;
	char *after_dashes;

	set_task_stack_end_magic(&init_task);
	smp_setup_processor_id();
	debug_objects_early_init();

I am unable to even get to the first function here before I get into machine_restart.

Any thoughts?

Is there a guide on how to change the UART console port for Android?

On a side note, I can load the Yocto Kernel using JTAG to the 0x40600000 memory location and it will boot and output to the console (though it does not complete booting since it does not have files in the correct location).

Thank you for the help,

Chris

 

0 Kudos

1,440 Views
chrispeterson
Contributor IV

@Zhiming_Liu 

I was mistaken.  I am able to get past the set_task_stack_end_magic and I am getting to just before boot_cpu_init when I am getting a el1_sync

At this point it processes through the following functions

  • el1_sync <-- called from interrupt vector
  • __swpan_entry_el1
  • el1_sync_handler
  • enter_from_kernel_mode
  • do_undefinstr
  • aarch32_break_handler
  • copy_from_kernel_nofault
  • call_undef_hook
  • _raw_spin_lock_irqsave
  • _raw_write_unlock_bh
  • _raw_spin_unlock_irqrestore
  • el1_sync <-- Called a second time from interrupt vector
  • __swpan_entry_el1
  • el1_sync_handler
  • arm64_enter_el1_dbg
  • do_debug_exception
  • early_brk64
  • bug_handler
  • report_bug
  • is_valid_bugaddr

At this point I let it resume and it got to machine_reset

Is the debug exception a result of me debugging improperly or is this attempting to tell me what went wrong?

-Chris

0 Kudos

1,430 Views
chrispeterson
Contributor IV

I figured out that the reason I was getting into the machine_reset from the el1_sync handler was that I never enable KGDB build option ( CONFIG_KGDB=y ).  I am now able to get further, however still having issues when attempting to debug.

If I set a breakpoint after early_security_init, I hit that breakpoint but any action I attempt results in the following error:

abort occurred - dscr = 0x03047d6f

-Chris

0 Kudos

1,424 Views
chrispeterson
Contributor IV

@Zhiming_Liu 

I have found that if I change to any other UART from the UART2 I am getting a reset when loading the kernel.   If I swap UART2 to different pins though the pinmux I can boot up into Android just fine.

Can you think of any reason why this would be?

Thank you,

Chris

0 Kudos