Open neuschaefer opened 1 year ago
Hi,
By using the correct JTAG pins with nuc910 as target with openocd seem work and correctly reset the CPU :
# openocd -f interface/raspberrypi-native.cfg -f target/nuc910.cfg -c "adapter_khz 1000"
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Warn : TMS/SWDIO moved to GPIO 8 (pin 24). Check the wiring please!
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
nuc910.cpu
DEPRECATED! use 'adapter speed' not 'adapter_khz'
adapter speed: 1000 kHz
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : clock speed 1000 kHz
Info : JTAG tap: nuc910.cpu tap/device found: 0x07926f0f (mfg: 0x787 (<unknown>), part: 0x7926, ver: 0x0)
Info : Embedded ICE version 6
Info : nuc910.cpu: hardware has 2 breakpoint/watchpoint units
Info : starting gdb server for nuc910.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x60000013 pc: 0xc00281b8
MMU: enabled, D-Cache: enabled, I-Cache: enabled
But i got an error with bootscript.elf :
# gdb-multiarch ./bootscript.elf
GNU gdb (GDB) 14.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "armv7-alpine-linux-musleabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./bootscript.elf...
(No debugging symbols found in ./bootscript.elf)
(gdb) target extended-remote localhost:3333
Remote debugging using localhost:3333
0xc0027c18 in ?? ()
(gdb)
Do you have an idea what is going wrong ?
Hey, nice to see that the NUC910 config seems to work!
bootscript.elf
is just a container to hold some text (the bootscript), so gdb is right that it doesn't find symbols in that. If you want to debug the monitor, you'll need to use monitor.elf
. You might also have to add -g
or something to the CFLAGS
.
Yes, thanks. That work fine now with monitor.elf.
That little bit tricky with openocd.
So the only i found is :
openocd # Run openocd
telnet localhost 4444 # Run soft_reset_halt & exit
# kill openocd
openocd # Start again
./gdb.sh # monitor.elf is execute on the CPU
I don't known if is link to the fact i use an RPI as JTAG programmer and non welded cables.
But i cannot halt
during the boot, only after few minutes when is ready.
I cannot do a reset halt
at all.
I mostly need to restart openocd, result as many timeouts.
I don't known, if you can confirm the same behavior on your side ?
I cross check JTAG connections that my conclusion :
J_IBMC_JTAG
2 20
() () () () () () () () () () () () () () () () () () ()
[] () () () () () () () () () () () () () () () () () ()
pin | function |
---|---|
1 | VTref (3.3V) |
2 | VCC (3.3V) |
3 | TRST (Used) |
4 | GND (Used) |
5 | TDI (Used) |
6 | GND (Seem NC) |
7 | TMS/SWDIO |
8 | GND (Seem NC) |
9 | TCK/SWCLK |
10 | GND (Seem NC) |
11 | NC (Not check) |
12 | GND (Seem NC) |
13 | TDO/SWO |
14 | GND (Seem NC) |
15 | RESET |
16 | GND (Seem NC) |
17 | NC (Not check) |
18 | GND (Seem NC) |
19 | NC (Not check) |
20 | GND (Seem NC) |
./gdb.sh output :
# ./gdb.sh
GNU gdb (GDB) 14.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "armv7-alpine-linux-musleabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from monitor.elf...
Remote debugging using localhost:3333
0x00000000 in _start ()
Undefined command: "". Try "help".
Loading section .text, size 0xce8 lma 0x0
Loading section .rodata, size 0x45c lma 0xce8
Loading section .bootscript, size 0x188 lma 0x1800
Loading section .data, size 0x1 lma 0x1988
Start address 0x00000000, load size 4813
Transfer rate: 12 KB/sec, 1203 bytes/write.
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x0000044c in uart_rx () at monitor.c:43
warning: 43 monitor.c: No such file or directory
(gdb) q
A debugging session is active.
Inferior 1 [Remote target] will be detached.
Quit anyway? (y or n) y
Detaching from program: /root/monitor.elf, Remote target
[Inferior 1 (Remote target) detached]
UART output :
Jan 1 00:00:15 (none) kernel: NET: Registered protocol family 10
Jan 1 00:00:15 (none) kernel: start init aess_mem_driver
Jan 1 00:00:15 (none) kernel: finish init aess_mem_driver
Starting debug for AIMLIB-ipmiSystemCallAgent
aim_init() - szComponentName:ipmiSystemCallAgent ulProgNum:536872532
rpcCallbackService() - calling svc_run to wait for rpc callbacks for socket:/tmp/rpSocketCB536872532 in thread ID: 16386 process ID: 420
Press any key to avoid running the default boot script
Run test...
Loading Linux...
Exception 04, Undefined
> rst
>
U-Boot 1.2.0 (Jul 29 2014 - 17:19:26) Avocent (1.13.8) Whoville
Board: WPCM450_01
DRAM: 128 MB
Flash: 2 MB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
MMC: 12 MHz 1 GB
*** no Avocent signature found ***
Net: LOM0 Gb1
Hit any key to stop autoboot: 0
*** previous boot was failed, retry=01 ***
Copying kernel image ... Press any key to avoid running the default boot script
Run test...
Loading Linux...
Exception 04, Undefined
>
You can find my config environment on https://github.com/OpeniDrac/wpcm450-openocd
I'll investigate this when I get around to it (hopefully this weekend, no guarantee though, sorry!). I have a few Dell boards with JTAG headers.
I've managed to connect to the JTAG port, but I'm still exploring how to do resets with my adapter (Glasgow + OpenOCD)
I got it to work somewhat well today, but then it stopped working, probably for electrical reasons (I'll re-check my connections when I get around to it).
I had to use reset_config trst_and_srst combined
in my openocd scripts. Afterwards I was able to do this in gdb:
monitor reset halt # execute "reset halt" in openocd
load monitor.elf # with a patch to add debug symbols, which I'm going to push soon
b main # set breakpoints
c # run
si # step, etc.
I had petty bad performance, it took several seconds for a single step (si
), but OpenOCD printed a warning that this might be because I forgot to tell OpenOCD about the adapter speed.
@StidOfficial unfortunately, I haven't had much success with OpenOCD + GDB either. I get lots of weird errors, UART output doesn't seem to work, etc.
Ok, for me that work fine but i still need always to restart openocd after halting the CPU. I try too to test with SWD but that seem need to be implemented in openocd as only jtag from GPIO is supported.
I try to run the latest Linux, but i have some issue with the DTB. As i understand, now is mandatory to include the DTB with the kernel. So i concat both together with :
cat arch/arm/boot/Image arch/arm/boot/dts/nuvoton/nuvoton-wpcm450.dtsi > newImage
mkimage -A ARM -O linux -T kernel -C none -a 8000 -e 8000 -n "arm-linux" -d newImage uImage
When i launch from u-boot, i got this error :
[uboot_wpcm450]# dhcp
...
[uboot_wpcm450]# set serverip XXX.XXX.XXX.XXX
[uboot_wpcm450]# tftp
...
[uboot_wpcm450]# bootm 01000000
## Booting image at 01000000 ...
Image Name: arm-linux
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 12278965 Bytes = 11.7 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
OK
Starting kernel ...
Error: invalid dtb and unrecognized/unsupported machine ID
r1=0x000003eb, r2=0x00000100
r2[]=05 00 00 00 01 00 41 54 00 00 00 00 00 00 00 00
Available machine support:
ID (hex) NAME
ffffffff Generic DT based system
ffffffff WPCM450 chip
Please check your kernel config and/or bootloader.
When i run the kernel arch/arm/boot/Image
directly from openocd :
Error: unrecognized/unsupported processor variant (0xeb00004e).
Did you known what i'am doing wrong or this variant is not declared in Linux code ? How did you validate your kernel implementations ?
cat arch/arm/boot/Image arch/arm/boot/dts/nuvoton/nuvoton-wpcm450.dtsi > newImage
You can't do that, because it's not a DTB:
See for example arch/arm/boot/dts/nuvoton/nuvoton-wpcm450-supermicro-x9sci-ln4f.dts
and the corresponding dtb that is built along with the kernel.
To build the final bootable image, I use this command:
cat arch/arm/boot/zImage arch/arm/boot/dts/nuvoton-wpcm450-supermicro-x9sci-ln4f.dtb > zImage-dtb
cat zImage dtb > zImage-dtb
can be used to provide a DTB, but only if the feature is enabled. The necessary option is CONFIG_ARM_APPENDED_DTB.Error: invalid dtb and unrecognized/unsupported machine ID
The kernel didn't find a DTB, so it requires a machine ID that it recognizes. Machine IDs are the legacy way of telling ARM Linux what kind of board it's running on.
Error: unrecognized/unsupported processor variant (0xeb00004e).
That looks a bit like an ARM instruction that got mistaken for a processor type somehow… Not sure what went wrong here. I've never seen this error (but I've also never tried to load a kernel with openocd).
Thanks for your quick reply and clear explanation, i try and understand this morning how is work.
So i basically do what you told me :
diff --git a/arch/arm/boot/dts/nuvoton/Makefile b/arch/arm/boot/dts/nuvoton/Makefile
index 89c157dad..d51206354 100644
--- a/arch/arm/boot/dts/nuvoton/Makefile
+++ b/arch/arm/boot/dts/nuvoton/Makefile
@@ -6,4 +6,5 @@ dtb-$(CONFIG_ARCH_NPCM7XX) += \
nuvoton-npcm750-evb.dtb \
nuvoton-npcm750-runbmc-olympus.dtb
dtb-$(CONFIG_ARCH_WPCM450) += \
- nuvoton-wpcm450-supermicro-x9sci-ln4f.dtb
+ nuvoton-wpcm450-supermicro-x9sci-ln4f.dtb \
+ nuvoton-wpcm450-dell-idrac6.dtb
diff --git a/arch/arm/configs/wpcm450_defconfig b/arch/arm/configs/wpcm450_defconfig
index 45483deab..84c51ae99 100644
--- a/arch/arm/configs/wpcm450_defconfig
+++ b/arch/arm/configs/wpcm450_defconfig
@@ -15,7 +15,8 @@ CONFIG_ARCH_WPCM450=y
CONFIG_CPU_DCACHE_WRITETHROUGH=y
CONFIG_AEABI=y
CONFIG_UACCESS_WITH_MEMCPY=y
-# CONFIG_ATAGS is not set
+CONFIG_ATAGS=y
+CONFIG_ARM_ATAG_DTB_COMPAT=y
CONFIG_ARM_APPENDED_DTB=y
CONFIG_CPU_IDLE=y
CONFIG_KPROBES=y
Now i can boot with dhcp; set serverip XXX.XXX.XXX.XXX; tftp; setenv bootargs root=/dev/mmcblk0p2 mem=112M; bootm 01000000
.
I don't known why but console=tty0
and console=ttyS0
doesn't give any Kernel output.
However the Kernel doesn't fully boot and seem crash without stack-trace.
You can load the kernel with load_image /home/user/linux/zImage-dtb
but i need to find how pass kernel arguments.
- nuvoton-wpcm450-dell-idrac6.dtb
Yes, that's a good start, but what's in nuvoton-wpcm450-dell-idrac6.dts
?
+CONFIG_ATAGS=y +CONFIG_ARM_ATAG_DTB_COMPAT=y
Not sure you need the ATAGS options. I think they should be uncessary if you supply a good devicetree.
I don't known why but console=tty0 and console=ttyS0 doesn't give any Kernel output.
tty0
would be the graphical console (and WPCM450 doesn't have a graphical output that it can reliably use), console=ttyS0
should work (but see below).
I have a few ideas:
console=ttyS0,115200n8
) or in the /chosen/stdout-path
devicetree node (see the supermicro devicetree; note that serial0 is resolved via /aliases)keep_bootcon
or something might helpYes, that's a good start, but what's in nuvoton-wpcm450-dell-idrac6.dts?
Not sure you need the ATAGS options. I think they should be uncessary if you supply a good devicetree.
I get the error no ATAGS support: can't continue
when i boot on Linux. I don't known if is mandatory to use a latest u-boot version or if i can something elese like using monitor
.
the kernel might be mis-configuring the serial port with the wrong baudrate
Yes, he use the wrong baudrate. But your supermicro dts use the good baudrate too.
keep_bootcon or something might help
That work too
the timer interrupts might not be firing or something
If you see in output logs, he fail to get the clock, i don't known if that as an impact :
[ 0.000000] /soc/timer@b8001000: Failed to get clock for timer1: -ENOENT
EDIT :
I finally found the issue, i don't known why but Linux is too fast for u-boot so i can't clearly see the Kernel panic.
Now i use only go
command to debug linux.
[ 3.020000] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Ah, you don't seem to have provided any root file system.
Root FSes can be provided in the form of block devices (root=/dev/mmcblk0p1
or something), or as a initramfs (see CONFIG_INITRAMFS_SOURCE
and surrounding options)