如何在 Contiki 运行 中使用 hello-world OS?

How to run hello-world in Contiki OS?

我是 contiki os 的新手,我尝试编译 运行 hello-world.c 文件,该文件位于 contiki os 3.0 的示例目录中。但是我得到了错误,

hello-world.c:40:21: fatal error: contiki.h: No such file or directory".

我在 root 用户中试过这个。

任何对 运行 contiki 初学者程序的帮助都值得感激。

使用make命令构建Contiki。这样做会调用特定于体系结构的版本 gcc,编译器标志指向正确的头文件路径:

默认情况下,make 将为 "native" 平台(即 x86)构建并创建可在主机 PC 上执行的应用程序映像。

要针对特定​​硬件平台构建,请设置 TARGET 变量。例如,要为 Tmote Sky/TelosB 节点构建:

make TARGET=sky hello-world

为本机平台构建和运行:

make

输出:

TARGET not defined, using target 'native'
mkdir obj_native
...
CC        hello-world.c
LD        hello-world.native
rm hello-world.co

给运行吧:

./hello-world.native 

输出:

 Contiki-3.x-1457-g552408b started with IPV6, RPL
 Rime started with address 1.2.3.4.5.6.7.8
 MAC nullmac RDC nullrdc NETWORK sicslowpan
 Tentative link-local IPv6 address fe80:0000:0000:0000:0302:0304:0506:0708
 Hello, world

感谢所有帮助回答我问题的人。最后,我能够 运行 Contiki 中的第一个 hello-world 程序 OS。我使用了以下代码语法。

$cd contiki
$cd examples/hello-world
$make TARGET=native

要运行编译后的代码使用下面的代码。

$ ./hello-world.native

输出:

Contiki 3.0 started with IPV6, RPL
Rime started with address 1.2.3.4.5.6.7.8
MAC nullmac RDC nullrdc NETWORK sicslowpan
Tentative link-local IPv6 address fe80:0000:0000:0000:0302:0304:0506:0708
Hello, world