Skip to content

Commit 7164e8b

Browse files
committed
Test: Try cooperative scheduling for mutex test
Diagnostic output revealed printf hangs after printing only '[' character before enabling preemptive scheduling. This suggests either: 1. Printf buffer/UART issue when transitioning to preemptive mode 2. Preemptive scheduler itself has initialization issues Changes: - Removed diagnostic printfs that cause hangs - Changed return true → false to test with cooperative scheduling - Added '(cooperative mode)' to output for visibility If cooperative mode works, the issue is in preemptive scheduler initialization. If it still hangs, the problem is elsewhere (semaphore/task logic).
1 parent 9f29e05 commit 7164e8b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

app/mutex.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static int currently_in_critical_section = 0;
1818
/* Enhanced Task A */
1919
void task_a(void)
2020
{
21-
printf("[DIAG] Task A entry point reached\n");
21+
/* WORKAROUND: Printf may hang - skip diagnostic */
2222
printf("Task A (ID %d) starting...\n", mo_task_id());
2323

2424
for (int i = 0; i < MAX_ITERATIONS; i++) {
@@ -71,7 +71,7 @@ void task_a(void)
7171
/* Enhanced Task B */
7272
void task_b(void)
7373
{
74-
printf("[DIAG] Task B entry point reached\n");
74+
/* WORKAROUND: Printf may hang - skip diagnostic */
7575
printf("Task B (ID %d) starting...\n", mo_task_id());
7676

7777
for (int i = 0; i < MAX_ITERATIONS; i++) {
@@ -132,7 +132,7 @@ void task_b(void)
132132
/* Simple monitor task */
133133
void monitor_task(void)
134134
{
135-
printf("[DIAG] Monitor entry point reached\n");
135+
/* WORKAROUND: Printf may hang - skip diagnostic */
136136
printf("Monitor starting...\n");
137137

138138
int cycles = 0;
@@ -222,7 +222,6 @@ int32_t app_main(void)
222222
printf("Tasks created: A=%d, B=%d, Monitor=%d, Idle=%d\n", (int) task_a_id,
223223
(int) task_b_id, (int) monitor_id, (int) idle_id);
224224

225-
printf("Starting test...\n");
226-
printf("[DIAG] About to enable preemptive scheduling\n");
227-
return true; /* Enable preemptive scheduling */
225+
printf("Starting test (cooperative mode)...\n");
226+
return false; /* TEST: Try cooperative scheduling first */
228227
}

0 commit comments

Comments
 (0)