OpenNuvoton / NUC970_U-Boot_v2016.11

U-Boot v2016.11 for NUC970, N9H30, and NUC980
28 stars 45 forks source link

console history is broken #19

Closed lightelf76 closed 4 years ago

lightelf76 commented 5 years ago

Command history in U-Boot console is broken, "Arrow-Up" key does weird things. Can be reproduced with nuc970_tomato_defconfig. PS. It seems like more general RAM handling issue present. Attempt to execute more or less complex script hangs the board.

yachen commented 5 years ago

Yup. We can reproduce this issue. Will look into it, thanks.

lightelf76 commented 4 years ago

I see another problem, probably related. Custom board with custom config (I think, it's just happens to trigger some memory corruption bug in U-Boot). IP address not set or explicitly set to 0.0.0.0 and printenv confirms that no ipaddr variable or it's value is zero. But if I start dhcp/bootp, I see (on wire) DISCOVER packets with source IP set to 255.223.127.255. DHCP packet body itself is correct.

lightelf76 commented 4 years ago

Just to note: I did U-Boot build with GCC 7.3.0 compiler https://toolchains.bootlin.com/releases_armv5-eabi.html, result exactly same

yachen commented 4 years ago

Hi, About the error key issue, what hardware are you using? We're seeing that some VCOM connector can decode up-arrow correctly but some can't. Still trying to figure what goes wrong.

lightelf76 commented 4 years ago

Hi, I use USB-UART converter based on CH340E chip for my custom boards and NK-Tomato with on-board USB-UART. Software used is PuTTY/Windows7-x64. Same HW and SW works well in kernel command-line, so it's very unlikely related to VCOM/host drivers.

lightelf76 commented 4 years ago

I see the reason, but still do not understand the roots. It seems like u-boot relocation broken. Some references are relocated and some are not. Example: Within /net/net.c file we have variable net_ip (ip of the board) and a number of references to it. I put a lot of printf statements at all places, where variable accessed to see, what is a variable address used at that place. Result is surprising: ` => bdinfo

arch_number = 0x00000000

boot_params = 0x00000100

DRAM bank = 0x00000000

-> start = 0x00000000

-> size = 0x04000000

eth0name = emac

ethaddr = 80:1f:12:51:31:27

current eth = emac

ip_addr =

baudrate = 115200 bps

relocaddr = 0x03F94000

reloc off = 0x01F94000

irq_sp = 0x03E83EF0

sp start = 0x03E83EE0

=> dhcp

KSZ8895 init done..

net_loop, line: 459, net_ip: 3ff874c

BOOTP broadcast 1

net_set_udp_header, line: 1465, net_ip: 206474c

net_process_received_packet, line: 1171, net_ip: 3ff874c

` As you can see, functions "net_loop" and "net_process_received_packet" uses relocated address 0x3ff874c to access variable ip_addr, but function "net_set_udp_header" uses not relocated address 0x206474c. So packets sent to network filled with some garbage instead of ip address.

yachen commented 4 years ago

Hi,

I'd like to clarify if we're seeing the same UART up-arrow input history corrupt issue. Can you modify baudrate setting in serial_nuc970.c from 0x30000066 to 0x30000065 and see if the problem is gone? After this mod, the up-arrow works find on my board now. (Still need to check why setting an slightly inaccurate baudrate help though)

Sincerely,

Yi-An Chen

lightelf76 commented 4 years ago

Tested with changed baudrate. Nothing changed, arrow-up still does not work as expected. Btw, what is a GCC/LD version you use? I did with: ` => version

U-Boot 2016.11-g862a113-dirty (Aug 07 2019 - 14:16:36 +0300) arm-linux-gcc (GCC) 4.8.4 GNU ld (GNU Binutils) 2.24 `

yachen commented 4 years ago

We're seeing different issue than. Below is my u-boot/tool version. U-Boot 2016.11-g3ac85d0-dirty arm-linux-gcc: 4.8.4 arm-linux-ld: 2.24

Use make distclean and rebuild using nuc970_tomato_defconfig, u-boot works fine on Tomato board.

lightelf76 commented 4 years ago

Seems like I have two unrelated troubles. Broken console history is annoying, but not so important. Broken relocations (caused by I2C driver code) more important. Thanks.