Commit dd6db9b9 authored by Sherry Zhang's avatar Sherry Zhang Committed by David Brown
Browse files

bootutil: Modify boot_add_data_to_shared_area function scope



Modify the function boot_add_data_to_shared_area from static to global
thereby it can be used in the user interface boot_save_shared_data.

Signed-off-by: default avatarSherry Zhang <sherry.zhang2@arm.com>
Change-Id: Ic6a36eb526a0883a156f832942af3138bde86dd6
Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
parent b3df8f49
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2018-2020 Arm Limited
 * Copyright (c) 2018-2021 Arm Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -24,6 +24,22 @@
extern "C" {
#endif

/**
 * @brief Add a data item to the shared data area between bootloader and
 *        runtime SW
 *
 * @param[in] major_type  TLV major type, identify consumer
 * @param[in] minor_type  TLV minor type, identify TLV type
 * @param[in] size        length of added data
 * @param[in] data        pointer to data
 *
 * @return                0 on success; nonzero on failure.
 */
int boot_add_data_to_shared_area(uint8_t        major_type,
                                 uint16_t       minor_type,
                                 size_t         size,
                                 const uint8_t *data);

/**
 * Add an image's all boot status information to the shared memory area
 * between the bootloader and runtime SW.
+7 −13
Original line number Diff line number Diff line
/*
 * Copyright (c) 2018-2020 Arm Limited
 * Copyright (c) 2018-2021 Arm Limited
 * Copyright (c) 2020 Linaro Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -44,18 +44,8 @@
 */
static bool shared_memory_init_done;

/**
 * @brief Add a data item to the shared data area between bootloader and
 *        runtime SW
 *
 * @param[in] major_type  TLV major type, identify consumer
 * @param[in] minor_type  TLV minor type, identify TLV type
 * @param[in] size        length of added data
 * @param[in] data        pointer to data
 *
 * @return                0 on success; nonzero on failure.
 */
static int
/* See in boot_record.h */
int
boot_add_data_to_shared_area(uint8_t        major_type,
                             uint16_t       minor_type,
                             size_t         size,
@@ -66,6 +56,10 @@ boot_add_data_to_shared_area(uint8_t major_type,
    uint16_t boot_data_size;
    uintptr_t tlv_end, offset;

    if (data == NULL) {
        return SHARED_MEMORY_GEN_ERROR;
    }

    boot_data = (struct shared_boot_data *)MCUBOOT_SHARED_DATA_BASE;

    /* Check whether first time to call this function. If does then initialise