Issue booting both M4 and A7

When I run the ubiboot after booting M4 I get the log:

Colibri iMX7 # run ubiboot                                                                                     
Booting from NAND...                                                                                           
ubi0: default fastmap pool size: 200                                                                           
ubi0: default fastmap WL pool size: 100                                                                        
ubi0: attaching mtd5                                                                                           
ubi0: attached by fastmap                                                                                      
ubi0: fastmap pool size: 200                                                                                   
ubi0: fastmap WL pool size: 100                                                                                
ubi0: attached mtd5 (name "ubi", size 508 MiB)                                                                 
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes                                                 
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048                                                  
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096                                                
ubi0: good PEBs: 4052, bad PEBs: 12, corrupted PEBs: 0                                                         
ubi0: user volume: 4, internal volumes: 1, max. volumes count: 128                                             
ubi0: max/mean erase counter: 99/39, WL threshold: 4096, image sequence number: 1053277079                     
ubi0: available PEBs: 0, total reserved PEBs: 4052, PEBs reserved for bad PEB handling: 68                     
No size specified -> Using max size (5937640)                                                                  
Read 5937640 bytes from volume kernel to 81000000                                                              
No size specified -> Using max size (46670)                                                                    
Read 46670 bytes from volume dtb to 82000000                                                                   
Kernel image @ 0x81000000 [ 0x000000 - 0x5a99e8 ]                                                              
## Flattened Device Tree blob at 82000000                                                                      
   Booting using the fdt blob at 0x82000000                                                                    
   Using Device Tree in place at 82000000, end 8200e64d                                                        
   Updating MTD partitions...      

Starting kernel ...                                                                                            

This happens on both Linix versions 3.04 and 5.

I tried
Colibri iMX7 # setenv fdt_fixup 'fdt addr ${fdt_addr_r} && fdt rm /soc/aips-bus@30800000/spba-bus@30800000/serial@30890000' Colibri iMX7 # saveenv

but it is no use.

At first It seemed as an issue with the RPMsg, however the issue happens even without using it.

Hi, @Ilan_Figueiredo ,

You didn’t mention what your issue exactly is. Do you mean no response from kernel past the Starting kernel ... message? Please mention it next time.
Well, it heavily depends on your M4 code. If it would touch just serial port, which you removed with fdt_fixup, then kernel certainly would boot, unless serial port you removed is main kernel serial console. Try from simpler things. Try booting just A7 each time you modify fdt_fixup. If that works without M4, then add for(;;){} loop at top of your M4’s main() routine. Try booting M4 along with A7 Linux. Certainly Linux should work when none of peripherals Linux uses are touched by M4. Move your for(;:wink: down enabling more M4 setup. You need to identify which used by M4 resource breaks A7 Linux.

I tested every submodule of the M4 program and, if the problem in fact RDC, the 2 instances that could be breaking the Linux are:

    RDC_SetPdapAccess(RDC, rdcPdapGpio7, 3 << (BOARD_DOMAIN_ID * 2), false, false);
    RDC_SetPdapAccess(RDC, rdcPdapGpio2, 3 << (BOARD_DOMAIN_ID * 2), false, false);

And yes, Linux stops after the Starking Kernel …

There is no kernel panic message tho.

I just tested each line by itself in the M4 and they seem to be the culprits.

Well, with these calls you should disable for Linux as well whole Gpio7 and whole Gpio2.
If Linux indeed needs some pins from these gpios, then you should instead just RDC_SEMAPHORE_Lock(rdcPdapGpio7) and RDC_SEMAPHORE_Unlock(rdcPdapGpio7) before and after each access to Gpio7 registers. Linux part will do the same in Gpio driver.

Well, solution will be fixing the device tree.

iMX7 device tree specifies aliases{} for gpios. So just edit fdt_fixup and add at the end && fdt rm gpio1 && fdt rm gpio6. Aliases, if you look at imx7s.dtsi, are one less than real iMX gpio number, that’s why 1 and 6.