1 // Copyright 2021 The Pigweed Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations under 13 // the License. 14 #pragma once 15 16 #include "pw_preprocessor/arch.h" 17 18 #if !_PW_ARCH_ARM_CORTEX_M 19 #error You can only build this for ARM Cortex-M architectures. If you are \ 20 trying to do this and are still seeing this error, see \ 21 pw_preprocessor/arch.h 22 #endif // !_PW_ARCH_ARM_CORTEX_M 23 24 #if !_PW_ARCH_ARM_V7M && !_PW_ARCH_ARM_V7EM && !_PW_ARCH_ARM_V8M_MAINLINE && \ 25 !_PW_ARCH_ARM_V8_1M_MAINLINE 26 #error "Your selected ARM Cortex-M arch is not yet supported by this module." 27 #endif 28 29 // Which log level to use for this module. 30 #ifndef PW_CPU_EXCEPTION_CORTEX_M_LOG_LEVEL 31 #define PW_CPU_EXCEPTION_CORTEX_M_LOG_LEVEL PW_LOG_LEVEL_DEBUG 32 #endif // PW_CPU_EXCEPTION_CORTEX_M_LOG_LEVEL 33 34 // Enables extended logging in pw::cpu_exception::LogCpuState() and 35 // pw::cpu_exception::cortex_m::LogExceptionAnalysis() that dumps the active 36 // CFSR fields with help strings. This is disabled by default since it 37 // increases the binary size by >1.5KB when using plain-text logs, or ~460 38 // Bytes when using tokenized logging. It's useful to enable this for device 39 // bringup until your application has an end-to-end crash reporting solution. 40 #ifndef PW_CPU_EXCEPTION_CORTEX_M_EXTENDED_CFSR_DUMP 41 #define PW_CPU_EXCEPTION_CORTEX_M_EXTENDED_CFSR_DUMP 0 42 #endif // PW_CPU_EXCEPTION_CORTEX_M_EXTENDED_CFSR_DUMP 43 44 // Whether the floating-point unit is enabled. 45 // TODO(b/264897542): This should be an Arm target trait. 46 #ifndef PW_ARMV7M_ENABLE_FPU 47 #define PW_ARMV7M_ENABLE_FPU 1 48 #endif // PW_ARMV7M_ENABLE_FPU 49