cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
769 Views
Registered: ‎01-07-2019

Infinite loop in the function FsblHandoffJtagExit after launching FSBL

Hi there,

 

I debugged the FSBL I built with XSDK and found it got stuck at labe "Loop" in function FsblHandoffJtagExit (in file fsbl_handoff.S).

FsblHandoffJtagExit
		mcr	 p15,0,r0,c7,c5,0		;/* Invalidate Instruction cache */
		mcr	 p15,0,r0,c7,c5,6		;/* Invalidate branch predictor array */

		dsb
		isb							;/* make sure it completes */

	ldr	r4, =0
		mcr	 p15,0,r4,c1,c0,0		;/* disable the ICache and MMU */

		isb							;/* make sure it completes */
Loop
	wfe
	b Loop

FsblHandoffExit
		mov	 lr, r0					;/* move the destination address into link register */

		mcr	 p15,0,r0,c7,c5,0		;/* Invalidate Instruction cache */
		mcr	 p15,0,r0,c7,c5,6		;/* Invalidate branch predictor array */

		dsb
		isb							;/* make sure it completes */

	ldr	r4, =0
		mcr	 p15,0,r4,c1,c0,0		;/* disable the ICache and MMU */

		isb							;/* make sure it completes */


		bx		lr					;/* force the switch, destination should have been in r0 */

.Ldone 
	b		.Ldone				;/* Paranoia: we should never get here */

	END


#else

Basically I want to boot Uboot by `HandoffAddress = LoadBootImage();` in main.c, but it cannot step over the line `FsblHandoffJtagExit();`.

I searched that the command `wfe` means waiting for an event. What's it? (All these codes of FSBL are automatically generated by Vivado and XSDK.)

Does anyone have points to it? Thanks a lot.

 

Best,

Jeremy

0 Kudos
5 Replies
Highlighted
Xilinx Employee
Xilinx Employee
718 Views
Registered: ‎09-01-2014

Re: Infinite loop in the function FsblHandoffJtagExit after launching FSBL


Please compiled FSBL with the symbol FSBL_DEBUG_INFO, then check the output log to see what address is assigned to Handoff Address.
If it’s incorrect, you can manually change it in the FSBL, something like “HandoffAddress = 0x00100000;”
0 Kudos
Highlighted
Visitor
Visitor
707 Views
Registered: ‎01-07-2019

Re: Infinite loop in the function FsblHandoffJtagExit after launching FSBL

Hi Ritakur,

Thanks for your reply. I enabled the option "FSBL_DEBUG_INFO" to get logs. And actually it has not reached the line to assign HandoffAddress a value. Calling function ' FsblHandoffJtagExit() ' is in front of calling 'HandoffAddress = LoadBootImage();'.

As shown in the following excerpt of main.c, it gets stuck  right after outputting "Before calling function FsblHandoffJtagExit()" to the UART terminal. The log "After calling function FsblHandoffJtagExit" doesn't appear..

	/*
	 * JTAG  BOOT MODE
	 */
	if (BootModeRegister == JTAG_MODE) {
		fsbl_printf(DEBUG_GENERAL,"Boot mode is JTAG\r\n");
		/*
		 * Stop the Watchdog before JTAG handoff
		 */
#ifdef	XPAR_XWDTPS_0_BASEADDR
		XWdtPs_Stop(&Watchdog);
#endif
		/*
		 * Clear our mark in reboot status register
		 */
		ClearFSBLIn();

		/*
		 * SLCR lock
		 */
		SlcrLock();
		fsbl_printf(DEBUG_GENERAL,"Before calling function FsblHandoffJtagExit() \r\n");
		FsblHandoffJtagExit();
		fsbl_printf(DEBUG_GENERAL,"After calling function FsblHandoffJtagExit \r\n");
	} else {
		...
	}

	fsbl_printf(DEBUG_INFO,"Flash Base Address: 0x%08lx\r\n", FlashReadBaseAddress);

	/*
	 * Check for valid flash address
	 */
	...
	/*
	 * This used only in case of E-Fuse encryption
	 * For image search
	 */
	SystemInitFlag = 1;

	/*
	 * Load boot image
	 */
	HandoffAddress = LoadBootImage();
	fsbl_printf(DEBUG_INFO,"(Load boot image) Handoff Address: 0x%08lx\r\n",HandoffAddress);
...

 

Using "Launch on Hardware (System Debugger)" by XSDK connected to board, I found that it was always running in the loop

FsblHandoffJtagExit:
		mcr	 15,0,r0,cr7,cr5,0		/* Invalidate Instruction cache */
		mcr	 15,0,r0,cr7,cr5,6		/* Invalidate branch predictor array */

		dsb
		isb					/* make sure it completes */

	ldr	r4, =0
		mcr	 15,0,r4,cr1,cr0,0		/* disable the ICache and MMU */

		isb					/* make sure it completes */
Loop:
	wfe
	b Loop

BTW, for some reason I use the Vivado 2016.4/XSDK. The board I use is Zybo-z7-20.

Did you have any idea? Thanks.

0 Kudos
Highlighted
Voyager
Voyager
499 Views
Registered: ‎05-25-2016

Re: Infinite loop in the function FsblHandoffJtagExit after launching FSBL

I have this exact same problem.  Why is the fsbl hitting this loop?  It seems that uboot will never launch because of this.

0 Kudos
Highlighted
411 Views
Registered: ‎07-05-2019

Re: Infinite loop in the function FsblHandoffJtagExit after launching FSBL

no one has a reply?

for me it stucks in a loop in DDynClk_SetRate.

the project is setting up Pcam-5C for zybo z7020 that am re-targetting on board zybo z7010.

 

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
387 Views
Registered: ‎02-01-2008

Re: Infinite loop in the function FsblHandoffJtagExit after launching FSBL

Is DDynClk_SetRate a fsbl function?

The FsblHandoffExit is supose to sit in a loop forever. Since bootmode is set to jtag, xsct will download fsbl, run it for a few seconds, then stop the cpu. These actions take place so that a scripted flow can use fsbl to initialize the PS by running ps7_init.

If you were booting from SD, qspi, or other physical boot device, then FsblHandoffJtagExit is not used, and instead the cpu will jump to the execution address of the first .elf that was loaded from boot.bin.

0 Kudos