Skip to content

Commit

Permalink
fix code errors hello-camkes-1
Browse files Browse the repository at this point in the history
Signed-off-by: Birgit Brecknell <[email protected]>
  • Loading branch information
bbrcknl committed Aug 2, 2024
1 parent 2d70097 commit 5199f2d
Showing 1 changed file with 42 additions and 34 deletions.
76 changes: 42 additions & 34 deletions tutorials/hello-camkes-1/hello-camkes-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,6 @@ procedure HelloSimple {
**Exercise** Implement the RPC hello function.

```c
/*- filter File("components/Echo/src/echo.c") --*/
/*-- filter ExcludeDocs() -*/
/*
* CAmkES tutorial part 1: components with RPC. Server part.
*/
#include <stdio.h>

/* generated header for our component */
#include <camkes.h>
/*-- endfilter -*/

/*-- filter TaskContent("hello", TaskContentType.BEFORE, subtask="rpc") -*/
/* Implement the RPC function. */
/* hint 1: the name of the function to implement is a composition of an interface name and a function name:
Expand All @@ -239,7 +228,6 @@ procedure HelloSimple {
* hint 7: look at https://github.com/seL4/camkes-tool/blob/master/docs/index.md#creating-an-application
*/
/*-- endfilter -*/
/*-- endfilter -*/
```


Expand All @@ -248,6 +236,7 @@ procedure HelloSimple {

```
/*-- filter TaskContent("hello", TaskContentType.COMPLETED, subtask="rpc") -*/
/* Implement the RPC function. */
void hello_say_hello(const char *str) {
printf("Component %s saying: %s\n", get_instance_name(), str);
}
Expand All @@ -260,23 +249,6 @@ void hello_say_hello(const char *str) {
**Exercise** Invoke the RPC function in `components/Client/src/client.c`.

```c
/*- filter File("components/Client/src/client.c") --*/
/*-- filter ExcludeDocs() -*/
/*
* CAmkES tutorial part 1: components with RPC. Client part.
*/

#include <stdio.h>

/* generated header for our component */
#include <camkes.h>

/* run the control thread */
int run(void) {
printf("Starting the client\n");
printf("-------------------\n");
/*-- endfilter -*/

/*-- filter TaskContent("hello", TaskContentType.BEFORE, subtask="hello") -*/
/* TODO: invoke the RPC function */
/* hint 1: the name of the function to invoke is a composition of an interface name and a function name:
Expand All @@ -287,21 +259,17 @@ int run(void) {
* hint 5: look at https://github.com/seL4/camkes-tool/blob/master/docs/index.md#creating-an-application
*/
/*-- endfilter -*/
/*-- endfilter -*/
```

<details markdown='1'>
<summary style="display:list-item"><em>Quick solution</em></summary>

```
/*-- filter TaskContent("hello", TaskContentType.COMPLETED, subtask="hello") -*/
/* Invoke the RPC function */
char *shello = "hello world";
hello_say_hello(shello);
/*-- endfilter -*/

printf("After the client\n");
return 0;
}
```
</details>

Expand All @@ -312,6 +280,46 @@ structure of ADL: it's key to understanding CAmkES. And well done on
writing your first CAmkES application.

/*-- filter ExcludeDocs() -*/
```c
/*- filter File("components/Client/src/client.c") --*/
/*
* CAmkES tutorial part 1: components with RPC. Client part.
*/

#include <stdio.h>

/* generated header for our component */
#include <camkes.h>

/* run the control thread */
int run(void) {
printf("Starting the client\n");
printf("-------------------\n");

/*? include_task_type_append([("hello", 'hello')]) ?*/

printf("After the client\n");
return 0;
}
/*-- endfilter -*/
```
```c
/*- filter File("components/Echo/src/echo.c") --*/
/*
* CAmkES tutorial part 1: components with RPC. Server part.
*/
#include <stdio.h>
/* generated header for our component */
#include <camkes.h>
/*? include_task_type_append([("hello", 'rpc')]) ?*/
/*-- endfilter -*/
```

```
/*- filter File("hello-1.camkes") --*/
/*
Expand Down

0 comments on commit 5199f2d

Please sign in to comment.