Skip to content

Commit dd6db9b

Browse files
Sherryzhang2d3zd3z
authored andcommitted
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: Sherry Zhang <sherry.zhang2@arm.com> Change-Id: Ic6a36eb526a0883a156f832942af3138bde86dd6 Signed-off-by: David Brown <david.brown@linaro.org>
1 parent b3df8f4 commit dd6db9b

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

boot/bootutil/include/bootutil/boot_record.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018-2020 Arm Limited
2+
* Copyright (c) 2018-2021 Arm Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,6 +24,22 @@
2424
extern "C" {
2525
#endif
2626

27+
/**
28+
* @brief Add a data item to the shared data area between bootloader and
29+
* runtime SW
30+
*
31+
* @param[in] major_type TLV major type, identify consumer
32+
* @param[in] minor_type TLV minor type, identify TLV type
33+
* @param[in] size length of added data
34+
* @param[in] data pointer to data
35+
*
36+
* @return 0 on success; nonzero on failure.
37+
*/
38+
int boot_add_data_to_shared_area(uint8_t major_type,
39+
uint16_t minor_type,
40+
size_t size,
41+
const uint8_t *data);
42+
2743
/**
2844
* Add an image's all boot status information to the shared memory area
2945
* between the bootloader and runtime SW.

boot/bootutil/src/boot_record.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018-2020 Arm Limited
2+
* Copyright (c) 2018-2021 Arm Limited
33
* Copyright (c) 2020 Linaro Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -44,18 +44,8 @@
4444
*/
4545
static bool shared_memory_init_done;
4646

47-
/**
48-
* @brief Add a data item to the shared data area between bootloader and
49-
* runtime SW
50-
*
51-
* @param[in] major_type TLV major type, identify consumer
52-
* @param[in] minor_type TLV minor type, identify TLV type
53-
* @param[in] size length of added data
54-
* @param[in] data pointer to data
55-
*
56-
* @return 0 on success; nonzero on failure.
57-
*/
58-
static int
47+
/* See in boot_record.h */
48+
int
5949
boot_add_data_to_shared_area(uint8_t major_type,
6050
uint16_t minor_type,
6151
size_t size,
@@ -66,6 +56,10 @@ boot_add_data_to_shared_area(uint8_t major_type,
6656
uint16_t boot_data_size;
6757
uintptr_t tlv_end, offset;
6858

59+
if (data == NULL) {
60+
return SHARED_MEMORY_GEN_ERROR;
61+
}
62+
6963
boot_data = (struct shared_boot_data *)MCUBOOT_SHARED_DATA_BASE;
7064

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

0 commit comments

Comments
 (0)