Skip to content

Commit a4f2b4e

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 a4f2b4e

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

app/mutex.c

Lines changed: 6 additions & 6 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,7 +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++)
38+
for (int work = 0; work < 2; work++)
3939
mo_task_yield();
4040

4141
shared_counter = old_counter + 1;
@@ -95,7 +95,7 @@ void task_b(void)
9595
int old_counter = shared_counter;
9696

9797
/* Simulate work */
98-
for (int work = 0; work < 3; work++)
98+
for (int work = 0; work < 2; work++)
9999
mo_task_yield();
100100

101101
shared_counter = old_counter + 10;
@@ -134,11 +134,11 @@ void monitor_task(void)
134134

135135
int cycles = 0;
136136

137-
while (cycles < 50) { /* Monitor for reasonable time */
137+
while (cycles < 30) { /* Monitor for reasonable time */
138138
cycles++;
139139

140140
/* Check progress every few cycles */
141-
if (cycles % 10 == 0) {
141+
if (cycles % 5 == 0) {
142142
printf("Monitor: A=%d, B=%d, Counter=%d, Violations=%d\n",
143143
task_a_count, task_b_count, shared_counter,
144144
critical_section_violations);
@@ -151,7 +151,7 @@ void monitor_task(void)
151151
}
152152

153153
/* Yield to let other tasks run */
154-
for (int i = 0; i < 5; i++)
154+
for (int i = 0; i < 3; i++)
155155
mo_task_yield();
156156
}
157157

arch/riscv/build.mk

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ 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+
else
27+
CC_IS_CLANG ?= $(shell $(CROSS_COMPILE)clang --version 2>/dev/null | grep -qi clang && echo 1)
28+
endif
2429

2530
# Architecture flags
2631
ARCH_FLAGS = -march=rv32imzicsr -mabi=ilp32

0 commit comments

Comments
 (0)