From d8b210c7f3d6603713b76d283ec5ceb5a2e0965d Mon Sep 17 00:00:00 2001 From: Tay Date: Sun, 12 Oct 2025 01:48:36 +0000 Subject: [PATCH 01/21] Increase amount of probes and overall timeout for DHCP. Makes DHCP on latent networks more stable. --- libxenon/drivers/network/network.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libxenon/drivers/network/network.c b/libxenon/drivers/network/network.c index 456acb2e..71eaee2b 100644 --- a/libxenon/drivers/network/network.c +++ b/libxenon/drivers/network/network.c @@ -64,10 +64,10 @@ void network_init() dhcp_wait=mftb(); int i = 0; - while (netif.ip_addr.addr==0 && i < 60) { + while (netif.ip_addr.addr==0 && i < 90) { network_poll(); now2=mftb(); - if (tb_diff_msec(now2, dhcp_wait) >= 250){ + if (tb_diff_msec(now2, dhcp_wait) >= 300){ dhcp_wait=mftb(); i++; if (i % 2) From d712cf6c66275dc4a00f599392f5f81b5e1606b4 Mon Sep 17 00:00:00 2001 From: Tay Date: Sun, 12 Oct 2025 16:59:03 +0000 Subject: [PATCH 02/21] Polish up crash handling input options --- libxenon/drivers/ppc/c_except.c | 47 ++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/libxenon/drivers/ppc/c_except.c b/libxenon/drivers/ppc/c_except.c index 6c30ee72..87c4d2b6 100644 --- a/libxenon/drivers/ppc/c_except.c +++ b/libxenon/drivers/ppc/c_except.c @@ -1,4 +1,6 @@ #include +#include +#include #include #include #include @@ -9,6 +11,7 @@ #include #include #include +#include #define CPU_STACK_TRACE_DEPTH 10 @@ -76,7 +79,8 @@ void crashdump(u32 exception,u64 * context) console_set_colors(0x000080ff, 0xffffffff); console_init(); console_clrscr(); - + telnet_console_init(); + if (exception){ sprintf(text,"\nException vector! (%p)\n\n",exception); }else{ @@ -99,23 +103,52 @@ void crashdump(u32 exception,u64 * context) _cpu_print_stack((void*)(u32)context[36],(void*)(u32)context[32],(void*)(u32)context[1]); - strcat(text,"\n\nOn uart: 'x'=Xell, 'h'=Halt, 'r'=Reboot\n\n"); + strcat(text,"\n\nOn uart or telnet: 'x'=Xell, 'h'=Halt, 'r'=Reboot\n"); + strcat(text,"On controller: 'x'=Xell, 'y'=Halt, 'b'=Reboot\n"); flush_console(); + // Initialize 360 controller - taken from XeLL kbootconf.c + struct controller_data_s ctrl; + struct controller_data_s old_ctrl; + for(;;){ - switch(getch()){ - case 'x': + // Handle controller + if (get_controller_data(&ctrl, 0)) { + if (ctrl.x > old_ctrl.x){ exit(0); + for(;;); break; - case 'h': + } else if (ctrl.y > old_ctrl.y){ xenon_smc_power_shutdown(); for(;;); break; - case 'r': + } else if (ctrl.b > old_ctrl.b) xenon_smc_power_reboot(); for(;;); break; - } + old_ctrl=ctrl; + } + + usb_do_poll(); + + // Handle telnet or UART + if(kbhit()){ + switch(getch()){ + case 'x': + // Try reloading XeLL from NAND. (1f, 2f, gggggg) + // Platform specific functioanlity defined in libxenon/drivers/newlib/xenon_syscalls.c + exit(0); + break; + case 'h': + xenon_smc_power_shutdown(); + for(;;); + break; + case 'r': + xenon_smc_power_reboot(); + for(;;); + break; + } + } } } From 43c71c9ba2eba64677cf779a3e17671a5b494ff7 Mon Sep 17 00:00:00 2001 From: Tay Date: Sun, 12 Oct 2025 17:05:34 +0000 Subject: [PATCH 03/21] Print network config and init network for telnet handling. --- libxenon/drivers/ppc/c_except.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libxenon/drivers/ppc/c_except.c b/libxenon/drivers/ppc/c_except.c index 87c4d2b6..1d4a016b 100644 --- a/libxenon/drivers/ppc/c_except.c +++ b/libxenon/drivers/ppc/c_except.c @@ -12,6 +12,7 @@ #include #include #include +#include #define CPU_STACK_TRACE_DEPTH 10 @@ -112,6 +113,10 @@ void crashdump(u32 exception,u64 * context) struct controller_data_s ctrl; struct controller_data_s old_ctrl; + // For telnet handling + network_init(); + network_print_config(); + for(;;){ // Handle controller if (get_controller_data(&ctrl, 0)) { @@ -131,6 +136,7 @@ void crashdump(u32 exception,u64 * context) } usb_do_poll(); + network_poll(); // Handle telnet or UART if(kbhit()){ From e72d1b168ff9600a212aca88037c3e9fd212aeb3 Mon Sep 17 00:00:00 2001 From: Tay Date: Sun, 12 Oct 2025 17:19:16 +0000 Subject: [PATCH 04/21] Telnet handling is too unstable working only sometimes under certain conditions. Removing but leaving working controller handling. --- libxenon/drivers/ppc/c_except.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libxenon/drivers/ppc/c_except.c b/libxenon/drivers/ppc/c_except.c index 1d4a016b..aa335918 100644 --- a/libxenon/drivers/ppc/c_except.c +++ b/libxenon/drivers/ppc/c_except.c @@ -80,7 +80,6 @@ void crashdump(u32 exception,u64 * context) console_set_colors(0x000080ff, 0xffffffff); console_init(); console_clrscr(); - telnet_console_init(); if (exception){ sprintf(text,"\nException vector! (%p)\n\n",exception); @@ -112,10 +111,6 @@ void crashdump(u32 exception,u64 * context) // Initialize 360 controller - taken from XeLL kbootconf.c struct controller_data_s ctrl; struct controller_data_s old_ctrl; - - // For telnet handling - network_init(); - network_print_config(); for(;;){ // Handle controller @@ -136,9 +131,8 @@ void crashdump(u32 exception,u64 * context) } usb_do_poll(); - network_poll(); - // Handle telnet or UART + // Handle UART if(kbhit()){ switch(getch()){ case 'x': From af6d694b18601b91657fb4b9b45d391f5e73e406 Mon Sep 17 00:00:00 2001 From: Tay Date: Sun, 12 Oct 2025 17:19:46 +0000 Subject: [PATCH 05/21] Telnet handling is too unstable working only sometimes under certain conditions. Removing but leaving working controller handling. --- libxenon/drivers/ppc/c_except.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libxenon/drivers/ppc/c_except.c b/libxenon/drivers/ppc/c_except.c index aa335918..e5c3c9dc 100644 --- a/libxenon/drivers/ppc/c_except.c +++ b/libxenon/drivers/ppc/c_except.c @@ -12,7 +12,6 @@ #include #include #include -#include #define CPU_STACK_TRACE_DEPTH 10 From 20cf4fec13dc774b2c577d4ba5b981ceeeed3a05 Mon Sep 17 00:00:00 2001 From: Tay Date: Sun, 12 Oct 2025 17:46:41 +0000 Subject: [PATCH 06/21] simplyify controller handling --- libxenon/drivers/ppc/c_except.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libxenon/drivers/ppc/c_except.c b/libxenon/drivers/ppc/c_except.c index e5c3c9dc..fd1cad20 100644 --- a/libxenon/drivers/ppc/c_except.c +++ b/libxenon/drivers/ppc/c_except.c @@ -114,20 +114,21 @@ void crashdump(u32 exception,u64 * context) for(;;){ // Handle controller if (get_controller_data(&ctrl, 0)) { - if (ctrl.x > old_ctrl.x){ + if (ctrl.x){ exit(0); for(;;); break; - } else if (ctrl.y > old_ctrl.y){ + } if (ctrl.y){ xenon_smc_power_shutdown(); for(;;); break; - } else if (ctrl.b > old_ctrl.b) + } if (ctrl.b){ xenon_smc_power_reboot(); for(;;); break; + } old_ctrl=ctrl; - } + } usb_do_poll(); From 263fb9b8eff8de9c49aeafc5fef11e26e665f5db Mon Sep 17 00:00:00 2001 From: Tay Date: Tue, 14 Oct 2025 02:28:38 +0000 Subject: [PATCH 07/21] Figured out why telnet was not working reliably - receive was disabled but transmit was enabled. Re-enabled receive buffer and pushing this after testing with it. --- libxenon/drivers/console/telnet_console.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libxenon/drivers/console/telnet_console.c b/libxenon/drivers/console/telnet_console.c index a3c4df58..e9b6a692 100644 --- a/libxenon/drivers/console/telnet_console.c +++ b/libxenon/drivers/console/telnet_console.c @@ -146,7 +146,6 @@ unsigned char recv_buf[512]; /*===========================================================================*/ static err_t telnet_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) { -#if 0 if (err == ERR_OK && p != NULL) { unsigned char * payload = (unsigned char*) p->payload; @@ -178,7 +177,6 @@ static err_t telnet_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t e if (err == ERR_OK && p == NULL) { telnet_close(pcb); } -#endif return ERR_OK; } From af94d2c3e2570e0f7aad62a7f1c06f80773d4047 Mon Sep 17 00:00:00 2001 From: Tay Date: Tue, 14 Oct 2025 02:30:33 +0000 Subject: [PATCH 08/21] Remove undefined reference --- libxenon/drivers/console/telnet_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libxenon/drivers/console/telnet_console.c b/libxenon/drivers/console/telnet_console.c index e9b6a692..2c09da18 100644 --- a/libxenon/drivers/console/telnet_console.c +++ b/libxenon/drivers/console/telnet_console.c @@ -163,7 +163,7 @@ static err_t telnet_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t e if (recv_len > 2) { if ((recv_buf[recv_len - 2] == '\r')&(recv_buf[recv_len - 1] == '\n')) { - ParseArgs(recv_buf, recv_len); + //ParseArgs(recv_buf, recv_len); //DebugBreak(); //tel_tx_str(recv_buf, recv_len); //efface From 6484919ff9482a697f2cf9650efc38792bf89a11 Mon Sep 17 00:00:00 2001 From: Tay Date: Tue, 14 Oct 2025 23:30:28 +0000 Subject: [PATCH 09/21] Re-enable telnet. Add receive echo. --- libxenon/drivers/console/telnet_console.c | 5 +++-- libxenon/drivers/ppc/c_except.c | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libxenon/drivers/console/telnet_console.c b/libxenon/drivers/console/telnet_console.c index 2c09da18..f44d5de4 100644 --- a/libxenon/drivers/console/telnet_console.c +++ b/libxenon/drivers/console/telnet_console.c @@ -166,9 +166,10 @@ static err_t telnet_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t e //ParseArgs(recv_buf, recv_len); //DebugBreak(); //tel_tx_str(recv_buf, recv_len); - //efface + // Echo char + telnet_console_tx_print(recv_buf, recv_len); recv_len = 0; - memset(recv_buf, 0, 512); + memset(recv_buf, 0, 512); // clear } } } diff --git a/libxenon/drivers/ppc/c_except.c b/libxenon/drivers/ppc/c_except.c index fd1cad20..3073ba5b 100644 --- a/libxenon/drivers/ppc/c_except.c +++ b/libxenon/drivers/ppc/c_except.c @@ -79,6 +79,7 @@ void crashdump(u32 exception,u64 * context) console_set_colors(0x000080ff, 0xffffffff); console_init(); console_clrscr(); + telnet_console_init(); if (exception){ sprintf(text,"\nException vector! (%p)\n\n",exception); From 9d9a8b900cac633adcaeb258c91d63bdc73ae216 Mon Sep 17 00:00:00 2001 From: Tay Date: Tue, 14 Oct 2025 23:49:06 +0000 Subject: [PATCH 10/21] Cleaning up compiler warnings. --- libxenon/drivers/elf/elf.c | 1 + libxenon/drivers/xenon_nand/xenon_sfcx.c | 1 + libxenon/drivers/xenon_soc/xenon_power.h | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libxenon/drivers/elf/elf.c b/libxenon/drivers/elf/elf.c index 1b981fa0..0d801e47 100644 --- a/libxenon/drivers/elf/elf.c +++ b/libxenon/drivers/elf/elf.c @@ -18,6 +18,7 @@ see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt #include