1# Copyright 2023 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") 16 17import("$dir_pw_build/target_types.gni") 18import("$dir_pw_docgen/docs.gni") 19import("$dir_pw_system/system_target.gni") 20 21config("config_includes") { 22 include_dirs = [ "config" ] 23} 24 25if (current_toolchain != default_toolchain) { 26 pw_source_set("main") { 27 deps = [ 28 "$dir_pigweed/targets/apollo4:boot", 29 "$dir_pw_system", 30 "$dir_pw_third_party/freertos", 31 ] 32 33 sources = [ "main.cc" ] 34 } 35 36 pw_source_set("apollo4_freertos_config") { 37 public_configs = [ ":config_includes" ] 38 public_deps = [ "$dir_pw_third_party/freertos:config_assert" ] 39 public = [ "config/FreeRTOSConfig.h" ] 40 } 41} 42 43pw_system_target("apollo4_pw_system") { 44 cpu = PW_SYSTEM_CPU.CORTEX_M4F 45 scheduler = PW_SYSTEM_SCHEDULER.FREERTOS 46 47 build_args = { 48 pw_third_party_ambiq_PRODUCT = "apollo4p" 49 pw_log_BACKEND = dir_pw_log_tokenized 50 51 pw_third_party_freertos_CONFIG = 52 "$dir_pigweed/targets/apollo4_pw_system:apollo4_freertos_config" 53 pw_third_party_freertos_PORT = "$dir_pw_third_party/freertos:arm_cm4f" 54 pw_sys_io_BACKEND = "$dir_pw_sys_io_ambiq_sdk" 55 pw_log_BACKEND = "$dir_pw_log_basic" 56 pw_cpu_exception_ENTRY_BACKEND = 57 "$dir_pw_cpu_exception_cortex_m:cpu_exception" 58 pw_cpu_exception_HANDLER_BACKEND = "$dir_pw_cpu_exception:basic_handler" 59 pw_cpu_exception_SUPPORT_BACKEND = "$dir_pw_cpu_exception_cortex_m:support" 60 61 pw_boot_cortex_m_LINK_CONFIG_DEFINES = [ 62 "PW_BOOT_VECTOR_TABLE_BEGIN=0x00018000", 63 "PW_BOOT_VECTOR_TABLE_SIZE=512", 64 65 "PW_BOOT_FLASH_BEGIN=0x00018200", 66 "PW_BOOT_FLASH_SIZE=1951K", 67 68 "PW_BOOT_HEAP_SIZE=100K", 69 "PW_BOOT_MIN_STACK_SIZE=1K", 70 71 "PW_BOOT_RAM_BEGIN=0x10000000", 72 "PW_BOOT_RAM_SIZE=1408K", 73 ] 74 75 pw_build_LINK_DEPS += [ 76 "$dir_pigweed/targets/apollo4_pw_system:main", 77 "$dir_pw_assert:impl", 78 "$dir_pw_third_party/freertos:support", 79 "$dir_pw_log:impl", 80 "$dir_pw_cpu_exception:entry_impl", 81 "$dir_pw_toolchain/arm_gcc:arm_none_eabi_gcc_support", 82 ] 83 } 84} 85 86pw_doc_group("target_docs") { 87 sources = [ "target_docs.rst" ] 88} 89