blob: b11df4558636203bce26a56269b541bb748edc40 [file] [log] [blame]
Brian Silvermanf91524f2017-09-23 13:15:55 -04001load('//motors:macros.bzl', 'hex_from_elf')
2load("//tools:environments.bzl", "mcu_cpus")
3
Brian Silverman8b638692017-06-26 23:10:26 -07004cc_binary(
5 name = 'medium_salsa.elf',
6 srcs = [
7 'medium_salsa.cc',
8 ],
9 deps = [
10 ':util',
Brian Silverman8d3816a2017-07-03 18:52:15 -070011 ':motor',
12 ':motor_controls',
Brian Silverman8b638692017-06-26 23:10:26 -070013 '//motors/core',
Brian Silverman8d3816a2017-07-03 18:52:15 -070014 '//motors/peripheral:can',
15 '//motors/peripheral:adc',
16 '//motors/usb:legacy',
17 ],
18 restricted_to = mcu_cpus,
19)
20
21cc_library(
22 name = 'motor',
Brian Silverman19ea60f2018-01-03 21:43:15 -080023 visibility = ['//visibility:public'],
Brian Silverman8d3816a2017-07-03 18:52:15 -070024 hdrs = [
25 'motor.h',
26 ],
27 srcs = [
28 'motor.cc',
29 ],
30 deps = [
31 ':algorithms',
32 ':util',
33 '//motors/core',
34 '//motors/peripheral:configuration',
35
36 '//motors/peripheral:adc',
37 '//motors/peripheral:can',
Brian Silverman19ea60f2018-01-03 21:43:15 -080038 '//motors/usb:cdc',
Brian Silverman8b638692017-06-26 23:10:26 -070039 ],
Brian Silvermanf91524f2017-09-23 13:15:55 -040040 restricted_to = mcu_cpus,
Brian Silverman8b638692017-06-26 23:10:26 -070041)
42
Brian Silvermanf91524f2017-09-23 13:15:55 -040043hex_from_elf(
Brian Silverman8b638692017-06-26 23:10:26 -070044 name = 'medium_salsa',
Brian Silvermanf91524f2017-09-23 13:15:55 -040045 restricted_to = mcu_cpus,
Brian Silverman8b638692017-06-26 23:10:26 -070046)
47
48cc_library(
49 name = 'util',
Brian Silvermanf91524f2017-09-23 13:15:55 -040050 visibility = ['//visibility:public'],
Brian Silverman8b638692017-06-26 23:10:26 -070051 hdrs = [
52 'util.h',
53 ],
Brian Silverman8d3816a2017-07-03 18:52:15 -070054 deps = [
55 '//motors/core',
56 ],
57 restricted_to = mcu_cpus,
58)
59
60genrule(
61 name = 'doc',
62 srcs = [
63 'NOTES.md',
64 ],
65 outs = [
66 'NOTES.html',
67 ],
68 cmd = ' '.join([
69 'pandoc',
70 '-f', 'markdown_github-hard_line_breaks',
71 '-t', 'html5',
72 '-o', '$@', '$<',
73 ]),
74)
75
76cc_library(
77 name = 'algorithms',
78 hdrs = [
79 'algorithms.h',
80 ],
81 srcs = [
82 'algorithms.cc',
83 ],
84 compatible_with = mcu_cpus,
85)
86
87cc_test(
88 name = 'algorithms_test',
89 srcs = [
90 'algorithms_test.cc',
91 ],
92 deps = [
93 ':algorithms',
94 '//aos/testing:googletest',
95 ],
96)
97
98cc_library(
99 name = 'math',
Brian Silverman19ea60f2018-01-03 21:43:15 -0800100 visibility = ['//visibility:public'],
Brian Silverman8d3816a2017-07-03 18:52:15 -0700101 hdrs = [
102 'math.h',
103 ],
104 srcs = [
105 'math.cc',
106 ],
107 compatible_with = mcu_cpus,
108)
109
110cc_test(
111 name = 'math_test',
112 srcs = [
113 'math_test.cc',
114 ],
115 deps = [
116 ':math',
117 '//aos/testing:googletest',
118 '//third_party/googletest:googlemock',
119 ],
120)
121
122cc_library(
123 name = 'motor_controls',
124 hdrs = [
125 'motor_controls.h',
126 ],
127 srcs = [
128 'motor_controls.cc',
129 ],
130 deps = [
131 ':math',
132 ':motor',
133 '//motors/peripheral:configuration',
134 '//third_party/eigen',
135 ],
Brian Silvermanf91524f2017-09-23 13:15:55 -0400136 restricted_to = mcu_cpus,
Brian Silverman8b638692017-06-26 23:10:26 -0700137)
Brian Silverman259c4432018-01-15 14:34:21 -0800138
139cc_binary(
140 name = 'button_board.elf',
141 srcs = [
142 'button_board.cc',
143 ],
144 deps = [
145 ':util',
146 '//motors/core',
147 '//motors/peripheral:can',
148 '//motors/peripheral:adc',
149 '//motors/usb',
150 '//motors/usb:cdc',
151 '//motors/usb:hid',
152 ],
153 restricted_to = mcu_cpus,
154)
155
156hex_from_elf(
157 name = 'button_board',
158 restricted_to = mcu_cpus,
159)