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 ] 46 sources = [ 47 "boot.cc", 48 "vector_table.c", 49 ] 50 } 51 52 pw_source_set("unit_test_app") { 53 sources = [ "unit_test_app.cc" ] 54 deps = [ 55 "$dir_pw_status", 56 "$dir_pw_system", 57 "$dir_pw_unit_test:rpc_service", 58 ] 59 } 60 61 config("config_includes") { 62 include_dirs = [ "config" ] 63 } 64 65 pw_source_set("stm32f4xx_hal_config") { 66 public_configs = [ ":config_includes" ] 67 public = [ "config/stm32f4xx_hal_conf.h" ] 68 } 69 70 pw_source_set("stm32f4xx_freertos_config") { 71 public_configs = [ ":config_includes" ] 72 public_deps = [ "$dir_pw_third_party/freertos:config_assert" ] 73 public = [ "config/FreeRTOSConfig.h" ] 74 } 75} 76 77common_link_deps = 78 [ "$dir_pigweed/targets/stm32f429i_disc1_stm32cube:pre_init" ] 79 80common_build_args = { 81 pw_log_BACKEND = dir_pw_log_tokenized 82 pw_log_tokenized_HANDLER_BACKEND = "$dir_pw_system:log_backend.impl" 83 pw_third_party_freertos_CONFIG = "$dir_pigweed/targets/stm32f429i_disc1_stm32cube:stm32f4xx_freertos_config" 84 pw_third_party_freertos_PORT = "$dir_pw_third_party/freertos:arm_cm4f" 85 pw_sys_io_BACKEND = dir_pw_sys_io_stm32cube 86 dir_pw_third_party_stm32cube = dir_pw_third_party_stm32cube_f4 87 pw_third_party_stm32cube_PRODUCT = "STM32F429xx" 88 pw_third_party_stm32cube_CONFIG = 89 "$dir_pigweed/targets/stm32f429i_disc1_stm32cube:stm32f4xx_hal_config" 90 pw_third_party_stm32cube_CORE_INIT = "" 91 pw_boot_cortex_m_LINK_CONFIG_DEFINES = [ 92 "PW_BOOT_FLASH_BEGIN=0x08000200", 93 "PW_BOOT_FLASH_SIZE=2048K", 94 95 # TODO: b/235348465 - Currently "pw_tokenizer/detokenize_test" requires at 96 # least 6K bytes in heap when using pw_malloc:bucket_block_allocator. 97 # The heap size required for tests should be investigated. 98 "PW_BOOT_HEAP_SIZE=7K", 99 "PW_BOOT_MIN_STACK_SIZE=1K", 100 "PW_BOOT_RAM_BEGIN=0x20000000", 101 "PW_BOOT_RAM_SIZE=192K", 102 "PW_BOOT_VECTOR_TABLE_BEGIN=0x08000000", 103 "PW_BOOT_VECTOR_TABLE_SIZE=512", 104 ] 105} 106 107pw_system_target("stm32f429i_disc1_stm32cube") { 108 cpu = PW_SYSTEM_CPU.CORTEX_M4F 109 scheduler = PW_SYSTEM_SCHEDULER.FREERTOS 110 111 link_deps = common_link_deps 112 build_args = common_build_args 113} 114 115pw_system_target("stm32f429i_disc1_stm32cube_clang") { 116 cpu = PW_SYSTEM_CPU.CORTEX_M4F 117 scheduler = PW_SYSTEM_SCHEDULER.FREERTOS 118 system_toolchain = pw_toolchain_arm_clang 119 120 link_deps = common_link_deps 121 build_args = common_build_args 122} 123 124pw_doc_group("target_docs") { 125 sources = [ "target_docs.rst" ] 126} 127