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") 16 17import("$dir_pw_build/target_types.gni") 18import("$dir_pw_docgen/docs.gni") 19import("$dir_pw_malloc/backend.gni") 20import("$dir_pw_system/system_target.gni") 21import("$dir_pw_third_party/stm32cube/stm32cube.gni") 22import("$dir_pw_toolchain/arm_clang/toolchains.gni") 23import("$dir_pw_toolchain/generate_toolchain.gni") 24 25config("pw_malloc_active") { 26 if (pw_malloc_BACKEND != "") { 27 defines = [ "PW_MALLOC_ACTIVE=1" ] 28 } 29} 30 31if (current_toolchain != default_toolchain) { 32 pw_source_set("pre_init") { 33 configs = [ ":pw_malloc_active" ] 34 deps = [ 35 "$dir_pw_boot", 36 "$dir_pw_boot_cortex_m", 37 "$dir_pw_malloc", 38 "$dir_pw_preprocessor", 39 "$dir_pw_string", 40 "$dir_pw_sys_io_stm32cube", 41 "$dir_pw_system", 42 "$dir_pw_third_party/freertos", 43 "$dir_pw_third_party/freertos:support", 44 "$dir_pw_third_party/stm32cube", 45 "$dir_pw_toolchain:infinite_loop", 46 ] 47 sources = [ 48 "boot.cc", 49 "vector_table.c", 50 ] 51 } 52 53 pw_source_set("unit_test_app") { 54 sources = [ "unit_test_app.cc" ] 55 deps = [ 56 "$dir_pw_status", 57 "$dir_pw_system", 58 "$dir_pw_unit_test:rpc_service", 59 ] 60 } 61 62 config("config_includes") { 63 include_dirs = [ "config" ] 64 } 65 66 pw_source_set("stm32f4xx_hal_config") { 67 public_configs = [ ":config_includes" ] 68 public = [ "config/stm32f4xx_hal_conf.h" ] 69 } 70 71 pw_source_set("stm32f4xx_freertos_config") { 72 public_configs = [ ":config_includes" ] 73 public_deps = [ "$dir_pw_third_party/freertos:config_assert" ] 74 public = [ "config/FreeRTOSConfig.h" ] 75 } 76} 77 78common_link_deps = 79 [ "$dir_pigweed/targets/stm32f429i_disc1_stm32cube:pre_init" ] 80 81common_build_args = { 82 pw_log_BACKEND = dir_pw_log_tokenized 83 pw_log_tokenized_HANDLER_BACKEND = "$dir_pw_system:log_backend.impl" 84 pw_third_party_freertos_CONFIG = "$dir_pigweed/targets/stm32f429i_disc1_stm32cube:stm32f4xx_freertos_config" 85 pw_third_party_freertos_PORT = "$dir_pw_third_party/freertos:arm_cm4f" 86 pw_sys_io_BACKEND = dir_pw_sys_io_stm32cube 87 dir_pw_third_party_stm32cube = dir_pw_third_party_stm32cube_f4 88 pw_third_party_stm32cube_PRODUCT = "STM32F429xx" 89 pw_third_party_stm32cube_CONFIG = 90 "$dir_pigweed/targets/stm32f429i_disc1_stm32cube:stm32f4xx_hal_config" 91 pw_third_party_stm32cube_CORE_INIT = "" 92 pw_boot_cortex_m_LINK_CONFIG_DEFINES = [ 93 "PW_BOOT_FLASH_BEGIN=0x08000200", 94 "PW_BOOT_FLASH_SIZE=2048K", 95 96 # TODO: b/235348465 - Currently "pw_tokenizer/detokenize_test" requires at 97 # least 6K bytes in heap when using pw_malloc:bucket_block_allocator. 98 # The heap size required for tests should be investigated. 99 "PW_BOOT_HEAP_SIZE=7K", 100 "PW_BOOT_MIN_STACK_SIZE=1K", 101 "PW_BOOT_RAM_BEGIN=0x20000000", 102 "PW_BOOT_RAM_SIZE=192K", 103 "PW_BOOT_VECTOR_TABLE_BEGIN=0x08000000", 104 "PW_BOOT_VECTOR_TABLE_SIZE=512", 105 ] 106} 107 108pw_system_target("stm32f429i_disc1_stm32cube") { 109 cpu = PW_SYSTEM_CPU.CORTEX_M4F 110 scheduler = PW_SYSTEM_SCHEDULER.FREERTOS 111 112 link_deps = common_link_deps 113 build_args = common_build_args 114} 115 116pw_system_target("stm32f429i_disc1_stm32cube_clang") { 117 cpu = PW_SYSTEM_CPU.CORTEX_M4F 118 scheduler = PW_SYSTEM_SCHEDULER.FREERTOS 119 system_toolchain = pw_toolchain_arm_clang 120 121 link_deps = common_link_deps 122 build_args = common_build_args 123} 124 125pw_doc_group("target_docs") { 126 sources = [ "target_docs.rst" ] 127} 128