Revision 6d4ba740
README.md | ||
---|---|---|
1 |
About & License |
|
2 |
=============== |
|
3 |
|
|
4 |
AMiRo-Apps is a collection of applications and configurations for the Autonomous |
|
5 |
Mini Robot (AMiRo) [1]. It is tightly coupled to the AMiRo-OS and uRtWare |
|
6 |
projects, which provide a sophisticated operating system (based on ChibiOS) amd |
|
7 |
a real-time middleware for embedded devices. |
|
8 |
|
|
9 |
Copyright (C) 2018..2020 Thomas Schöpping et al. |
|
10 |
(a complete list of all authors is given below) |
|
11 |
|
|
12 |
This program is free software: you can redistribute it and/or modify |
|
13 |
it under the terms of the GNU General Public License as published by |
|
14 |
the Free Software Foundation, either version 3 of the License, or (at |
|
15 |
your option) any later version. |
|
16 |
|
|
17 |
This program is distributed in the hope that it will be useful, but |
|
18 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
20 |
General Public License for more details. |
|
21 |
|
|
22 |
You should have received a copy of the GNU General Public License |
|
23 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
24 |
|
|
25 |
This research/work was supported by the Cluster of Excellence |
|
26 |
Cognitive Interaction Technology 'CITEC' (EXC 277) at Bielefeld |
|
27 |
University, which is funded by the German Research Foundation (DFG). |
|
28 |
|
|
29 |
Authors: |
|
30 |
|
|
31 |
- Thomas Schöpping <tschoepp[at]cit-ec.uni-bielefeld.de> |
|
32 |
|
|
33 |
References: |
|
34 |
|
|
35 |
[1] S. Herbrechtsmeier, T. Korthals, T. Schopping and U. Rückert, "AMiRo: A |
|
36 |
modular & customizable open-source mini robot platform," 2016 20th |
|
37 |
International Conference on System Theory, Control and Computing (ICSTCC), |
|
38 |
Sinaia, 2016, pp. 687-692. |
|
39 |
|
|
40 |
-------------------------------------------------------------------------------- |
|
41 |
|
|
42 |
Contents |
|
43 |
======== |
|
44 |
|
|
45 |
1. Required Software |
|
46 |
2. Folder Structure |
|
47 |
|
|
48 |
-------------------------------------------------------------------------------- |
|
49 |
|
|
50 |
1 Required Software |
|
51 |
=================== |
|
52 |
|
|
53 |
Since AMiRo-Apps depends on the AMiRo-OS and µRtWare projects, both are included |
|
54 |
as Git submodules. Use the provided ./setup.sh script to initialize those. When |
|
55 |
AMiRo-OS is fully configured, there is no additional software required by |
|
56 |
AMiRo-Apps. For further details about the initialization follow the instructions |
|
57 |
in the script and refer to the README.md file of AMiRo-OS and µRtWare |
|
58 |
respectively. |
|
59 |
|
|
60 |
|
|
61 |
2 Folder Structure |
|
62 |
================== |
|
63 |
|
|
64 |
At its root, the AMiRo-Apps project has seven folders to distiquish between the |
|
65 |
most fundamental parts: |
|
66 |
|
|
67 |
2.1 `apps/` |
|
68 |
----------- |
|
69 |
|
|
70 |
This folder includes individual applications, which can used by |
|
71 |
configigurations (see `configurations/`). Apps will usually be implemented |
|
72 |
as nodes for the middleware and provide according interfaces via some message |
|
73 |
type(s) (see `messagetypes/`). |
|
74 |
|
|
75 |
2.2 `configurations/` |
|
76 |
--------------------- |
|
77 |
|
|
78 |
Each configuration combines multiple apps and distributes them among any |
|
79 |
supported modules. Furthermore, configurations may modify parameters for each |
|
80 |
module individually. Finally, each configuration should come with a Makefile, so |
|
81 |
a user can just use this to build and flash the whole setup. |
|
82 |
For better understanding, have a look at this example: |
|
83 |
|
|
84 |
- module A: using apps 1, 2 and 3 with parameters X and Y. |
|
85 |
- module B: using apps 1 and 4 with parameter X. |
|
86 |
- module C: using apps 1, 5, 6 and 7 with parameters X and Z. |
|
87 |
- Makefile: setup and build everything. |
|
88 |
|
|
89 |
Note that each configuration needs to explicitely support a module and that |
|
90 |
there can never be an implicit default configuration. |
|
91 |
|
|
92 |
2.3 `doc/` |
|
93 |
---------- |
|
94 |
|
|
95 |
Any documentation related files are located in this directory. |
|
96 |
|
|
97 |
2.4 `messagetypes/` |
|
98 |
------------------- |
|
99 |
|
|
100 |
Apps shoud take advantage of the middleware and thus implement nodes, which |
|
101 |
communicate via messages and/or requests. Such messages/requests may have |
|
102 |
payloads of arbitrary types, which can be defined in this folder. |
|
103 |
|
|
104 |
2.5 `middleware/` |
|
105 |
----------------- |
|
106 |
|
|
107 |
This folder contains the µRtWare submodule and interface files. |
|
108 |
|
|
109 |
2.6 `os/` |
|
110 |
--------- |
|
111 |
|
|
112 |
This folder contains the AMiRo-OS submodule and interface files. |
|
113 |
|
|
114 |
2.7 `tools/` |
|
115 |
------------ |
|
116 |
|
|
117 |
Helpful tools can be found in this dirctory. |
|
118 |
|
README.txt | ||
---|---|---|
1 |
AMiRo-Apps is a collection of applications and configurations for the Autonomous |
|
2 |
Mini Robot (AMiRo) [1]. It is tightly coupled to the AMiRo-OS and uRtWare |
|
3 |
projects, which provide a sophisticated operating system (based on ChibiOS) amd |
|
4 |
a real-time middleware for embedded devices. |
|
5 |
|
|
6 |
Copyright (C) 2018..2019 Thomas Schöpping et al. |
|
7 |
(a complete list of all authors is given below) |
|
8 |
|
|
9 |
This program is free software: you can redistribute it and/or modify |
|
10 |
it under the terms of the GNU General Public License as published by |
|
11 |
the Free Software Foundation, either version 3 of the License, or (at |
|
12 |
your option) any later version. |
|
13 |
|
|
14 |
This program is distributed in the hope that it will be useful, but |
|
15 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
17 |
General Public License for more details. |
|
18 |
|
|
19 |
You should have received a copy of the GNU General Public License |
|
20 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
21 |
|
|
22 |
This research/work was supported by the Cluster of Excellence |
|
23 |
Cognitive Interaction Technology 'CITEC' (EXC 277) at Bielefeld |
|
24 |
University, which is funded by the German Research Foundation (DFG). |
|
25 |
|
|
26 |
Authors: |
|
27 |
- Thomas Schöpping <tschoepp[at]cit-ec.uni-bielefeld.de> |
|
28 |
- Marc Rothmann |
|
29 |
|
|
30 |
References: |
|
31 |
[1] S. Herbrechtsmeier, T. Korthals, T. Schopping and U. Rückert, "AMiRo: A |
|
32 |
modular & customizable open-source mini robot platform," 2016 20th |
|
33 |
International Conference on System Theory, Control and Computing (ICSTCC), |
|
34 |
Sinaia, 2016, pp. 687-692. |
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
################################################################################ |
|
39 |
# # |
|
40 |
# RRRRRRRR EEEEEEEE AAA DDDDDDDD MM MM EEEEEEEE # |
|
41 |
# RR RR EE AA AA DD DD MMM MMM EE # |
|
42 |
# RR RR EE AA AA DD DD MMMM MMMM EE # |
|
43 |
# RRRRRRRR EEEEEE AA AA DD DD MM MMM MM EEEEEE # |
|
44 |
# RR RR EE AAAAAAAAA DD DD MM MM EE # |
|
45 |
# RR RR EE AA AA DD DD MM MM EE # |
|
46 |
# RR RR EEEEEEEE AA AA DDDDDDDD MM MM EEEEEEEE # |
|
47 |
# # |
|
48 |
################################################################################ |
|
49 |
|
|
50 |
This file will help you to setup all required software on your system, compile |
|
51 |
the source code, and flash it to the AMiRo modules. |
|
52 |
|
|
53 |
================================================================================ |
|
54 |
|
|
55 |
CONTENTS: |
|
56 |
|
|
57 |
1 Required software |
|
58 |
2 Folder structure |
|
59 |
|
|
60 |
================================================================================ |
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
1 - REQUIRED SOFTWARE |
|
65 |
--------------------- |
|
66 |
|
|
67 |
Since AMiRo-Apps depends on the AMiRo-OS and uRtWare projects, both are included |
|
68 |
as Git submodules. Use the provided ./setup.sh script to initialize those. When |
|
69 |
AMiRo-OS is fully configured, there is no additional software required by |
|
70 |
AMiRo-Apps. For further details about the initialization follow the instructions |
|
71 |
in the script and refer to the README.txt file of AMiRo-OS and uRtWare |
|
72 |
respectively. |
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
2 - FOLDER STRUCTURE |
|
77 |
-------------------- |
|
78 |
|
|
79 |
At its root, the AMiRo-Apps projects has six folders to distiquish between the |
|
80 |
most fundamental parts: |
|
81 |
. |
|
82 |
├── apps |
|
83 |
│ This folder includes individual applications, which can used by |
|
84 |
│ configigurations. Apps will usually be implemented as nodes for the |
|
85 |
│ middleware and provide acording interfaces via some message type(s). |
|
86 |
├── configurations |
|
87 |
│ Each configuration combines multiple apps and distributes them among any |
|
88 |
│ supported modules. Furthermore, configurations may modify parameters for |
|
89 |
│ each module individually. Finally, each configuration should come with a |
|
90 |
│ makefile, so a user can just use this to build and flash the whole setup. |
|
91 |
│ For better understanding, have a look at this example: |
|
92 |
│ - module A: using apps 1, 2 and 3 with parameters X and Y. |
|
93 |
│ - module B: using apps 1 and 4 with parameter X. |
|
94 |
│ - module C: using apps 1, 5, 6 and 7 with parameters X and Z. |
|
95 |
│ - Makefile: set and build everything. |
|
96 |
│ Note that each configuration needs to explicitely support a module and |
|
97 |
│ that there can never be an implicit default configuration. |
|
98 |
├── messagetypes |
|
99 |
│ Apps shoud take advantage of the middleware and thus implement nodes, |
|
100 |
│ which communicate via messages. Such messages may have payloads of |
|
101 |
│ arbitrary types, which can be defined in this folder. |
|
102 |
├── middleware |
|
103 |
│ This folder contains the µRtWare submodule and interface files. |
|
104 |
├── os |
|
105 |
│ This folder contains the AMiRo-OS submodule and interface files. |
|
106 |
└── tools |
|
107 |
Usable tools can be found in this dirctory. |
|
108 |
|
|
109 |
================================================================================ |
|
110 |
|
apps/HelloWorld/HelloWorld.mk | ||
---|---|---|
1 | 1 |
################################################################################ |
2 | 2 |
# AMiRo-Apps is a collection of applications for the Autonomous Mini Robot # |
3 | 3 |
# (AMiRo) platform. # |
4 |
# Copyright (C) 2018..2019 Thomas Schöpping et al. #
|
|
4 |
# Copyright (C) 2018..2020 Thomas Schöpping et al. #
|
|
5 | 5 |
# # |
6 | 6 |
# This program is free software: you can redistribute it and/or modify # |
7 | 7 |
# it under the terms of the GNU General Public License as published by # |
... | ... | |
26 | 26 |
# absolue path to this directory |
27 | 27 |
HelloWorldAPP_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) |
28 | 28 |
|
29 |
# middleware selection |
|
30 |
ifeq ($(CONFIG_MIDDLEWARE),) |
|
31 |
CONFIG_MIDDLEWARE := "µRtWare" |
|
32 |
else ifneq ($(CONFIG_MIDDLEWARE),"µRtWare") |
|
33 |
$(error incompatible middleware selected: $(CONFIG_MIDDLEWARE)) |
|
34 |
endif |
|
35 |
|
|
29 | 36 |
# include path |
30 | 37 |
HelloWorldAPP_INC = $(HelloWorldAPP_DIR) |
31 | 38 |
|
apps/HelloWorld/helloworld.c | ||
---|---|---|
1 | 1 |
/* |
2 | 2 |
AMiRo-Apps is a collection of applications for the Autonomous Mini Robot (AMiRo) platform. |
3 |
Copyright (C) 2018..2019 Thomas Schöpping et al.
|
|
3 |
Copyright (C) 2018..2020 Thomas Schöpping et al.
|
|
4 | 4 |
|
5 | 5 |
This program is free software: you can redistribute it and/or modify |
6 | 6 |
it under the terms of the GNU General Public License as published by |
... | ... | |
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
#include <helloworld.h> |
20 |
|
|
21 |
#pragma message "Hello World! (.c)" |
apps/HelloWorld/helloworld.h | ||
---|---|---|
1 | 1 |
/* |
2 | 2 |
AMiRo-Apps is a collection of applications for the Autonomous Mini Robot (AMiRo) platform. |
3 |
Copyright (C) 2018..2019 Thomas Schöpping et al.
|
|
3 |
Copyright (C) 2018..2020 Thomas Schöpping et al.
|
|
4 | 4 |
|
5 | 5 |
This program is free software: you can redistribute it and/or modify |
6 | 6 |
it under the terms of the GNU General Public License as published by |
... | ... | |
16 | 16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 |
*/ |
18 | 18 |
|
19 |
#ifndef _HELLOWORLD_H_
|
|
20 |
#define _HELLOWORLD_H_
|
|
19 |
#ifndef HELLOWORLD_H
|
|
20 |
#define HELLOWORLD_H
|
|
21 | 21 |
|
22 |
#endif /* _HELLOWORLD_H_ */ |
|
22 |
#pragma message "Hello World! (.h)" |
|
23 |
|
|
24 |
#endif /* HELLOWORLD_H */ |
configurations/HelloWorld/Makefile | ||
---|---|---|
1 | 1 |
################################################################################ |
2 | 2 |
# AMiRo-Apps is a collection of applications for the Autonomous Mini Robot # |
3 | 3 |
# (AMiRo) platform. # |
4 |
# Copyright (C) 2018..2019 Thomas Schöpping et al. #
|
|
4 |
# Copyright (C) 2018..2020 Thomas Schöpping et al. #
|
|
5 | 5 |
# # |
6 | 6 |
# This program is free software: you can redistribute it and/or modify # |
7 | 7 |
# it under the terms of the GNU General Public License as published by # |
... | ... | |
26 | 26 |
# absolue path to this directory |
27 | 27 |
HelloWorldCONF_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) |
28 | 28 |
|
29 |
# list of available modules |
|
30 |
HelloWorldCONF_MODULES = $(patsubst $(HelloWorldCONF_DIR)/modules/%/,%,$(sort $(dir $(wildcard $(HelloWorldCONF_DIR)/modules/*/*)))) |
|
29 |
# list of available/supported modules |
|
30 |
HelloWorldCONF_MODULES_DIR = $(HelloWorldCONF_DIR)/modules/ |
|
31 |
HelloWorldCONF_MODULES = $(patsubst $(HelloWorldCONF_MODULES_DIR)%/,%,$(sort $(dir $(wildcard $(HelloWorldCONF_MODULES_DIR)*/*)))) |
|
31 | 32 |
|
32 |
CLEANTRGS = $(HelloWorldCONF_MODULES:%=clean_%) |
|
33 |
FLASHTRGS = $(HelloWorldCONF_MODULES:%=flash_%) |
|
33 |
HelloWorldCONF_CLEANTRGS = $(HelloWorldCONF_MODULES:%=clean_%)
|
|
34 |
HelloWorldCONF_FLASHTRGS = $(HelloWorldCONF_MODULES:%=flash_%)
|
|
34 | 35 |
|
35 |
.PHONY: all $(MODULES) $(FLASHTRGS) clean $(CLEANTRGS)
|
|
36 |
.PHONY: all $(HelloWorldCONF_MODULES) $(HelloWorldCONF_FLASHTRGS) clean $(HelloWorldCONF_CLEANTRGS)
|
|
36 | 37 |
|
37 | 38 |
all: $(HelloWorldCONF_MODULES) |
39 |
|
|
38 | 40 |
$(HelloWorldCONF_MODULES): |
39 |
$(MAKE) -C $(HelloWorldCONF_DIR)/modules/$@
|
|
41 |
$(MAKE) -C $(HelloWorldCONF_MODULES_DIR)/$@
|
|
40 | 42 |
|
41 |
$(FLASHTRGS): |
|
42 |
$(MAKE) -C $(HelloWorldCONF_DIR)/modules/$(@:flash_%=%) flash
|
|
43 |
$(HelloWorldCONF_FLASHTRGS):
|
|
44 |
$(MAKE) -C $(HelloWorldCONF_MODULES_DIR)/$(@:flash_%=%) flash
|
|
43 | 45 |
|
44 |
clean: $(CLEANTRGS) |
|
45 |
$(CLEANTRGS): |
|
46 |
$(MAKE) -C $(HelloWorldCONF_DIR)/modules/$(@:clean_%=%) clean |
|
46 |
clean: $(HelloWorldCONF_CLEANTRGS) |
|
47 |
$(HelloWorldCONF_CLEANTRGS): |
|
48 |
$(MAKE) -C $(HelloWorldCONF_MODULES_DIR)/$(@:clean_%=%) clean |
configurations/HelloWorld/modules/DiWheelDrive_1-1/Makefile | ||
---|---|---|
1 |
################################################################################ |
|
2 |
# AMiRo-Apps is a collection of applications for the Autonomous Mini Robot # |
|
3 |
# (AMiRo) platform. # |
|
4 |
# Copyright (C) 2018..2019 Thomas Schöpping et al. # |
|
5 |
# # |
|
6 |
# This program is free software: you can redistribute it and/or modify # |
|
7 |
# it under the terms of the GNU General Public License as published by # |
|
8 |
# the Free Software Foundation, either version 3 of the License, or # |
|
9 |
# (at your option) any later version. # |
|
10 |
# # |
|
11 |
# This program is distributed in the hope that it will be useful, # |
|
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of # |
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
|
14 |
# GNU General Public License for more details. # |
|
15 |
# # |
|
16 |
# You should have received a copy of the GNU General Public License # |
|
17 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. # |
|
18 |
# # |
|
19 |
# This research/work was supported by the Cluster of Excellence Cognitive # |
|
20 |
# Interaction Technology 'CITEC' (EXC 277) at Bielefeld University, which is # |
|
21 |
# funded by the German Research Foundation (DFG). # |
|
22 |
################################################################################ |
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
# absolue path to this directory |
|
27 |
APPCONFIG_MODULE_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) |
|
28 |
|
|
29 |
# environment setup |
|
30 |
include $(APPCONFIG_MODULE_DIR)/../modules.mk |
|
31 |
|
|
32 |
# include apps |
|
33 |
include $(APPS_DIR)/HelloWorld/HelloWorld.mk |
|
34 |
|
|
35 |
# include directories for configurations |
|
36 |
APPSINC += $(APPCONFIG_MODULE_DIR) \ |
|
37 |
$(HelloWorldAPP_INC) |
|
38 |
|
|
39 |
# C sources |
|
40 |
APPSCSRC += $(HelloWorldAPP_CSRC) |
|
41 |
|
|
42 |
# C++ sources |
|
43 |
APPSCPPSRC += $(HelloWorldAPP_CPPSRC) |
|
44 |
|
|
45 |
# call DiWHeelDrive Makefile module from OS |
|
46 |
all: |
|
47 |
$(MAKE) -C $(OS_DIR)/AMiRo-OS/modules/DiWheelDrive_1-1/ |
|
48 |
|
|
49 |
clean: |
|
50 |
$(MAKE) -C $(OS_DIR)/AMiRo-OS/modules/DiWheelDrive_1-1/ clean |
|
51 |
|
|
52 |
flash: |
|
53 |
$(MAKE) -C $(OS_DIR)/AMiRo-OS/modules/DiWheelDrive_1-1/ flash |
|
54 |
|
configurations/HelloWorld/modules/DiWheelDrive_1-1/mainincludes.hpp | ||
---|---|---|
1 |
/* |
|
2 |
AMiRo-Apps is a collection of applications for the Autonomous Mini Robot (AMiRo) platform. |
|
3 |
Copyright (C) 2018..2019 Thomas Schöpping et al. |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
#ifndef _MAININCLUDES_HPP_ |
|
20 |
#define _MAININCLUDES_HPP_ |
|
21 |
|
|
22 |
#include <urtware.h> |
|
23 |
|
|
24 |
#endif /* _MAININCLUDES_HPP_ */ |
configurations/HelloWorld/modules/DiWheelDrive_1-1/osconf.h | ||
---|---|---|
1 |
/* |
|
2 |
AMiRo-Apps is a collection of applications for the Autonomous Mini Robot (AMiRo) platform. |
|
3 |
Copyright (C) 2018..2019 Thomas Schöpping et al. |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
#ifndef _OSCONF_H_ |
|
20 |
#define _OSCONF_H_ |
|
21 |
|
|
22 |
#include <HelloWorld_osconf.h> |
|
23 |
|
|
24 |
#endif /* _OSCONF_H_ */ |
configurations/HelloWorld/modules/DiWheelDrive_1-1/urtwareconf.h | ||
---|---|---|
1 |
/* |
|
2 |
AMiRo-Apps is a collection of applications for the Autonomous Mini Robot (AMiRo) platform. |
|
3 |
Copyright (C) 2018..2019 Thomas Schöpping et al. |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
#ifndef _URTWARECONF_H_ |
|
20 |
#define _URTWARECONF_H_ |
|
21 |
|
|
22 |
#include <HelloWorld_urtwareconf.h> |
|
23 |
|
|
24 |
#endif /* _URTWARECONF_H_ */ |
configurations/HelloWorld/modules/HelloWorld_osconf.h | ||
---|---|---|
1 | 1 |
/* |
2 | 2 |
AMiRo-Apps is a collection of applications for the Autonomous Mini Robot (AMiRo) platform. |
3 |
Copyright (C) 2018..2019 Thomas Schöpping et al.
|
|
3 |
Copyright (C) 2018..2020 Thomas Schöpping et al.
|
|
4 | 4 |
|
5 | 5 |
This program is free software: you can redistribute it and/or modify |
6 | 6 |
it under the terms of the GNU General Public License as published by |
configurations/HelloWorld/modules/HelloWorld_urtwareconf.h | ||
---|---|---|
1 | 1 |
/* |
2 | 2 |
AMiRo-Apps is a collection of applications for the Autonomous Mini Robot (AMiRo) platform. |
3 |
Copyright (C) 2018..2019 Thomas Schöpping et al.
|
|
3 |
Copyright (C) 2018..2020 Thomas Schöpping et al.
|
|
4 | 4 |
|
5 | 5 |
This program is free software: you can redistribute it and/or modify |
6 | 6 |
it under the terms of the GNU General Public License as published by |
... | ... | |
16 | 16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 |
*/ |
18 | 18 |
|
19 |
#ifndef _HELLOWORLD_URTWARECONF_H_
|
|
20 |
#define _HELLOWORLD_URTWARECONF_H_
|
|
19 |
#ifndef HELLOWORLD_URTWARECONF_H
|
|
20 |
#define HELLOWORLD_URTWARECONF_H
|
|
21 | 21 |
|
22 | 22 |
/* |
23 | 23 |
* compatibility guards |
24 | 24 |
*/ |
25 | 25 |
#define _URTWARE_CFG_ |
26 |
#define URTWARE_CFG_VERSION_MAJOR 0 |
|
27 |
#define URTWARE_CFG_VERSION_MINOR 1 |
|
26 |
#define URTWARE_CFG_VERSION_MAJOR 0 |
|
27 |
#define URTWARE_CFG_VERSION_MINOR 1 |
|
28 |
|
|
29 |
#include <stdbool.h> |
|
28 | 30 |
|
29 | 31 |
/** |
30 | 32 |
* @brief Width of the urt_delay_t data type. |
... | ... | |
32 | 34 |
* @details Possible values are 32 and 64 bits. |
33 | 35 |
* By definition time is represented in microseconds. |
34 | 36 |
*/ |
35 |
#define URT_CFG_DELAY_WIDTH 32 |
|
37 |
#define URT_CFG_DELAY_WIDTH 32 |
|
38 |
|
|
39 |
/** |
|
40 |
* @brief Width of the urt_nodestage_t data type. |
|
41 |
* |
|
42 |
* @details Possible values are 8, 16, 32, and 64 bits. |
|
43 |
*/ |
|
44 |
#define URT_CFG_NODESTAGE_WIDTH 16 |
|
45 |
|
|
46 |
/** |
|
47 |
* @brief Debug enable flag. |
|
48 |
*/ |
|
49 |
#define URT_CFG_DEBUG_ENABLED true |
|
50 |
|
|
51 |
/** |
|
52 |
* @brief Enable flag for the publish-subscribe system. |
|
53 |
*/ |
|
54 |
#define URT_CFG_PUBSUB_ENABLED true |
|
36 | 55 |
|
37 | 56 |
/** |
38 | 57 |
* @brief Width of the urt_topicid_t data type. |
39 | 58 |
* |
40 | 59 |
* @details Possible values are 8, 16, 32, and 64 bits. |
41 | 60 |
*/ |
42 |
#define URT_CFG_TOPICID_WIDTH 16
|
|
61 |
#define URT_CFG_PUBSUB_TOPICID_WIDTH 16
|
|
43 | 62 |
|
44 | 63 |
/** |
45 |
* @brief Width of the urt_nodestage_t data type. |
|
64 |
* @brief Flag to enable profiling of the publish-subscribe system. |
|
65 |
*/ |
|
66 |
#define URT_CFG_PUBSUB_PROFILING true |
|
67 |
|
|
68 |
/** |
|
69 |
* @brief Flag to enable deadline QoS for the publish-subscribe system. |
|
70 |
*/ |
|
71 |
#define URT_CFG_PUBSUB_QOS_DEADLINECHECKS true |
|
72 |
|
|
73 |
/** |
|
74 |
* @brief Flag to enable rate QoS for the publish-subscribe system. |
|
75 |
*/ |
|
76 |
#define URT_CFG_PUBSUB_QOS_RATECHECKS true |
|
77 |
|
|
78 |
/** |
|
79 |
* @brief Flag to enable jitter QoS for the publish-subscribe system |
|
80 |
*/ |
|
81 |
#define URT_CFG_PUBSUB_QOS_JITTERCHECKS true |
|
82 |
|
|
83 |
/** |
|
84 |
* @brief Enable flag for remote procedure calls. |
|
85 |
*/ |
|
86 |
#define URT_CFG_RPC_ENABLED true |
|
87 |
|
|
88 |
/** |
|
89 |
* @brief Width of the urt_serviceid_t data type. |
|
46 | 90 |
* |
47 | 91 |
* @details Possible values are 8, 16, 32, and 64 bits. |
48 | 92 |
*/ |
49 |
#define URT_CFG_NODESTAGE_WIDTH 16
|
|
93 |
#define URT_CFG_RPC_SERVICEID_WIDTH 16
|
|
50 | 94 |
|
51 | 95 |
/** |
52 |
* @brief Debug enable flag. |
|
96 |
* @brief Flag to enable profiling of remote procedure calls. |
|
97 |
*/ |
|
98 |
#define URT_CFG_RPC_PROFILING true |
|
99 |
|
|
100 |
/** |
|
101 |
* @brief Flag to enable deadline QoS for remote procedure calls. |
|
102 |
*/ |
|
103 |
#define URT_CFG_RPC_QOS_DEADLINECHECKS true |
|
104 |
|
|
105 |
/** |
|
106 |
* @brief Flag to enable jitter QoS for remote procedure calls. |
|
53 | 107 |
*/ |
54 |
#define URT_CFG_DEBUG true
|
|
108 |
#define URT_CFG_RPC_QOS_JITTERCHECKS true
|
|
55 | 109 |
|
56 |
#endif /* _HELLOWORLD_URTWARECONF_H_ */ |
|
110 |
#endif /* HELLOWORLD_URTWARECONF_H */ |
configurations/HelloWorld/modules/NUCLEO-L476RG/Makefile | ||
---|---|---|
1 |
################################################################################ |
|
2 |
# AMiRo-Apps is a collection of applications for the Autonomous Mini Robot # |
|
3 |
# (AMiRo) platform. # |
|
4 |
# Copyright (C) 2018..2020 Thomas Schöpping et al. # |
|
5 |
# # |
|
6 |
# This program is free software: you can redistribute it and/or modify # |
|
7 |
# it under the terms of the GNU General Public License as published by # |
|
8 |
# the Free Software Foundation, either version 3 of the License, or # |
|
9 |
# (at your option) any later version. # |
|
10 |
# # |
|
11 |
# This program is distributed in the hope that it will be useful, # |
|
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of # |
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
|
14 |
# GNU General Public License for more details. # |
|
15 |
# # |
|
16 |
# You should have received a copy of the GNU General Public License # |
|
17 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. # |
|
18 |
# # |
|
19 |
# This research/work was supported by the Cluster of Excellence Cognitive # |
|
20 |
# Interaction Technology 'CITEC' (EXC 277) at Bielefeld University, which is # |
|
21 |
# funded by the German Research Foundation (DFG). # |
|
22 |
################################################################################ |
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
################################################################################ |
|
27 |
# Build global options # |
|
28 |
# NOTE: Can be overridden externally. # |
|
29 |
# # |
|
30 |
|
|
31 |
# Compiler options here. |
|
32 |
ifeq ($(USE_OPT),) |
|
33 |
USE_OPT = -O2 -fomit-frame-pointer -falign-functions=16 -fstack-usage |
|
34 |
export USE_OPT |
|
35 |
endif |
|
36 |
|
|
37 |
# C specific options here (added to USE_OPT). |
|
38 |
ifeq ($(USE_COPT),) |
|
39 |
USE_COPT = -std=c11 |
|
40 |
export USE_COPT |
|
41 |
endif |
|
42 |
|
|
43 |
# C++ specific options here (added to USE_OPT). |
|
44 |
ifeq ($(USE_CPPOPT),) |
|
45 |
USE_CPPOPT = -fno-rtti -std=c++17 |
|
46 |
export USE_CPPOPT |
|
47 |
endif |
|
48 |
|
|
49 |
# Enable this if you want the linker to remove unused code and data |
|
50 |
ifeq ($(USE_LINK_GC),) |
|
51 |
USE_LINK_GC = yes |
|
52 |
export USE_LINK_GC |
|
53 |
endif |
|
54 |
|
|
55 |
# Linker extra options here. |
|
56 |
ifeq ($(USE_LDOPT),) |
|
57 |
USE_LDOPT = |
|
58 |
export USE_LDOPT |
|
59 |
endif |
|
60 |
|
|
61 |
# Enable this if you want link time optimizations (LTO) |
|
62 |
ifeq ($(USE_LTO),) |
|
63 |
USE_LTO = yes |
|
64 |
export USE_LTO |
|
65 |
endif |
|
66 |
|
|
67 |
# If enabled, this option allows to compile the application in THUMB mode. |
|
68 |
ifeq ($(USE_THUMB),) |
|
69 |
USE_THUMB = yes |
|
70 |
export USE_THUMB |
|
71 |
endif |
|
72 |
|
|
73 |
# Enable this if you want to see the full log while compiling. |
|
74 |
ifeq ($(USE_VERBOSE_COMPILE),) |
|
75 |
USE_VERBOSE_COMPILE = no |
|
76 |
export USE_VERBOSE_COMPILE |
|
77 |
endif |
|
78 |
|
|
79 |
# # |
|
80 |
# Build global options # |
|
81 |
################################################################################ |
|
82 |
|
|
83 |
################################################################################ |
|
84 |
# Sources and paths # |
|
85 |
# # |
|
86 |
|
|
87 |
# environment setup |
|
88 |
include ../modules.mk |
|
89 |
|
|
90 |
# include apps |
|
91 |
include $(APPS_DIR)/HelloWorld/HelloWorld.mk |
|
92 |
|
|
93 |
# middleware setup |
|
94 |
include $(MIDDLEWARE_DIR)/middleware.mk |
|
95 |
|
|
96 |
# C sources |
|
97 |
APPS_CSRC += $(HelloWorldAPP_CSRC) \ |
|
98 |
$(MIDDLEWARE_CSRC) |
|
99 |
|
|
100 |
# C++ sources |
|
101 |
APPS_CPPSRC += $(HelloWorldAPP_CPPSRC) \ |
|
102 |
$(MIDDLEWARE_CPPSRC) |
|
103 |
|
|
104 |
# include directories for configurations |
|
105 |
APPS_INC += $(realpath .) \ |
|
106 |
$(HelloWorldAPP_INC) \ |
|
107 |
$(MIDDLEWARE_INC) |
|
108 |
|
|
109 |
# # |
|
110 |
# Sources and paths # |
|
111 |
################################################################################ |
|
112 |
|
|
113 |
################################################################################ |
|
114 |
# Start of user section # |
|
115 |
# # |
|
116 |
|
|
117 |
# List all user defines here |
|
118 |
UDEFS += |
|
119 |
export UDEFS |
|
120 |
|
|
121 |
# List all ASM defines here |
|
122 |
UADEFS += |
|
123 |
export UADEFS |
|
124 |
|
|
125 |
# List all user directories here |
|
126 |
UINCDIR += |
|
127 |
export UINCDIR |
|
128 |
|
|
129 |
# List all directories to look for user libraries here |
|
130 |
ULIBDIR += |
|
131 |
export ULIBDIR |
|
132 |
|
|
133 |
# List all user libraries here |
|
134 |
ULIBS += |
|
135 |
export ULIBS |
|
136 |
|
|
137 |
# # |
|
138 |
# End of user defines # |
|
139 |
################################################################################ |
|
140 |
|
|
141 |
################################################################################ |
|
142 |
# Start of targets section # |
|
143 |
# |
|
144 |
|
|
145 |
# set the build directory |
|
146 |
ifeq ($(BUILDDIR),) |
|
147 |
BUILDDIR = $(realpath .)/build |
|
148 |
endif |
|
149 |
export BUILDDIR |
|
150 |
|
|
151 |
# call Makefile from OS |
|
152 |
all: |
|
153 |
$(MAKE) -C $(OS_DIR)/AMiRo-OS/modules/NUCLEO-L476RG/ |
|
154 |
|
|
155 |
clean: |
|
156 |
$(MAKE) -C $(OS_DIR)/AMiRo-OS/modules/NUCLEO-L476RG/ clean |
|
157 |
|
|
158 |
flash: |
|
159 |
$(MAKE) -C $(OS_DIR)/AMiRo-OS/modules/NUCLEO-L476RG/ flash |
|
160 |
|
|
161 |
# # |
|
162 |
# End of targets section # |
|
163 |
################################################################################ |
configurations/HelloWorld/modules/NUCLEO-L476RG/mainincludes.hpp | ||
---|---|---|
1 |
/* |
|
2 |
AMiRo-Apps is a collection of applications for the Autonomous Mini Robot (AMiRo) platform. |
|
3 |
Copyright (C) 2018..2020 Thomas Schöpping et al. |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
#ifndef MAININCLUDES_HPP |
|
20 |
#define MAININCLUDES_HPP |
|
21 |
|
|
22 |
#include <urtware.h> |
|
23 |
|
|
24 |
#endif /* MAININCLUDES_HPP */ |
configurations/HelloWorld/modules/NUCLEO-L476RG/osconf.h | ||
---|---|---|
1 |
/* |
|
2 |
AMiRo-Apps is a collection of applications for the Autonomous Mini Robot (AMiRo) platform. |
|
3 |
Copyright (C) 2018..2020 Thomas Schöpping et al. |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
#ifndef OSCONF_H |
|
20 |
#define OSCONF_H |
|
21 |
|
|
22 |
#include <HelloWorld_osconf.h> |
|
23 |
|
|
24 |
#define OS_CFG_TESTS_ENABLE false |
|
25 |
|
|
26 |
#define OS_CFG_SSSP_ENABLE false |
|
27 |
|
|
28 |
#endif /* OSCONF_H */ |
configurations/HelloWorld/modules/NUCLEO-L476RG/urtwareconf.h | ||
---|---|---|
1 |
/* |
|
2 |
AMiRo-Apps is a collection of applications for the Autonomous Mini Robot (AMiRo) platform. |
|
3 |
Copyright (C) 2018..2020 Thomas Schöpping et al. |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
#ifndef URTWARECONF_H |
|
20 |
#define URTWARECONF_H |
|
21 |
|
|
22 |
#include <HelloWorld_urtwareconf.h> |
|
23 |
|
|
24 |
#endif /* URTWARECONF_H */ |
configurations/HelloWorld/modules/modules.mk | ||
---|---|---|
1 | 1 |
################################################################################ |
2 | 2 |
# AMiRo-Apps is a collection of applications for the Autonomous Mini Robot # |
3 | 3 |
# (AMiRo) platform. # |
4 |
# Copyright (C) 2018..2019 Thomas Schöpping et al. #
|
|
4 |
# Copyright (C) 2018..2020 Thomas Schöpping et al. #
|
|
5 | 5 |
# # |
6 | 6 |
# This program is free software: you can redistribute it and/or modify # |
7 | 7 |
# it under the terms of the GNU General Public License as published by # |
... | ... | |
27 | 27 |
APPCONFIG_MODULES_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) |
28 | 28 |
|
29 | 29 |
# environment setup |
30 |
CONFIG_USE_MIDDLEWARE = true |
|
31 | 30 |
include $(APPCONFIG_MODULES_DIR)/../../apps.mk |
32 | 31 |
|
33 |
# include directories for configurations |
|
34 |
APPSINC += $(APPCONFIG_MODULES_DIR) |
|
32 |
# include paths |
|
33 |
APPS_INC += $(APPCONFIG_MODULES_DIR) |
|
34 |
|
|
35 |
# C source files |
|
36 |
APPS_CSRC += |
|
35 | 37 |
|
36 |
# set the build directory |
|
37 |
ifeq ($(BUILDDIR),) |
|
38 |
BUILDDIR = $(APPCONFIG_MODULE_DIR)/build |
|
39 |
endif |
|
40 |
export BUILDDIR |
configurations/apps.mk | ||
---|---|---|
1 | 1 |
################################################################################ |
2 | 2 |
# AMiRo-Apps is a collection of applications for the Autonomous Mini Robot # |
3 | 3 |
# (AMiRo) platform. # |
4 |
# Copyright (C) 2018..2019 Thomas Schöpping et al. #
|
|
4 |
# Copyright (C) 2018..2020 Thomas Schöpping et al. #
|
|
5 | 5 |
# # |
6 | 6 |
# This program is free software: you can redistribute it and/or modify # |
7 | 7 |
# it under the terms of the GNU General Public License as published by # |
... | ... | |
29 | 29 |
# absolute path to the applications directory |
30 | 30 |
APPS_DIR := $(APPSCONFIG_DIR)/../apps |
31 | 31 |
|
32 |
# aboslute path to the middleware directory |
|
33 |
MIDDLEWARE_DIR := $(APPSCONFIG_DIR)/../middleware |
|
34 |
|
|
32 | 35 |
# operating system setup |
33 | 36 |
include $(APPSCONFIG_DIR)/../os/os.mk |
34 | 37 |
|
35 |
# middleware setup |
|
36 |
ifneq ($(CONFIG_USE_MIDDLEWARE),) |
|
37 |
$(info middleware enabled) |
|
38 |
include $(APPSCONFIG_DIR)/../middleware/middleware.mk |
|
39 |
APPSINC += $(MIDDLEWAREINC) |
|
40 |
APPSCSRC += $(MIDDLEWARECSRC) |
|
41 |
APPSCPPSRC += $(MIDDLEWARECPPSRC) |
|
42 |
else |
|
43 |
$(info middleware disabled) |
|
44 |
endif |
|
45 |
|
doc/AMiRo-Apps.uml | ||
---|---|---|
1 | 1 |
/' |
2 | 2 |
AMiRo-Apps is a collection of applications for the Autonomous Mini Robot (AMiRo) platform. |
3 |
Copyright (C) 2018..2019 Thomas Schöpping et al.
|
|
3 |
Copyright (C) 2018..2020 Thomas Schöpping et al.
|
|
4 | 4 |
|
5 | 5 |
This program is free software: you can redistribute it and/or modify |
6 | 6 |
it under the terms of the GNU General Public License as published by |
middleware/apps_urtosal.c | ||
---|---|---|
1 |
/* |
|
2 |
AMiRo-Apps is a collection of applications for the Autonomous Mini Robot (AMiRo) platform. |
|
3 |
Copyright (C) 2018..2020 Thomas Schöpping et al. |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
#include <urtware.h> |
|
20 |
|
|
21 |
/*============================================================================*/ |
|
22 |
/* DEPENDENCIES */ |
|
23 |
/*============================================================================*/ |
|
24 |
|
|
25 |
/*============================================================================*/ |
|
26 |
/* DEBUG */ |
|
27 |
/*============================================================================*/ |
|
28 |
|
|
29 |
/*============================================================================*/ |
|
30 |
/* MUTEX */ |
|
31 |
/*============================================================================*/ |
|
32 |
|
|
33 |
/*============================================================================*/ |
|
34 |
/* CONDITION VARIABLE */ |
|
35 |
/*============================================================================*/ |
|
36 |
|
|
37 |
/** |
|
38 |
* @details Due to limitations of ChibiOS, the 'mutex' argument is ignored in |
|
39 |
* this implementation. Instead, the mutex, which was locked by the |
|
40 |
* calling thread most recently is used. |
|
41 |
* In debug builds, however, the argument is still checked to be |
|
42 |
* identical to implicitely selected mutex. |
|
43 |
*/ |
|
44 |
urt_osCondvarWaitStatus_t urtCondvarWait(urt_osCondvar_t* condvar, urt_osMutex_t* mutex, urt_delay_t timeout) |
|
45 |
{ |
|
46 |
aosDbgCheck(condvar != NULL); |
|
47 |
aosDbgCheck(mutex != NULL); |
|
48 |
aosDbgCheck(chMtxGetNextMutexX() == mutex); // due to limitation of ChibiOS |
|
49 |
|
|
50 |
(void)mutex; |
|
51 |
|
|
52 |
switch (chCondWaitTimeout(condvar, timeout)) { |
|
53 |
case MSG_OK: |
|
54 |
return URT_CONDVAR_WAITSTATUS_SIGNAL; |
|
55 |
case MSG_RESET: |
|
56 |
return URT_CONDVAR_WAITSTATUS_BROADCAST; |
|
57 |
case MSG_TIMEOUT: |
|
58 |
return URT_CONDVAR_WAITSTATUS_TIMEOUT; |
|
59 |
default: |
|
60 |
chSysHalt(__func__); |
|
61 |
return URT_CONDVAR_WAITSTATUS_TIMEOUT; |
|
62 |
} |
|
63 |
} |
|
64 |
|
|
65 |
/*============================================================================*/ |
|
66 |
/* EVENTS */ |
|
67 |
/*============================================================================*/ |
|
68 |
|
|
69 |
urt_osEventMask_t urtEventWait(urt_osEventMask_t mask, urt_osEventWait_t type, urt_delay_t timeout) |
|
70 |
{ |
|
71 |
switch (type) { |
|
72 |
case URT_EVENT_WAIT_ONE: |
|
73 |
return chEvtWaitOneTimeout(mask, timeout); |
|
74 |
case URT_EVENT_WAIT_ANY: |
|
75 |
return chEvtWaitAnyTimeout(mask, timeout); |
|
76 |
case URT_EVENT_WAIT_ALL: |
|
77 |
return chEvtWaitAllTimeout(mask, timeout); |
|
78 |
default: |
|
79 |
return 0; |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
/*============================================================================*/ |
|
84 |
/* STREAMS */ |
|
85 |
/*============================================================================*/ |
|
86 |
|
|
87 |
/*============================================================================*/ |
|
88 |
/* TIME */ |
|
89 |
/*============================================================================*/ |
|
90 |
|
|
91 |
urt_osTime_t urtTimeNow(void) |
|
92 |
{ |
|
93 |
urt_osTime_t time; |
|
94 |
aosSysGetUptime(&time); |
|
95 |
return time; |
|
96 |
} |
|
97 |
|
|
98 |
/*============================================================================*/ |
|
99 |
/* THREAD */ |
|
100 |
/*============================================================================*/ |
|
101 |
|
|
102 |
urt_osThread_t* urtThreadInit(void* memory, size_t size, urt_osThreadPrio_t prio, urt_osThreadFunction_t func, void* arg) |
|
103 |
{ |
|
104 |
aosDbgCheck(memory != NULL); |
|
105 |
aosDbgCheck(size != 0); |
|
106 |
aosDbgCheck(prio >= URT_THREAD_PRIO_LOW_MIN && prio <= URT_THREAD_PRIO_RT_MAX); |
|
107 |
aosDbgCheck(func != NULL); |
|
108 |
|
|
109 |
const thread_descriptor_t descriptor = { |
|
110 |
/* name */ "", |
|
111 |
/* pointer to working area base */ (stkalign_t*)memory, |
|
112 |
/* end of the working area */ &((stkalign_t*)memory)[size / sizeof(stkalign_t)], |
|
113 |
/* thread priority */ prio, |
|
114 |
/* thread function pointer */ func, |
|
115 |
/* thread argument */ arg, |
|
116 |
/* pointer to the parent thread */ chThdGetSelfX(), |
|
117 |
}; |
|
118 |
|
|
119 |
return chThdCreateSuspended(&descriptor); |
|
120 |
} |
|
121 |
|
|
122 |
void urtThreadTerminate(urt_osThread_t* thread, urt_osThreadTerminateSignal_t sig) |
|
123 |
{ |
|
124 |
aosDbgCheck(thread != NULL); |
|
125 |
|
|
126 |
switch (sig) { |
|
127 |
case URT_THREAD_TERMINATE_REQUEST: |
|
128 |
chThdTerminate(thread); |
|
129 |
return; |
|
130 |
case URT_THREAD_TERMINATE_KILL: |
|
131 |
/* |
|
132 |
* TODO: implement kill functionality |
|
133 |
*/ |
|
134 |
chThdTerminate(thread); |
|
135 |
return; |
|
136 |
} |
|
137 |
} |
|
138 |
|
|
139 |
urt_osThreadState_t urtThreadGetState(urt_osThread_t* thread) |
|
140 |
{ |
|
141 |
aosDbgCheck(thread != NULL); |
|
142 |
|
|
143 |
switch (thread->state) { |
|
144 |
case CH_STATE_CURRENT: |
|
145 |
return URT_THREAD_STATE_RUNNING; |
|
146 |
case CH_STATE_READY: |
|
147 |
return URT_THREAD_STATE_READY; |
|
148 |
case CH_STATE_SLEEPING: |
|
149 |
return URT_THREAD_STATE_SLEEPING; |
|
150 |
case CH_STATE_WTSTART: |
|
151 |
case CH_STATE_SUSPENDED: |
|
152 |
return URT_THREAD_STATE_SUSPENDED; |
|
153 |
case CH_STATE_FINAL: |
|
154 |
return URT_THREAD_STATE_TERMINATED; |
|
155 |
case CH_STATE_QUEUED: |
|
156 |
case CH_STATE_WTSEM: |
|
157 |
case CH_STATE_WTMTX: |
|
158 |
case CH_STATE_WTCOND: |
|
159 |
case CH_STATE_WTEXIT: |
|
160 |
case CH_STATE_WTOREVT: |
|
161 |
case CH_STATE_WTANDEVT: |
|
162 |
case CH_STATE_SNDMSGQ: |
|
163 |
case CH_STATE_SNDMSG: |
|
164 |
case CH_STATE_WTMSG: |
|
165 |
default: |
|
166 |
return URT_THREAD_STATE_WAITING; |
|
167 |
} |
|
168 |
} |
|
169 |
|
|
170 |
/*============================================================================*/ |
|
171 |
/* TIMER */ |
|
172 |
/*============================================================================*/ |
|
173 |
|
|
174 |
void urtTimerSet(urt_osTimer_t* timer, urt_delay_t delay, urt_osTimerCallback_t callback, void* cbparams) |
|
175 |
{ |
|
176 |
aosDbgCheck(timer != NULL); |
|
177 |
aosDbgCheck(callback != NULL); |
|
178 |
|
|
179 |
if (sizeof(urt_delay_t) > sizeof(aos_interval_t)) { |
|
180 |
aosTimerSetLongInterval(timer, (aos_longinterval_t)delay, callback, cbparams); |
|
181 |
} else { |
|
182 |
aosTimerSetInterval(timer, delay, callback, cbparams); |
|
183 |
} |
|
184 |
return; |
|
185 |
} |
|
186 |
|
|
187 |
void urtTimerSetPeriodic(urt_osTimer_t* timer, urt_delay_t period, urt_osTimerCallback_t callback, void* cbparams) |
|
188 |
{ |
|
189 |
aosDbgCheck(timer != NULL); |
|
190 |
aosDbgCheck(callback != NULL); |
|
191 |
|
|
192 |
if (sizeof(urt_delay_t) > sizeof(aos_interval_t)) { |
|
193 |
aosTimerPeriodicLongInterval(timer, (aos_longinterval_t)period, callback, cbparams); |
|
194 |
} else { |
|
195 |
aosTimerPeriodicInterval(timer, period, callback, cbparams); |
|
196 |
} |
|
197 |
return; |
|
198 |
} |
middleware/apps_urtosal.h | ||
---|---|---|
1 |
/* |
|
2 |
AMiRo-Apps is a collection of applications for the Autonomous Mini Robot (AMiRo) platform. |
|
3 |
Copyright (C) 2018..2020 Thomas Schöpping et al. |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
#ifndef APPS_URTOSAL_H |
|
20 |
#define APPS_URTOSAL_H |
|
21 |
|
|
22 |
/*============================================================================*/ |
|
23 |
/* DEPENDENCIES */ |
|
24 |
/*============================================================================*/ |
|
25 |
|
|
26 |
#include <amiroos.h> |
|
27 |
|
|
28 |
/*============================================================================*/ |
|
29 |
/* DEBUG */ |
|
30 |
/*============================================================================*/ |
|
31 |
|
|
32 |
#define urtDebugAssert(condition) aosDbgAssert(condition) |
|
33 |
|
|
34 |
/*============================================================================*/ |
|
35 |
/* MUTEX */ |
|
36 |
/*============================================================================*/ |
|
37 |
|
|
38 |
/** |
|
39 |
* @brief Mutex lock type. |
|
40 |
*/ |
|
41 |
typedef mutex_t urt_osMutex_t; |
|
42 |
|
|
43 |
#define urtMutexInit(mutex) chMtxObjectInit(mutex) |
|
44 |
|
|
45 |
#define urtMutexLock(mutex) chMtxLock(mutex) |
|
46 |
|
|
47 |
#define urtMutexTryLock(mutex) chMtxTryLock(mutex) |
|
48 |
|
|
49 |
#define urtMutexUnlock(mutex) chMtxUnlock(mutex) |
|
50 |
|
|
51 |
/*============================================================================*/ |
|
52 |
/* CONDITION VARIABLE */ |
|
53 |
/*============================================================================*/ |
|
54 |
|
|
55 |
/** |
|
56 |
* @brief Condition variable type. |
|
57 |
*/ |
|
58 |
typedef condition_variable_t urt_osCondvar_t; |
|
59 |
|
|
60 |
#define urtCondvarInit(condvar) chCondObjectInit(condvar) |
|
61 |
|
|
62 |
#define urtCondvarSignal(condvar) chCondSignal(condvar) |
|
63 |
|
|
64 |
#define urtCondvarBroadcast condvar) chCondBroadcast(condvar) |
|
65 |
|
|
66 |
/*============================================================================*/ |
|
67 |
/* EVENTS */ |
|
68 |
/*============================================================================*/ |
|
69 |
|
|
70 |
/** |
|
71 |
* @brief Type representing an event source object. |
|
72 |
*/ |
|
73 |
typedef event_source_t urt_osEventSource_t; |
|
74 |
|
|
75 |
/** |
|
76 |
* @brief Type representing an event listener object. |
|
77 |
*/ |
|
78 |
typedef event_listener_t urt_osEventListener_t; |
|
79 |
|
|
80 |
/** |
|
81 |
* @brief Type representing event masks. |
|
82 |
* @details Event masks can be used to distinguish and filter events. |
|
83 |
*/ |
|
84 |
typedef eventmask_t urt_osEventMask_t; |
|
85 |
|
|
86 |
/** |
|
87 |
* @brief Type representing event flags. |
|
88 |
* @details Event flags can be used to represent rudimentary metadata or to filter events. |
|
89 |
*/ |
|
90 |
typedef eventflags_t urt_osEventFlags_t; |
|
91 |
|
|
92 |
/** |
|
93 |
* @brief Event mask, which is handles with highest priority. |
|
94 |
*/ |
|
95 |
#define URT_EVENTMASK_MAXPRIO EVENT_MASK(0) |
|
96 |
|
|
97 |
#define urtEventSourceInit(source) chEvtObjectInit(source) |
|
98 |
|
|
99 |
#define urtEventSourceBroadcast(source, flags) chEvtBroadcastFlags(source, flags) |
|
100 |
|
|
101 |
#define urtEventListenerInit(listener) (void)listener |
|
102 |
|
|
103 |
#define urtEventListenerGetFlags(listener) (urt_osEventFlags_t)(listener->flags) |
|
104 |
|
|
105 |
#define urtEventListenerClearFlags(listener) (urt_osEventFlags_t)chEvtGetAndClearFlags(listener) |
|
106 |
|
|
107 |
#define urtEventRegister(source, listener, mask, flags) chEvtRegisterMaskWithFlags(source, listener, mask, flags) |
|
108 |
|
|
109 |
#define urtEventUnregister(source, listener) chEvtUnregister(source, listener) |
|
110 |
|
|
111 |
/*============================================================================*/ |
|
112 |
/* STREAMS */ |
|
113 |
/*============================================================================*/ |
|
114 |
|
|
115 |
#define urtPrintf(fmt, ...) aosprintf(fmt, ##__VA_ARGS__) |
|
116 |
|
|
117 |
#define urtErrPrintf(fmt, ...) aosprintf(fmt, ##__VA_ARGS__) |
|
118 |
|
|
119 |
/*============================================================================*/ |
|
120 |
/* TIME */ |
|
121 |
/*============================================================================*/ |
|
122 |
|
|
123 |
/** |
|
124 |
* @brief The urt_osTime_t represents time at an arbitrary precision. |
|
125 |
*/ |
|
126 |
typedef aos_timestamp_t urt_osTime_t; |
|
127 |
|
|
128 |
#define urtTime2Us(time) (*((urt_osTime_t*)time)) |
|
129 |
|
|
130 |
#define urtTimeAddUs(time, offset) (*((urt_osTime_t*)time) + offset) |
|
131 |
|
|
132 |
/*============================================================================*/ |
|
133 |
/* THREAD */ |
|
134 |
/*============================================================================*/ |
|
135 |
|
|
136 |
/** |
|
137 |
* @brief Thread object type. |
|
138 |
*/ |
|
139 |
typedef thread_t urt_osThread_t; |
|
140 |
|
|
141 |
/** |
|
142 |
* @brief Thread priority data type. |
|
143 |
*/ |
|
144 |
typedef tprio_t urt_osThreadPrio_t; |
|
145 |
|
|
146 |
/** |
|
147 |
* @brief Minimum thread priority. |
|
148 |
*/ |
|
149 |
#define URT_THREAD_PRIO_LOW_MIN AOS_THD_LOWPRIO_MIN |
|
150 |
|
|
151 |
/** |
|
152 |
* @brief Maximum thread priority for low priority class threads. |
|
153 |
*/ |
|
154 |
#define URT_THREAD_PRIO_LOW_MAX AOS_THD_LOWPRIO_MAX |
|
155 |
|
|
156 |
/** |
|
157 |
* @brief Minimum thread priority for normal priority class threads. |
|
158 |
*/ |
|
159 |
#define URT_THREAD_PRIO_NORMAL_MIN AOS_THD_NORMALPRIO_MIN |
|
160 |
|
|
161 |
/** |
|
162 |
* @brief Maximum thread priority for normal priority class threads. |
|
163 |
*/ |
|
164 |
#define URT_THREAD_PRIO_NORMAL_MAX AOS_THD_NORMALPRIO_MAX |
|
165 |
|
|
166 |
/** |
|
167 |
* @brief Minimum thread priority for high priority class threads. |
|
168 |
*/ |
|
169 |
#define URT_THREAD_PRIO_HIGH_MIN AOS_THD_HIGHPRIO_MIN |
|
170 |
|
|
171 |
/** |
|
172 |
* @brief Maximum thread priority for high priority class threads. |
|
173 |
*/ |
|
174 |
#define URT_THREAD_PRIO_HIGH_MAX AOS_THD_HIGHPRIO_MAX |
|
175 |
|
|
176 |
/** |
|
177 |
* @brief Minimum thread priority for real-time class threads. |
|
178 |
*/ |
|
179 |
#define URT_THREAD_PRIO_RT_MIN AOS_THD_RTPRIO_MIN |
|
180 |
|
|
181 |
/** |
|
182 |
* @brief maximum thread priority for real-time class threads. |
|
183 |
*/ |
|
184 |
#define URT_THREAD_PRIO_RT_MAX AOS_THD_RTPRIO_MAX |
|
185 |
|
|
186 |
/** |
|
187 |
* @brief Maximum number of seconds a thread can sleep. |
|
188 |
*/ |
|
189 |
#define URT_THREAD_SLEEP_MAX (float)AOS_THD_MAX_SLEEP_S |
|
190 |
|
|
191 |
/** |
|
192 |
* @brief Maximum number of seconds a thread can sleep. |
|
193 |
*/ |
|
194 |
#define URT_THREAD_SSLEEP_MAX (unsigned int)AOS_THD_MAX_SLEEP_S |
|
195 |
|
|
196 |
/** |
|
197 |
* @brief Maximum number of milliseconds a thread can sleep. |
|
198 |
*/ |
|
199 |
#define URT_THREAD_MSLEEP_MAX (unsigned int)AOS_THD_MAX_SLEEP_MS |
|
200 |
|
|
201 |
/** |
|
202 |
* @brief Maximum number of microseconds a thread can sleep. |
|
203 |
*/ |
|
204 |
#define URT_THREAD_USLEEP_MAX (urt_delay_t)AOS_THD_MAX_SLEEP_US |
|
205 |
|
|
206 |
/** |
|
207 |
* @brief Macro function to layout a thread memory. |
|
208 |
* @details The overall memory required for a thread usually is a combination of the stack and some further data (i.e. the thread object itself). |
|
209 |
* The layout in memory as well as the metadata may differ between kernels and event hardware ports. |
|
210 |
* |
|
211 |
* @param[in] varname The name of the resulting buffer variable. |
|
212 |
* @param[in] stacksize The size of the thread's stack. |
|
213 |
*/ |
|
214 |
#define URT_THREAD_MEMORY(varname, stacksize) THD_WORKING_AREA(varname, stacksize) |
|
215 |
|
|
216 |
#define urtThreadStart(thread) chThdStart(thread) |
|
217 |
|
|
218 |
#define urtThreadYield() chThdYield() |
|
219 |
|
|
220 |
#define urtThreadGetPriority() chThdGetPriorityX() |
|
221 |
|
|
222 |
#define urtThreadSetPriority(prio) { \ |
|
223 |
aosDbgCheck(prio >= URT_THREAD_PRIO_LOW_MIN && prio <= URT_THREAD_PRIO_RT_MAX) \ |
|
224 |
chThdSetPriority(prio); \ |
|
225 |
} |
|
226 |
|
|
227 |
#define urtThreadSleep(seconds) aosThdSleep(seconds) |
|
228 |
|
|
229 |
#define urtThreadSSleep(seconds) aosThdSSleep(seconds) |
|
230 |
|
|
231 |
#define urtThreadMSleep(seconds) aosThdMSleep(seconds) |
|
232 |
|
|
233 |
#define urtThreadUSleep(seconds) aosThdUSleep(seconds) |
|
234 |
|
|
235 |
#define urtThreadSleepUntil(time) aosThdSleepUntil(time) |
|
236 |
|
|
237 |
#define urtThreadExit() chThdExit(MSG_OK) |
|
238 |
|
|
239 |
#define urtThreadJoin(thread) (void)chThdWait(thread) |
|
240 |
|
|
241 |
#define urtThreadGetSelf() chThdGetSelfX() |
|
242 |
|
|
243 |
#define urtThreadGetChildren(thread) (thread->children) |
|
244 |
|
|
245 |
#define urtThreadGetSibling(thread) (thread->sibling) |
|
246 |
|
|
247 |
#define urtThreadGetParent(thread) (thread->parent) |
|
248 |
|
|
249 |
/*============================================================================*/ |
|
250 |
/* TIMER */ |
|
251 |
/*============================================================================*/ |
|
252 |
|
|
253 |
/** |
|
254 |
* @brief Timer object type. |
|
255 |
*/ |
|
256 |
typedef aos_timer_t urt_osTimer_t; |
|
257 |
|
|
258 |
#define urtTimerInit(timer) aosTimerInit(timer) |
|
259 |
|
|
260 |
#define urtTimerReset(timer) aosTimerReset(timer) |
|
261 |
|
|
262 |
#define urtTimerIsArmeed(timer) aosTimerIsArmed(timer) |
|
263 |
|
|
264 |
#endif /* APPS_URTOSAL_H */ |
middleware/middleware.mk | ||
---|---|---|
1 | 1 |
################################################################################ |
2 | 2 |
# AMiRo-Apps is a collection of applications for the Autonomous Mini Robot # |
3 | 3 |
# (AMiRo) platform. # |
4 |
# Copyright (C) 2018..2019 Thomas Schöpping et al. #
|
|
4 |
# Copyright (C) 2018..2020 Thomas Schöpping et al. #
|
|
5 | 5 |
# # |
6 | 6 |
# This program is free software: you can redistribute it and/or modify # |
7 | 7 |
# it under the terms of the GNU General Public License as published by # |
... | ... | |
26 | 26 |
# absolute path to this directory |
27 | 27 |
MIDDLEWARE_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) |
28 | 28 |
|
29 |
include $(MIDDLEWARE_DIR)/uRtWare/Makefile |
|
29 |
# middleware setup |
|
30 |
ifeq ($(CONFIG_MIDDLEWARE),"µRtWare") |
|
31 |
$(info >>> MIDDLEWARE: µRtWare) |
|
30 | 32 |
|
31 |
# include paths |
|
32 |
MIDDLEWAREINC = $(URTWARE_INC) \ |
|
33 |
$(MIDDLEWARE_DIR) |
|
33 |
include $(MIDDLEWARE_DIR)/uRtWare/Makefile |
|
34 | 34 |
|
35 |
# C source files |
|
36 |
MIDDLEWARECSRC = $(URTWARE_CSRC) |
|
35 |
# include paths |
|
36 |
MIDDLEWARE_INC = $(URTWARE_INC) \ |
|
37 |
$(MIDDLEWARE_DIR) |
|
37 | 38 |
|
38 |
# C++ source files |
|
39 |
MIDDLEWARECPPSRC = $(URTWARE_CPPSRC) |
|
39 |
# C source files |
|
40 |
MIDDLEWARE_CSRC = $(URTWARE_CSRC) \ |
|
41 |
$(MIDDLEWARE_DIR)/apps_urtosal.c |
|
40 | 42 |
|
Also available in: Unified diff