summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--core/cortex-m/include/math.h24
2 files changed, 25 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 076f7433cc..331be13137 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,6 @@ all-y+=$(call objs_from_dir,board/$(BOARD),$(board-y))
all-y+=$(call objs_from_dir,common,$(common-y))
all-y+=$(call objs_from_dir,test,$($(PROJECT)-y))
dirs=core/$(CORE) chip/$(CHIP) board/$(BOARD) common test util
-includes=include $(dirs)
+includes=include core/$(CORE)/include $(dirs)
include Makefile.rules
diff --git a/core/cortex-m/include/math.h b/core/cortex-m/include/math.h
new file mode 100644
index 0000000000..485f28ba23
--- /dev/null
+++ b/core/cortex-m/include/math.h
@@ -0,0 +1,24 @@
+/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Math utility functions for ARMv7 */
+
+#ifndef __EC_MATH_H
+#define __EC_MATH_H
+
+#ifdef CONFIG_FPU
+static inline float sqrtf(float v)
+{
+ float root;
+ asm volatile(
+ "fsqrts %0, %1"
+ : "=w" (root)
+ : "w" (v)
+ );
+ return root;
+}
+#endif /* CONFIG_FPU */
+
+#endif /* __EC_MATH_H */