From 2e9921c5c3a28ec5d6733c1794d7f92bd24b1104 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sun, 23 Jan 2022 01:13:32 -0700 Subject: Free threads from memory after finishing --- src/boot.S | 3 +++ src/cpu/irq.c | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/boot.S b/src/boot.S index aedc957..e97ddcb 100644 --- a/src/boot.S +++ b/src/boot.S @@ -155,6 +155,9 @@ svc: ldr r3, =stacks_table mov r0, #0 strb r0, [r3, r1] + // Free the thread after freeing the stack + mov r0, r2 + bl free 1: ldmfd sp!, {r0-r12,pc}^ io_halt_prefetch: diff --git a/src/cpu/irq.c b/src/cpu/irq.c index 729a58d..830c1ba 100644 --- a/src/cpu/irq.c +++ b/src/cpu/irq.c @@ -77,6 +77,13 @@ void c_irq_handler(void) //_start(); // Trigger reset uart_scheduler(); //heap_info_u(); + } else if (data == 0x63) { + cmd[off] = (char) data; + off += 1; + //_start(); // Trigger reset + //uart_scheduler(); + heap_info(); + //heap_info_u(); // Else output } else { cmd[off] = (char) data; @@ -220,12 +227,12 @@ unsigned long c_fiq_handler(void) } else if (source & (1 << 3)) { c_timer(); counter++; - if (counter % 0x60 == 0) { + if (counter % 0x100 == 0) { add_thread(localtest, 0, 0); } else if (counter % 0x6000 == 0) { counter = 0; } - if (counter % 0x10 == 0) { + if (counter % 0x60 == 0) { //uart_scheduler(); return 1; } @@ -236,4 +243,5 @@ unsigned long c_fiq_handler(void) void localtest(void) { + uart_char('.'); } -- cgit v1.2.1