/* Copyright 2014 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.
 */

#ifndef __CROS_EC_CONFIG_CORE_H
#define __CROS_EC_CONFIG_CORE_H

/* Linker binary architecture and format */
#define BFD_ARCH arm
#define BFD_FORMAT "elf32-littlearm"

/* Emulate the CLZ/CTZ instructions since the CPU core is lacking support */
#define CONFIG_SOFTWARE_CLZ
#define CONFIG_SOFTWARE_CTZ
#define CONFIG_SOFTWARE_PANIC

#define CONFIG_ASSEMBLY_MULA32

#endif /* __CROS_EC_CONFIG_CORE_H */

/* Copyright 2014 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.
 */

#ifndef __CROS_EC_CONFIG_CORE_H
#define __CROS_EC_CONFIG_CORE_H

/* Linker binary architecture and format */
#define BFD_ARCH arm
#define BFD_FORMAT "elf32-littlearm"

/*
 * 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 __clang__
#define CONFIG_SOFTWARE_CLZ
#define CONFIG_SOFTWARE_CTZ
#endif /* __clang__ */
#define CONFIG_SOFTWARE_PANIC

#define CONFIG_ASSEMBLY_MULA32

#endif /* __CROS_EC_CONFIG_CORE_H */

Use compiler_rt version of clz and ctz
core/cortex-m0: Use compiler_rt version of clz and ctz

Use __clzsi2 and __ctzsi2 from compiler_rt instead of our own version.
Using the compiler_rt versions result in a slightly smaller image.

servo_micro before this change:
RO: 18744 bytes in flash remaining
RW: 23192 bytes in flash remaining

servo_micro after this change:
RO: 18808 bytes in flash remaining
RW: 23256 bytes in flash remaining

BRANCH=none
BUG=b:172020503
TEST=CC=clang make BOARD=servo_micro
TEST=make buildall

Signed-off-by: Tom Hughes <fc5c12f30a5ed2baa0581f44ee14ad1eb7b20d83@chromium.org>
Change-Id: Ibc19a3670127dde211fb20d247c1284d0aec5f61
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3199739
Reviewed-by: Jack Rosenthal <d3f605bef1867f59845d4ce6e4f83b8dc9e4e0ae@chromium.org>
