I tried to follow the steps explained in document AN5137 to debug an application using u-boot, but every Bare Board application that I start with elfboot results with an undefined instruction error. The project I load is always the default project without any added code.
Here is the terminal results of the bootelf:
Hit any key to stop autoboot: 0
=> tftp 82000000 debug-core0.elf
Speed: 1000, full duplex
Using eTSEC1 device
TFTP from server 172.16.208.150; our IP address is 172.16.208.250
Filename 'debug-core0.elf'.
Load address: 0x82000000
Loading: T T ###########
13.7 KiB/s
done
Bytes transferred = 148367 (2438f hex)
=> bootelf
## Starting application at 0x8000027c ...
undefined instruction
pc : [<8000056c>] lr : [<8000054c>]
sp : 9fffaf9c ip : 00000004 fp : 9fffafec
r10: 800003ec r9 : bef24eb4 r8 : 00000001
r7 : 00000000 r6 : bef25db4 r5 : 00000000 r4 : 9fffafd4
r3 : 9fffafd4 r2 : 8000d0dc r1 : 8000d8f4 r0 : 8000d5a0
Flags: nZCv IRQs off FIQs off Mode SVC_32
Resetting CPU ...
resetting ...
Solved! Go to Solution.
This is because FPU is not enabled in u-boot from the latest released SDK for ls1021atwr, it is needed to enabled before running the elf file.
After u-boot sets up on the target board, please use Attach launch configuration to connect to the target board, then suspend the target, and open Debugger Shell from Window->Show View->Debugger Shell, then use the following commands to write related registers to enable FPU.
%>reg NSACR=0xc00
%>reg cpacr=0x0fffffff
%>reg fpexc=0x40000000
After resume u-boot running from CodeWarrior IDE, execute "bootelf" command under u-boot prompt.
Probably the application note needs to be modified.
Have a great day,
Yiping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I'm running this code on an LS1021A-TWR board if that helps.
Did you try to debug the application? Did you create the project created with UART I/O support? What version of CW for ARMv7 you used?
Adrian
I'm using CodeWarrior for QorIQ LS series ARM v7 ISA 10.0.6.
Debugging the project in CodeWarrior (eclipse) is no problem but using bootelf is ineffective. I did create the project with UART I/O support.
Hi,
As Adrian suggested above, please check if you used the UART I/O support or semihosting (in this last case the CW support is needed when you're running the application and the standalone running is not possible). When the application is running fine it prints out to the UART console or to CW console?
Thank you,
Marius
I did set up the project for UART I/O support, when the project is running in debug mode it prints to the UART console.
When you're running the project using CW there is any tcl initialization file set up? Maybe this is the trick..and this init file is making something that should be set up in the code as well.
Thank you,
Marius
There is a TCL file initiliazation set up when debugging. Is there a way to translate the TCL functionality into C code?
Also, a service request I sent told me that the same error was re-producible on their end. They figured out that the problem was caused by the library UART1_LS102xATWR_VFPv4.a. My current solution to running bootelf without issues is building the project with floating point setting at "none". They said that would get back to me with more information, so I'm still waiting for that.
Could you share the service request number?
Adrian
1-4008816561
This is because FPU is not enabled in u-boot from the latest released SDK for ls1021atwr, it is needed to enabled before running the elf file.
After u-boot sets up on the target board, please use Attach launch configuration to connect to the target board, then suspend the target, and open Debugger Shell from Window->Show View->Debugger Shell, then use the following commands to write related registers to enable FPU.
%>reg NSACR=0xc00
%>reg cpacr=0x0fffffff
%>reg fpexc=0x40000000
After resume u-boot running from CodeWarrior IDE, execute "bootelf" command under u-boot prompt.
Probably the application note needs to be modified.
Have a great day,
Yiping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you for getting back to me, the executable is running properly. I'm guessing the next SDK patch will account for this issue so that users don't have to attach and run debugger shell commands to get the executable running on bootelf.
Ok, good to know, thanks for sharing. Mostly that tcl file is by passing the FP issue setting up some core registers. Please wait for the final resolution.
Regards,
Marius