Armando Montanez | 1ee925c | 2020-06-29 13:15:28 -0700 | [diff] [blame] | 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 | |
| 15 | import("//build_overrides/pigweed.gni") |
| 16 | |
| 17 | import("clang_config.gni") |
| 18 | |
| 19 | cortex_m_common_flags = [ |
| 20 | "-mabi=aapcs", |
| 21 | "-mthumb", |
| 22 | ] |
| 23 | |
| 24 | cortex_m_software_fpu_flags = [ "-mfloat-abi=soft" ] |
| 25 | |
| 26 | cortex_m_hardware_fpu_flags = [ |
| 27 | "-mfloat-abi=hard", |
| 28 | "-mfpu=fpv4-sp-d16", |
| 29 | |
| 30 | # Used by some pigweed tests/targets to correctly handle hardware FPU |
| 31 | # behavior. |
| 32 | "-DPW_ARMV7M_ENABLE_FPU=1", |
| 33 | ] |
| 34 | |
| 35 | config("enable_float_printf") { |
| 36 | ldflags = [ "-Wl,-u_printf_float" ] |
| 37 | } |
| 38 | |
| 39 | pw_clang_arm_config("cortex_m3") { |
| 40 | cflags = [ "-mcpu=cortex-m3" ] |
| 41 | cflags += cortex_m_common_flags |
| 42 | cflags += cortex_m_software_fpu_flags |
| 43 | asmflags = cflags |
| 44 | ldflags = cflags |
| 45 | } |
| 46 | |
| 47 | pw_clang_arm_config("cortex_m4f") { |
| 48 | cflags = [ "-mcpu=cortex-m4" ] |
| 49 | cflags += cortex_m_common_flags |
| 50 | cflags += cortex_m_hardware_fpu_flags |
| 51 | asmflags = cflags |
| 52 | ldflags = cflags |
| 53 | } |