blob: e75f74b3cc922c39b12a5eeda1640a38f1fa707d [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',
23 hdrs = [
24 'motor.h',
25 ],
26 srcs = [
27 'motor.cc',
28 ],
29 deps = [
30 ':algorithms',
31 ':util',
32 '//motors/core',
33 '//motors/peripheral:configuration',
34
35 '//motors/peripheral:adc',
36 '//motors/peripheral:can',
Brian Silvermanf91524f2017-09-23 13:15:55 -040037 '//motors/usb:legacy',
Brian Silverman8b638692017-06-26 23:10:26 -070038 ],
Brian Silvermanf91524f2017-09-23 13:15:55 -040039 restricted_to = mcu_cpus,
Brian Silverman8b638692017-06-26 23:10:26 -070040)
41
Brian Silvermanf91524f2017-09-23 13:15:55 -040042hex_from_elf(
Brian Silverman8b638692017-06-26 23:10:26 -070043 name = 'medium_salsa',
Brian Silvermanf91524f2017-09-23 13:15:55 -040044 restricted_to = mcu_cpus,
Brian Silverman8b638692017-06-26 23:10:26 -070045)
46
47cc_library(
48 name = 'util',
Brian Silvermanf91524f2017-09-23 13:15:55 -040049 visibility = ['//visibility:public'],
Brian Silverman8b638692017-06-26 23:10:26 -070050 hdrs = [
51 'util.h',
52 ],
Brian Silverman8d3816a2017-07-03 18:52:15 -070053 deps = [
54 '//motors/core',
55 ],
56 restricted_to = mcu_cpus,
57)
58
59genrule(
60 name = 'doc',
61 srcs = [
62 'NOTES.md',
63 ],
64 outs = [
65 'NOTES.html',
66 ],
67 cmd = ' '.join([
68 'pandoc',
69 '-f', 'markdown_github-hard_line_breaks',
70 '-t', 'html5',
71 '-o', '$@', '$<',
72 ]),
73)
74
75cc_library(
76 name = 'algorithms',
77 hdrs = [
78 'algorithms.h',
79 ],
80 srcs = [
81 'algorithms.cc',
82 ],
83 compatible_with = mcu_cpus,
84)
85
86cc_test(
87 name = 'algorithms_test',
88 srcs = [
89 'algorithms_test.cc',
90 ],
91 deps = [
92 ':algorithms',
93 '//aos/testing:googletest',
94 ],
95)
96
97cc_library(
98 name = 'math',
99 hdrs = [
100 'math.h',
101 ],
102 srcs = [
103 'math.cc',
104 ],
105 compatible_with = mcu_cpus,
106)
107
108cc_test(
109 name = 'math_test',
110 srcs = [
111 'math_test.cc',
112 ],
113 deps = [
114 ':math',
115 '//aos/testing:googletest',
116 '//third_party/googletest:googlemock',
117 ],
118)
119
120cc_library(
121 name = 'motor_controls',
122 hdrs = [
123 'motor_controls.h',
124 ],
125 srcs = [
126 'motor_controls.cc',
127 ],
128 deps = [
129 ':math',
130 ':motor',
131 '//motors/peripheral:configuration',
132 '//third_party/eigen',
133 ],
Brian Silvermanf91524f2017-09-23 13:15:55 -0400134 restricted_to = mcu_cpus,
Brian Silverman8b638692017-06-26 23:10:26 -0700135)