Boot: integrate MCUBoot with TF-M to act as a BL2 bootloader
Modifications in MCUBoot to be aligned with BL2 requirements in TF-M:
-- OS dependency was removed, no need to copy any OS repo to build it
-- CMSIS serial driver is used
-- flash driver interface is aligned with original version
-- S and NS images are handeled as a single binary blob
-- automatic image concatenation and signing at build time
-- authentication based on SHA256 and RSA-2048 digital signature
-- mbedTLS library is used for cryptographic operation
-- static analyser warnings fixed in some files
Change-Id: I54891762eac8d0df634e954ff19a9505b16f3028
Signed-off-by: Tamas Ban <tamas.ban@arm.com>
diff --git a/bl2/ext/mcuboot/os.c b/bl2/ext/mcuboot/os.c
index 0a5abbd..153b335 100644
--- a/bl2/ext/mcuboot/os.c
+++ b/bl2/ext/mcuboot/os.c
@@ -17,12 +17,16 @@
* under the License.
*/
-#include <zephyr.h>
+/*
+ Original code taken from mcuboot project at:
+ https://github.com/runtimeco/mcuboot
+ Modifications are Copyright (c) 2018 Arm Limited.
+ */
+
+#include <stdlib.h>
#include <string.h>
#include "os/os_heap.h"
-
-#define MBEDTLS_CONFIG_FILE CONFIG_MBEDTLS_CFG_FILE
#include <mbedtls/platform.h>
/* D(void *os_malloc(size_t size)) */
@@ -31,7 +35,8 @@
/* Note that this doesn't check for overflow. Assume the
* calls only come from within the app. */
size_t total = nelem * size;
- void *buf = k_malloc(total);
+ void *buf = malloc(total);
+
if (buf) {
memset(buf, 0, total);
}
@@ -40,7 +45,7 @@
void os_free(void *ptr)
{
- k_free(ptr);
+ free(ptr);
}
/*