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