Skip to content

Commit a253939

Browse files
Merge pull request #20 from deryugina/work-on-docs
Translated the "Hello World" example in English
2 parents 7a9afb5 + 9ae9f13 commit a253939

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{
2+
}

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ user_manual_en:
1818
en/drivers/embox_drivers_flash_en.md \
1919
en/drivers/embox_drivers_gpio_en.md \
2020
en/drivers/embox_drivers_i2c_en.md \
21+
en/examples/embox_hello_world_example_en.md \
2122
en/examples/embox_examples_light_sensor_stm32_en.md \
2223
en/examples/embox_examples_opencv_stm32_en.md \
2324
en/examples/embox_examples_pjsip_stm32_en.md \
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# "Hello, World!" example
2+
To write an example of "Hello, World!" command, it's necessary to create the **hello.c** file, written in **C**:
3+
```c
4+
#include <stdio.h>
5+
6+
int main(int argc, char **argv) {
7+
printf("Hello World!\n");
8+
return 0;
9+
}
10+
```
11+
And then to add a module description.
12+
13+
## Module addition
14+
All modules and interfaces are described in **my-files**.
15+
16+
**My-files** are files that have the **.my** extension or the **Mybuild** name (without any extension).
17+
18+
**Structurally every my-file contains:**
19+
20+
* package declaring, which owns all entities, declared in the file
21+
* list of imported names from other packages
22+
* determinations of these modules and interfaces.
23+
24+
For instance, to add a new command to command-interpreter(embedded in the kernel), we create new **Hello.my** file with the following content:
25+
```java
26+
package embox.cmd.tutorial
27+
28+
@AutoCmd
29+
@Cmd(name="hello", help="Prints ‘Hello World’ string")
30+
module hello {
31+
source "hello.c"
32+
}
33+
```
34+
In the example above we described the simple module with the only one **source** attribute – the **hello.c** file that has source code.
35+
36+
This file will be compilled and connected with the kernel in case of the module will be added to the building.
37+

0 commit comments

Comments
 (0)