Skip to content

Commit ab14e4c

Browse files
V0.17.0
1 parent 120eaf0 commit ab14e4c

57 files changed

Lines changed: 547 additions & 728 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11

22

3+
**0.17.0 (2026-04-04)**
4+
5+
*Changes*
6+
7+
* Cleaned blocking paths.
8+
9+
*Bug fixes*
10+
11+
* `logError` fails immediately.
12+
313
**0.16.1 (2026-03-30)**
414

515
*Changes*

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[![CI](https://github.com/antoniogiacomelli/RK0/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/antoniogiacomelli/RK0/actions/workflows/ci.yml)
2-
[![Version](https://img.shields.io/badge/version-0.16.1-blue)](https://github.com/antoniogiacomelli/RK0/blob/main/CHANGELOG.md)
2+
[![Version](https://img.shields.io/badge/version-0.17.0-blue)](https://github.com/antoniogiacomelli/RK0/blob/main/CHANGELOG.md)
33
[![Docs](https://img.shields.io/badge/docs-HTML-orange)](https://antoniogiacomelli.github.io/RK0/)
44

55
<h1 align="left">RK<em>0</em> - The Embedded Real-Time Kernel '0'<img src="https://github.com/user-attachments/assets/b8b5693b-197e-4fd4-b51e-5865bb568447" width="7%" align="left" alt="image"></h1>

app/inc/application.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/** RK0 - The Embedded Real-Time Kernel '0' */
55
/** (C) 2026 Antonio Giacomelli <dev@kernel0.org> */
66
/** */
7-
/** VERSION: V0.16.1 */
7+
/** VERSION: V0.17.0 */
88
/** */
99
/** You may obtain a copy of the License at : */
1010
/** http://www.apache.org/licenses/LICENSE-2.0 */

app/inc/logger.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/** RK0 - The Embedded Real-Time Kernel '0' */
55
/** (C) 2026 Antonio Giacomelli <dev@kernel0.org> */
66
/** */
7-
/** VERSION: V0.16.1 */
7+
/** VERSION: V0.17.0 */
88
/** */
99
/** You may obtain a copy of the License at : */
1010
/** http://www.apache.org/licenses/LICENSE-2.0 */
@@ -21,7 +21,7 @@
2121
#define CONF_LOGGER 1 /* Turn logger on/off */
2222

2323
#if (CONF_LOGGER == 1)
24-
#define LOGLEN 68 /* Max length of a single log message */
24+
#define LOGLEN 64 /* Max length of a single log message */
2525
#define LOGPOOLSIZ 16 /* Number of log message buffers */
2626

2727

app/inc/qemu_uart.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/** RK0 - The Embedded Real-Time Kernel '0' */
55
/** (C) 2026 Antonio Giacomelli <dev@kernel0.org> */
66
/** */
7-
/** VERSION: V0.16.1 */
7+
/** VERSION: V0.17.0 */
88
/** */
99
/** You may obtain a copy of the License at : */
1010
/** http://www.apache.org/licenses/LICENSE-2.0 */

app/src/application.c

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/** RK0 - The Embedded Real-Time Kernel '0' */
55
/** (C) 2026 Antonio Giacomelli <dev@kernel0.org> */
66
/** */
7-
/** VERSION: V0.16.1 */
7+
/** VERSION: V0.17.0 */
88
/** */
99
/** You may obtain a copy of the License at : */
1010
/** http://www.apache.org/licenses/LICENSE-2.0 */
@@ -15,8 +15,7 @@
1515
/* and message-passing paradigms. */
1616

1717
/* Set to 1 to use message-passing version, 0 for shared-memory version */
18-
#define SYNCHBARR_MESGPASS_APP 1
19-
18+
#define SYNCHBARR_MESGPASS_APP 0
2019

2120
#include <kapi.h>
2221
/* Configure the application logger facility here */
@@ -36,9 +35,12 @@ int main(void)
3635
}
3736
}
3837

39-
#define LOG_BARRIER_ENTER(c, t, name) logPost("[BARRIER: %u/%u]: %s ENTERED ", (c), (t), (name))
40-
#define LOG_BARRIER_BLOCK(c, t, name) logPost("[BARRIER: %u/%u]: %s BLOCKED ", (c), (t), (name))
41-
#define LOG_BARRIER_WAKE(c, t, name) logPost("[BARRIER: %u/%u]: %s WAKING ALL TASKS ", (c), (t), (name))
38+
#define LOG_BARRIER_ENTER(c, t, name) \
39+
logPost("[BARRIER: %u/%u]: %s ENTERED ", (c), (t), (name))
40+
#define LOG_BARRIER_BLOCK(c, t, name) \
41+
logPost("[BARRIER: %u/%u]: %s BLOCKED ", (c), (t), (name))
42+
#define LOG_BARRIER_WAKE(c, t, name) \
43+
logPost("[BARRIER: %u/%u]: %s WAKING ALL TASKS ", (c), (t), (name))
4244

4345
#if (SYNCHBARR_MESGPASS_APP == 0)
4446
/*** SYNCH BARRIER USING PROCEDURE CALL CHANNELS ***/
@@ -68,19 +70,30 @@ RK_DECLARE_CHANNEL_BUF(barrierBuf, BARRIER_CHANNEL_DEPTH)
6870
static RK_MEM_PARTITION barrierReqPart;
6971
static RK_REQ_BUF barrierReqPool[BARRIER_TASK_COUNT] K_ALIGN(4);
7072

71-
static inline VOID BarrierWaitChannel(VOID)
73+
static inline VOID BarrierWaitChannel(RK_TICK timeout)
7274
{
7375
BarrierResp resp = {0U};
74-
RK_REQ_BUF *reqBuf =
75-
(RK_REQ_BUF *)kMemPartitionAlloc(&barrierReqPart);
76+
RK_REQ_BUF *reqBuf = (RK_REQ_BUF *)kMemPartitionAlloc(&barrierReqPart);
7677
K_ASSERT(reqBuf != NULL);
7778

7879
reqBuf->size = 0U;
7980
reqBuf->reqPtr = NULL;
8081
reqBuf->respPtr = &resp;
8182

82-
RK_ERR err = kChannelCall(barrierHandle, reqBuf, RK_WAIT_FOREVER);
83-
K_ASSERT(err == RK_ERR_SUCCESS);
83+
RK_ERR err = kChannelCall(barrierHandle, reqBuf, timeout);
84+
if (err != RK_ERR_SUCCESS)
85+
{
86+
87+
if (err == RK_ERR_TIMEOUT)
88+
{
89+
logError("%s TIMEOUT", RK_RUNNING_NAME);
90+
}
91+
else
92+
{
93+
logError("%s CALL ERROR %d", RK_RUNNING_NAME, err);
94+
}
95+
}
96+
8497
K_ASSERT(resp.releaseCode == BARRIER_RELEASE_CODE);
8598
}
8699

@@ -143,24 +156,24 @@ VOID kApplicationInit(VOID)
143156
"Barrier", stackB, STACKSIZE, 1, RK_PREEMPT);
144157
K_ASSERT(err == RK_ERR_SUCCESS);
145158

146-
err = kMemPartitionInit(&barrierReqPart, barrierReqPool,
147-
sizeof(RK_REQ_BUF), BARRIER_TASK_COUNT);
159+
err = kMemPartitionInit(&barrierReqPart, barrierReqPool, sizeof(RK_REQ_BUF),
160+
BARRIER_TASK_COUNT);
148161
K_ASSERT(err == RK_ERR_SUCCESS);
149162

150163
err = kChannelInit(&barrierChannel, barrierBuf, BARRIER_CHANNEL_DEPTH,
151164
barrierHandle, &barrierReqPart);
152165
K_ASSERT(err == RK_ERR_SUCCESS);
153166

154-
err = kCreateTask(&task1Handle, Task1, RK_NO_ARGS,
155-
"Task1", stack1, STACKSIZE, 1, RK_PREEMPT);
167+
err = kCreateTask(&task1Handle, Task1, RK_NO_ARGS, "Task1", stack1,
168+
STACKSIZE, 1, RK_PREEMPT);
156169
K_ASSERT(err == RK_ERR_SUCCESS);
157170

158-
err = kCreateTask(&task2Handle, Task2, RK_NO_ARGS,
159-
"Task2", stack2, STACKSIZE, 2, RK_PREEMPT);
171+
err = kCreateTask(&task2Handle, Task2, RK_NO_ARGS, "Task2", stack2,
172+
STACKSIZE, 2, RK_PREEMPT);
160173
K_ASSERT(err == RK_ERR_SUCCESS);
161174

162-
err = kCreateTask(&task3Handle, Task3, RK_NO_ARGS,
163-
"Task3", stack3, STACKSIZE, 3, RK_PREEMPT);
175+
err = kCreateTask(&task3Handle, Task3, RK_NO_ARGS, "Task3", stack3,
176+
STACKSIZE, 3, RK_PREEMPT);
164177

165178
K_ASSERT(err == RK_ERR_SUCCESS);
166179

@@ -174,7 +187,7 @@ VOID Task1(VOID *args)
174187
{
175188
logPost("Task 1 running");
176189
kBusyDelay(10);
177-
BarrierWaitChannel();
190+
BarrierWaitChannel(60);
178191
kSleep(5);
179192
}
180193
}
@@ -186,7 +199,7 @@ VOID Task2(VOID *args)
186199
{
187200
logPost("Task 2 running");
188201
kBusyDelay(20);
189-
BarrierWaitChannel();
202+
BarrierWaitChannel(60);
190203
kSleep(5);
191204
}
192205
}
@@ -198,7 +211,7 @@ VOID Task3(VOID *args)
198211
{
199212
logPost("Task 3 running");
200213
kBusyDelay(30);
201-
BarrierWaitChannel();
214+
BarrierWaitChannel(10);
202215
kSleep(5);
203216
}
204217
}
@@ -212,7 +225,6 @@ in kconfig.h set:
212225
RK_CONF_N_USRTASKS 4
213226
*/
214227

215-
216228
#define STACKSIZE 256
217229

218230
RK_DECLARE_TASK(task1Handle, Task1, stack1, STACKSIZE)
@@ -282,16 +294,18 @@ with NDEBUG */
282294
VOID kApplicationInit(VOID)
283295
{
284296

285-
RK_ERR err = kCreateTask(&task1Handle, Task1, RK_NO_ARGS, "Task1", stack1, STACKSIZE, 1, RK_PREEMPT);
297+
RK_ERR err = kCreateTask(&task1Handle, Task1, RK_NO_ARGS, "Task1", stack1,
298+
STACKSIZE, 1, RK_PREEMPT);
286299
K_ASSERT(err == RK_ERR_SUCCESS);
287300

288-
err = kCreateTask(&task2Handle, Task2, RK_NO_ARGS, "Task2", stack2, STACKSIZE, 2, RK_PREEMPT);
301+
err = kCreateTask(&task2Handle, Task2, RK_NO_ARGS, "Task2", stack2,
302+
STACKSIZE, 2, RK_PREEMPT);
289303
K_ASSERT(err == RK_ERR_SUCCESS);
290304

291-
err = kCreateTask(&task3Handle, Task3, RK_NO_ARGS, "Task3", stack3, STACKSIZE, 3, RK_PREEMPT);
305+
err = kCreateTask(&task3Handle, Task3, RK_NO_ARGS, "Task3", stack3,
306+
STACKSIZE, 3, RK_PREEMPT);
292307
K_ASSERT(err == RK_ERR_SUCCESS);
293308

294-
295309
BarrierInit(&syncBarrier);
296310

297311
logInit(3); /* same as task 3 */
@@ -304,7 +318,7 @@ VOID Task1(VOID *args)
304318
logPost("Task 1 running");
305319
kBusyDelay(10); /* simulate work */
306320
BarrierWait(&syncBarrier, N_BARR_TASKS, 60);
307-
}
321+
}
308322
}
309323

310324
VOID Task2(VOID *args)
@@ -315,7 +329,7 @@ VOID Task2(VOID *args)
315329
logPost("Task 2 running");
316330
kBusyDelay(20); /* simulate work */
317331
BarrierWait(&syncBarrier, N_BARR_TASKS, 40);
318-
}
332+
}
319333
}
320334

321335
VOID Task3(VOID *args)

0 commit comments

Comments
 (0)