summaryrefslogtreecommitdiff
path: root/core/cortex-m0
diff options
context:
space:
mode:
Diffstat (limited to 'core/cortex-m0')
-rw-r--r--core/cortex-m0/build.mk14
-rw-r--r--core/cortex-m0/config_core.h5
-rw-r--r--core/cortex-m0/cpu.h3
-rw-r--r--core/cortex-m0/panic.c2
-rw-r--r--core/cortex-m0/vecttable.c6
5 files changed, 12 insertions, 18 deletions
diff --git a/core/cortex-m0/build.mk b/core/cortex-m0/build.mk
index f3cce27eea..7de8956a4d 100644
--- a/core/cortex-m0/build.mk
+++ b/core/cortex-m0/build.mk
@@ -6,14 +6,6 @@
# Cortex-M0 core OS files build
#
-# When set to 1, exclusively use builtins from compiler-rt.
-# When set to 0, use EC's builtins.
-USE_LLVM_COMPILER_RT:=0
-
-ifeq ($(USE_LLVM_COMPILER_RT),1)
-CFLAGS_CPU+=-DUSE_LLVM_COMPILER_RT
-endif
-
# CPU specific compilation flags
CFLAGS_CPU+=-mthumb
ifeq ($(cc-name),clang)
@@ -32,12 +24,14 @@ LDFLAGS_EXTRA+=-flto
endif
core-y=cpu.o debug.o init.o thumb_case.o mula.o
-ifeq ($(USE_LLVM_COMPILER_RT),0)
+# When using clang, we get these as builtins from compiler-rt.
+ifneq ($(cc-name),clang)
core-y+=div.o lmul.o ldivmod.o uldivmod.o
endif
core-y+=vecttable.o
-ifeq ($(USE_LLVM_COMPILER_RT),0)
+# When using clang, we get these as builtins from compiler-rt.
+ifneq ($(cc-name),clang)
core-y+=__builtin.o
endif
core-$(CONFIG_COMMON_PANIC_OUTPUT)+=panic.o
diff --git a/core/cortex-m0/config_core.h b/core/cortex-m0/config_core.h
index 63e6da8972..9ef52f848a 100644
--- a/core/cortex-m0/config_core.h
+++ b/core/cortex-m0/config_core.h
@@ -12,11 +12,12 @@
/*
* Emulate the CLZ/CTZ instructions since the CPU core is lacking support.
+ * When building with clang, we rely on compiler_rt to provide this support.
*/
-#ifndef USE_LLVM_COMPILER_RT
+#ifndef __clang__
#define CONFIG_SOFTWARE_CLZ
#define CONFIG_SOFTWARE_CTZ
-#endif /* USE_LLVM_COMPILER_RT */
+#endif /* __clang__ */
#define CONFIG_ASSEMBLY_MULA32
diff --git a/core/cortex-m0/cpu.h b/core/cortex-m0/cpu.h
index bdb7a3c6f5..568b16eedb 100644
--- a/core/cortex-m0/cpu.h
+++ b/core/cortex-m0/cpu.h
@@ -8,11 +8,10 @@
#ifndef __CROS_EC_CPU_H
#define __CROS_EC_CPU_H
+#include <stdint.h>
#include "compile_time_macros.h"
#include "debug.h"
-#include <stdint.h>
-
/* Macro to access 32-bit registers */
#define CPUREG(addr) (*(volatile uint32_t *)(addr))
diff --git a/core/cortex-m0/panic.c b/core/cortex-m0/panic.c
index 533e45713d..3e4c1eb3be 100644
--- a/core/cortex-m0/panic.c
+++ b/core/cortex-m0/panic.c
@@ -7,8 +7,8 @@
#include "console.h"
#include "cpu.h"
#include "host_command.h"
-#include "panic-internal.h"
#include "panic.h"
+#include "panic-internal.h"
#include "printf.h"
#include "system.h"
#include "task.h"
diff --git a/core/cortex-m0/vecttable.c b/core/cortex-m0/vecttable.c
index 050a7d318a..7fd5c7fb8f 100644
--- a/core/cortex-m0/vecttable.c
+++ b/core/cortex-m0/vecttable.c
@@ -7,13 +7,13 @@
#ifndef ___INIT
#define ___INIT
+#include <stddef.h>
+#include <stdint.h>
+
#include "compiler.h"
#include "config.h"
#include "panic-internal.h"
#include "task.h"
-
-#include <stddef.h>
-#include <stdint.h>
#endif /* __INIT */
typedef void (*func)(void);