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 15import("//build_overrides/pigweed.gni") 16import("$dir_pw_build/target_types.gni") 17import("micro_ecc.gni") 18 19if (dir_pw_third_party_micro_ecc != "") { 20 config("public_config") { 21 include_dirs = [ "$dir_pw_third_party_micro_ecc/" ] 22 } 23 24 config("internal_config") { 25 # Suppress all upstream introduced warnings. 26 cflags = [ "-w" ] 27 28 # Disabling point compression saves 200 bytes. 29 defines = [ "uECC_SUPPORT_COMPRESSED_POINT=0" ] 30 } 31 32 # Endianess is a public configuration for uECC as it determines how large 33 # integers are interpreted in uECC public APIs. 34 # 35 # Big endian is a lot more common and thus is recommended unless you are 36 # really resource-constrained or another uECC client expects little 37 # endian. 38 config("big_endian_config") { 39 defines = [ "uECC_VLI_NATIVE_LITTLE_ENDIAN=0" ] 40 } 41 42 # Little endian can reduce call stack usage in native little endian 43 # execution environments (as determined by processor state, memory 44 # access config etc.) 45 config("little_endian_config") { 46 defines = [ "uECC_VLI_NATIVE_LITTLE_ENDIAN=1" ] 47 } 48 49 pw_source_set("micro_ecc") { 50 public_configs = [ 51 ":big_endian_config", 52 ":public_config", 53 ] 54 configs = [ ":internal_config" ] 55 sources = [ "$dir_pw_third_party_micro_ecc/uECC.c" ] 56 } 57 58 pw_source_set("micro_ecc_little_endian") { 59 public_configs = [ 60 ":little_endian_config", 61 ":public_config", 62 ] 63 configs = [ ":internal_config" ] 64 sources = [ "$dir_pw_third_party_micro_ecc/uECC.c" ] 65 } 66} else { 67 group("micro_ecc") { 68 } 69} 70