• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(
16    "//pw_build:pigweed.bzl",
17    "pw_linker_script",
18)
19
20package(default_visibility = ["//visibility:public"])
21
22licenses(["notice"])
23
24pw_linker_script(
25    name = "basic_linker_script",
26    # These come from
27    # https://cs.opensource.google/pigweed/pigweed/+/main:targets/stm32f429i_disc1/target_toolchains.gni
28    # TODO(tpudlik): Figure out how to share them between bazel and GN.
29    defines = [
30        "PW_BOOT_FLASH_BEGIN=0x08000200",
31        "PW_BOOT_FLASH_SIZE=1024K",
32        "PW_BOOT_HEAP_SIZE=112K",
33        "PW_BOOT_MIN_STACK_SIZE=1K",
34        "PW_BOOT_RAM_BEGIN=0x20000000",
35        "PW_BOOT_RAM_SIZE=192K",
36        "PW_BOOT_VECTOR_TABLE_BEGIN=0x08000000",
37        "PW_BOOT_VECTOR_TABLE_SIZE=512",
38    ],
39    linker_script = "//pw_boot_cortex_m:basic_cortex_m.ld",
40)
41
42cc_library(
43    name = "pre_init",
44    srcs = [
45        "boot.cc",
46        "vector_table.c",
47    ],
48    defines = [
49        "PW_MALLOC_ACTIVE=1",
50    ],
51    deps = [
52        "//pw_boot",
53        "//pw_malloc",
54        "//pw_preprocessor",
55        "//pw_sys_io_baremetal_stm32f429",
56    ],
57    # TODO: b/251939135 - Remove the need for alwayslink by rethinking how
58    # pw_boot_cortex_m is structured in the build system.
59    alwayslink = 1,
60)
61