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