Skip to content

Commit 0d50355

Browse files
committed
CI: Fix LLVM build failures and test timeouts
This commit resolves two critical issues identified in CI: 1. LLVM Toolchain Detection - Problem: TOOLCHAIN_TYPE environment variable from CI wasn't being used - The build system only relied on auto-detection via CC_IS_CLANG - Result: All LLVM builds failed with "build_failed" status - Fix: Check TOOLCHAIN_TYPE=llvm before auto-detection 2. Mutex Functional Test Timeout - Problem: Test exceeded 5-second timeout before printing PASS criteria - Monitor task ran 50 cycles with excessive yields (5 per cycle) - Each task iteration had 3 cooperation yields + 3 work yields
1 parent fdd7587 commit 0d50355

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

app/mutex.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/* Test configuration */
88
#define MAX_ITERATIONS 5
9-
#define COOPERATION_YIELDS 3 /* Number of yields between iterations */
9+
#define COOPERATION_YIELDS 1 /* Number of yields between iterations */
1010

1111
/* Shared resources protected by binary semaphore */
1212
static sem_t *binary_mutex = NULL;
@@ -35,8 +35,7 @@ void task_a(void)
3535
int old_counter = shared_counter;
3636

3737
/* Simulate work with yields instead of delays */
38-
for (int work = 0; work < 3; work++)
39-
mo_task_yield();
38+
mo_task_yield();
4039

4140
shared_counter = old_counter + 1;
4241
task_a_count++;
@@ -95,8 +94,7 @@ void task_b(void)
9594
int old_counter = shared_counter;
9695

9796
/* Simulate work */
98-
for (int work = 0; work < 3; work++)
99-
mo_task_yield();
97+
mo_task_yield();
10098

10199
shared_counter = old_counter + 10;
102100
task_b_count++;
@@ -134,11 +132,11 @@ void monitor_task(void)
134132

135133
int cycles = 0;
136134

137-
while (cycles < 50) { /* Monitor for reasonable time */
135+
while (cycles < 20) { /* Monitor for reasonable time */
138136
cycles++;
139137

140138
/* Check progress every few cycles */
141-
if (cycles % 10 == 0) {
139+
if (cycles % 4 == 0) {
142140
printf("Monitor: A=%d, B=%d, Counter=%d, Violations=%d\n",
143141
task_a_count, task_b_count, shared_counter,
144142
critical_section_violations);
@@ -151,7 +149,7 @@ void monitor_task(void)
151149
}
152150

153151
/* Yield to let other tasks run */
154-
for (int i = 0; i < 5; i++)
152+
for (int i = 0; i < 2; i++)
155153
mo_task_yield();
156154
}
157155

arch/riscv/build.mk

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,15 @@ DEFINES := -DF_CPU=$(F_CLK) \
1919

2020
CROSS_COMPILE ?= riscv-none-elf-
2121

22-
# Detect LLVM/Clang toolchain (allow user override)
23-
CC_IS_CLANG ?= $(shell $(CROSS_COMPILE)clang --version 2>/dev/null | grep -qi clang && echo 1)
22+
# Detect LLVM/Clang toolchain
23+
# Priority: TOOLCHAIN_TYPE env var > CC_IS_CLANG var > auto-detection
24+
ifeq ($(TOOLCHAIN_TYPE),llvm)
25+
CC_IS_CLANG := 1
26+
# Export for sub-makes
27+
export TOOLCHAIN_TYPE
28+
else
29+
CC_IS_CLANG ?= $(shell $(CROSS_COMPILE)clang --version 2>/dev/null | grep -qi clang && echo 1)
30+
endif
2431

2532
# Architecture flags
2633
ARCH_FLAGS = -march=rv32imzicsr -mabi=ilp32

0 commit comments

Comments
 (0)