1# Copyright 2020 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 15load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") 16load("//pw_build:compatibility.bzl", "incompatible_with_mcu") 17load("//pw_build:merge_flags.bzl", "flags_from_dict") 18load("//pw_build:pw_linker_script.bzl", "pw_linker_script") 19 20package(default_visibility = ["//visibility:public"]) 21 22licenses(["notice"]) 23 24platform( 25 name = "platform", 26 constraint_values = [ 27 "//pw_interrupt_cortex_m:backend", 28 "//pw_malloc:bucket_block_allocator_backend", 29 "//pw_sys_io_baremetal_stm32f429:compatible", 30 "@platforms//cpu:armv7e-m", 31 "@platforms//os:none", 32 "@pw_toolchain//constraints/arm_mcpu:cortex-m4", 33 "@rust_crates//:no_std", 34 ], 35 flags = flags_from_dict({ 36 "@pigweed//pw_assert:check_backend": "//pw_assert_basic", 37 "@pigweed//pw_assert:check_backend_impl": "//pw_assert_basic:impl", 38 "@pigweed//pw_boot:backend": "//pw_boot_cortex_m", 39 "@pigweed//pw_log:backend": "//pw_log_basic", 40 "@pigweed//pw_log:backend_impl": "//pw_log_basic:impl", 41 "@pigweed//pw_malloc:backend": "//pw_malloc:bucket_block_allocator", 42 "@pigweed//pw_sys_io:backend": "//pw_sys_io_baremetal_stm32f429", 43 "@pigweed//pw_system:extra_platform_libs": "//targets/stm32f429i_disc1:extra_platform_libs", 44 }), 45) 46 47cc_library( 48 name = "pre_init", 49 srcs = [ 50 "boot.cc", 51 "vector_table.c", 52 ], 53 defines = [ 54 "PW_MALLOC_ACTIVE=1", 55 ], 56 deps = [ 57 "//pw_boot", 58 "//pw_malloc", 59 "//pw_preprocessor", 60 "//pw_sys_io_baremetal_stm32f429", 61 ], 62 # TODO: b/251939135 - Remove the need for alwayslink by rethinking how 63 # pw_boot_cortex_m is structured in the build system. 64 alwayslink = 1, 65) 66 67cc_library( 68 name = "extra_platform_libs", 69 deps = [ 70 # The initialization code. 71 ":pre_init", 72 # Arm GCC support libraries. 73 "//pw_toolchain/arm_gcc:arm_none_eabi_gcc_support", 74 ], 75) 76 77pw_linker_script( 78 name = "basic_linker_script", 79 # These come from 80 # https://cs.opensource.google/pigweed/pigweed/+/main:targets/stm32f429i_disc1/target_toolchains.gni 81 # TODO(tpudlik): Figure out how to share them between bazel and GN. 82 defines = [ 83 "PW_BOOT_FLASH_BEGIN=0x08000200", 84 "PW_BOOT_FLASH_SIZE=1024K", 85 "PW_BOOT_HEAP_SIZE=112K", 86 "PW_BOOT_MIN_STACK_SIZE=1K", 87 "PW_BOOT_RAM_BEGIN=0x20000000", 88 "PW_BOOT_RAM_SIZE=192K", 89 "PW_BOOT_VECTOR_TABLE_BEGIN=0x08000000", 90 "PW_BOOT_VECTOR_TABLE_SIZE=512", 91 ], 92 linker_script = "//pw_boot_cortex_m:basic_cortex_m.ld", 93) 94 95sphinx_docs_library( 96 name = "docs", 97 srcs = [ 98 "target_docs.rst", 99 ], 100 target_compatible_with = incompatible_with_mcu(), 101) 102