blob: 9b0390735f1c60570ad46ce148f3610c8dc78810 [file] [log] [blame]
Tyler Chatowa79419d2020-08-12 20:12:11 -07001load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
James Kuszmaul293b2172021-11-10 16:20:48 -08002load("//aos:config.bzl", "aos_config")
Tyler Chatowa79419d2020-08-12 20:12:11 -07003
Xander Yee1ad2f7b2023-02-21 14:46:56 -08004exports_files(["roborio_irq_config.json"])
5
Brian Silverman96d12952015-10-12 13:36:42 -04006# This target is everything which should get deployed to the robot.
7filegroup(
Austin Schuhdde64052019-12-11 20:28:00 -08008 name = "starter",
9 srcs = [
Austin Schuh529ac592021-10-14 16:11:13 -070010 "aos_starter",
Austin Schuhdde64052019-12-11 20:28:00 -080011 "starter.sh",
Austin Schuh44e0b142021-10-16 15:51:10 -070012 "starterd.stripped",
13 ],
14 visibility = ["//visibility:public"],
15)
16
17filegroup(
18 name = "starter_stripped",
19 srcs = [
20 "aos_starter.stripped",
21 "starter.sh",
22 "starterd.stripped",
Austin Schuhdde64052019-12-11 20:28:00 -080023 ],
24 visibility = ["//visibility:public"],
Brian Silverman96d12952015-10-12 13:36:42 -040025)
Brian Silverman100534c2015-09-07 15:51:23 -040026
Tyler Chatowa79419d2020-08-12 20:12:11 -070027cc_library(
James Kuszmaul3224b8e2022-01-07 19:00:39 -080028 name = "subprocess",
29 srcs = ["subprocess.cc"],
30 hdrs = ["subprocess.h"],
31 visibility = ["//visibility:public"],
32 deps = [
33 ":starter_fbs",
34 ":starter_rpc_fbs",
35 "//aos/events:event_loop",
36 "//aos/events:shm_event_loop",
37 "//aos/util:scoped_pipe",
James Kuszmaul6295a642022-03-22 15:23:59 -070038 "//aos/util:top",
James Kuszmaul3224b8e2022-01-07 19:00:39 -080039 "@com_github_google_glog//:glog",
40 ],
41)
42
43cc_library(
Tyler Chatowa79419d2020-08-12 20:12:11 -070044 name = "starterd_lib",
45 srcs = ["starterd_lib.cc"],
46 hdrs = ["starterd_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -080047 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -070048 deps = [
49 ":starter_fbs",
50 ":starter_rpc_fbs",
James Kuszmaul3224b8e2022-01-07 19:00:39 -080051 ":subprocess",
Tyler Chatowa79419d2020-08-12 20:12:11 -070052 "//aos:configuration",
53 "//aos:macros",
54 "//aos/events:shm_event_loop",
55 "@com_github_google_glog//:glog",
56 ],
57)
58
James Kuszmaul293b2172021-11-10 16:20:48 -080059aos_config(
60 name = "multinode_pingpong_config",
61 src = "multinode_pingpong.json",
62 flatbuffers = [
63 "//aos/events:ping_fbs",
64 "//aos/events:pong_fbs",
65 ":starter_rpc_fbs",
66 ":starter_fbs",
67 "//aos/logging:log_message_fbs",
68 "//aos/events:event_loop_fbs",
69 "//aos/network:message_bridge_client_fbs",
70 "//aos/network:remote_message_fbs",
71 "//aos/network:timestamp_fbs",
72 "//aos/network:message_bridge_server_fbs",
73 ],
74 target_compatible_with = ["@platforms//os:linux"],
75)
76
Tyler Chatowa79419d2020-08-12 20:12:11 -070077cc_test(
James Kuszmauld42edb42022-01-07 18:00:16 -080078 name = "subprocess_test",
79 srcs = ["subprocess_test.cc"],
80 data = [
81 "//aos/events:pingpong_config",
82 ],
James Kuszmaula03bdf02022-02-26 16:39:45 -080083 flaky = True,
James Kuszmauld42edb42022-01-07 18:00:16 -080084 # The roborio compiler doesn't support <filesystem>.
85 target_compatible_with =
86 ["@platforms//os:linux"],
87 deps = [
88 ":subprocess",
89 "//aos/events:shm_event_loop",
90 "//aos/testing:googletest",
91 "//aos/testing:path",
92 "//aos/testing:tmpdir",
93 ],
94)
95
96cc_test(
Tyler Chatowa79419d2020-08-12 20:12:11 -070097 name = "starter_test",
98 srcs = ["starter_test.cc"],
99 data = [
James Kuszmaul293b2172021-11-10 16:20:48 -0800100 ":multinode_pingpong_config",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700101 "//aos/events:ping",
102 "//aos/events:pingpong_config",
103 "//aos/events:pong",
104 ],
James Kuszmaulbe55e1c2022-04-02 20:06:01 -0700105 # TODO(james): Fix tihs.
106 flaky = True,
James Kuszmaul293b2172021-11-10 16:20:48 -0800107 linkopts = ["-lstdc++fs"],
James Kuszmaule7c7e582022-01-07 18:50:01 -0800108 shard_count = 4,
James Kuszmaul293b2172021-11-10 16:20:48 -0800109 # The roborio compiler doesn't support <filesystem>.
110 target_compatible_with =
111 select({
112 "//tools/platforms/hardware:roborio": ["@platforms//:incompatible"],
113 "//conditions:default": ["@platforms//os:linux"],
114 }),
Tyler Chatowa79419d2020-08-12 20:12:11 -0700115 deps = [
116 ":starter_rpc_lib",
117 ":starterd_lib",
118 "//aos/events:ping_fbs",
119 "//aos/events:pong_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800120 "//aos/events:simulated_event_loop",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700121 "//aos/testing:googletest",
Austin Schuh373f1762021-06-02 21:07:09 -0700122 "//aos/testing:path",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700123 "//aos/testing:tmpdir",
124 ],
125)
126
127cc_binary(
128 name = "starterd",
129 srcs = ["starterd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800130 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700131 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700132 deps = [
133 ":starterd_lib",
134 "//aos:init",
135 ],
136)
137
138cc_library(
139 name = "starter_rpc_lib",
140 srcs = ["starter_rpc_lib.cc"],
141 hdrs = ["starter_rpc_lib.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800142 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul293b2172021-11-10 16:20:48 -0800143 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700144 deps = [
145 ":starter_fbs",
146 ":starter_rpc_fbs",
James Kuszmaul293b2172021-11-10 16:20:48 -0800147 ":starterd_lib",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700148 "//aos:configuration",
149 "//aos:init",
150 "//aos/events:shm_event_loop",
151 ],
152)
153
154cc_binary(
Austin Schuh529ac592021-10-14 16:11:13 -0700155 name = "aos_starter",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700156 srcs = ["starter_cmd.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800157 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh529ac592021-10-14 16:11:13 -0700158 visibility = ["//visibility:public"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700159 deps = [
160 ":starter_rpc_lib",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700161 "//aos/time",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700162 "@com_github_google_glog//:glog",
Philipp Schrader08537492021-01-23 16:17:55 -0800163 "@com_google_absl//absl/strings:str_format",
Tyler Chatowa79419d2020-08-12 20:12:11 -0700164 ],
165)
166
167flatbuffer_cc_library(
168 name = "starter_fbs",
169 srcs = ["starter.fbs"],
170 gen_reflections = True,
James Kuszmaul6295a642022-03-22 15:23:59 -0700171 includes = ["//aos/util:process_info_fbs_includes"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800172 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700173 visibility = ["//visibility:public"],
174)
175
176flatbuffer_cc_library(
Austin Schuh608514f2022-12-30 15:51:30 -0800177 name = "kthread_fbs",
178 srcs = ["kthread.fbs"],
179 gen_reflections = True,
180 target_compatible_with = ["@platforms//os:linux"],
181 visibility = ["//visibility:public"],
182)
183
184flatbuffer_cc_library(
Tyler Chatowa79419d2020-08-12 20:12:11 -0700185 name = "starter_rpc_fbs",
186 srcs = ["starter_rpc.fbs"],
187 gen_reflections = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800188 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatowa79419d2020-08-12 20:12:11 -0700189 visibility = ["//visibility:public"],
190)
James Kuszmaul77e19812021-05-19 21:36:10 -0700191
192py_binary(
193 name = "starter_demo",
194 srcs = ["starter_demo.py"],
195 args = [
196 "$(rootpath :starterd)",
197 "\"$(rootpaths //aos/events:pingpong_config)\"",
198 "$(rootpath //aos/events:ping)",
199 "$(rootpath //aos/events:pong)",
Austin Schuh529ac592021-10-14 16:11:13 -0700200 "$(rootpath :aos_starter)",
Austin Schuh48d10d62022-10-16 22:19:23 -0700201 "$(rootpath //aos:aos_dump)",
202 "$(rootpath //aos/events/logging:logger_main)",
James Kuszmaul77e19812021-05-19 21:36:10 -0700203 ],
204 data = [
Austin Schuh529ac592021-10-14 16:11:13 -0700205 ":aos_starter",
James Kuszmaul77e19812021-05-19 21:36:10 -0700206 ":starterd",
Austin Schuh48d10d62022-10-16 22:19:23 -0700207 "//aos:aos_dump",
James Kuszmaul77e19812021-05-19 21:36:10 -0700208 "//aos/events:ping",
209 "//aos/events:pingpong_config",
210 "//aos/events:pong",
Austin Schuh48d10d62022-10-16 22:19:23 -0700211 "//aos/events/logging:logger_main",
James Kuszmaul77e19812021-05-19 21:36:10 -0700212 ],
213)
Austin Schuh2ec71fd2022-12-30 14:48:59 -0800214
215cc_library(
216 name = "irq_affinity_lib",
217 srcs = ["irq_affinity_lib.cc"],
218 hdrs = ["irq_affinity_lib.h"],
219 deps = [
220 "//aos/scoped:scoped_fd",
221 "@com_github_google_glog//:glog",
222 "@com_google_absl//absl/strings",
223 ],
224)
225
Austin Schuh608514f2022-12-30 15:51:30 -0800226cc_binary(
227 name = "irq_affinity",
228 srcs = [
229 "irq_affinity.cc",
230 ],
Alexander Yeee61cac32023-02-11 19:40:40 -0800231 data = [
232 "//aos/starter:rockpi_config.json",
233 ],
Austin Schuh9f164e92022-12-29 16:15:28 -0800234 visibility = ["//visibility:public"],
Austin Schuh608514f2022-12-30 15:51:30 -0800235 deps = [
236 ":irq_affinity_lib",
237 ":kthread_fbs",
238 "//aos:init",
239 "//aos:realtime",
240 "//aos/events:shm_event_loop",
241 "//aos/util:top",
242 ],
243)
244
Austin Schuh2ec71fd2022-12-30 14:48:59 -0800245cc_test(
246 name = "irq_affinity_lib_test",
247 srcs = ["irq_affinity_lib_test.cc"],
248 deps = [
249 ":irq_affinity_lib",
250 "//aos/testing:googletest",
251 ],
252)