blob: 40eb4c81b654f3ada164e7f46cb106f3465853c5 [file] [log] [blame]
George Beckstein28779652020-12-15 13:54:51 -05001/*
2 * Mbed-OS Microcontroller Library
3 * Copyright (c) 2020 Embedded Planet
4 * Copyright (c) 2020 ARM Limited
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License
18 */
19
20#if MCUBOOT_DIRECT_XIP
21
22#include "flash_map_backend/secondary_bd.h"
23#include "platform/mbed_toolchain.h"
24#include "FlashIAPBlockDevice.h"
25
26/**
27 * For an XIP build, the secondary BD is provided by mcuboot by default.
28 *
29 * This is a weak symbol so the user can override it.
30 */
31MBED_WEAK mbed::BlockDevice* get_secondary_bd(void) {
32 static FlashIAPBlockDevice secondary_bd(MBED_CONF_MCUBOOT_XIP_SECONDARY_SLOT_ADDRESS,
33 MCUBOOT_SLOT_SIZE);
34
35 return &secondary_bd;
36}
37
38#endif
39
40