Boot: introduce CMSIS flash interface and driver
Replace legacy flash interface and driver with
CMSIS compliant version:
-- remove legacy flash interface
-- add CMSIS compliant version
Change-Id: I8798d191d8f806500621f76c3c3f62d75aceb7cb
Signed-off-by: Tamas Ban <tamas.ban@arm.com>
diff --git a/bl2/ext/mcuboot/include/bl2_util.h b/bl2/ext/mcuboot/include/bl2_util.h
index 334c2a0..8315681 100644
--- a/bl2/ext/mcuboot/include/bl2_util.h
+++ b/bl2/ext/mcuboot/include/bl2_util.h
@@ -30,10 +30,6 @@
#define CONTAINER_OF(ptr, type, field) \
((type *)(((char *)(ptr)) - offsetof(type, field)))
-struct device {
- int device_id;
-};
-
#ifdef __cplusplus
}
#endif
diff --git a/bl2/ext/mcuboot/include/hal/hal_flash.h b/bl2/ext/mcuboot/include/hal/hal_flash.h
deleted file mode 100644
index 2895479..0000000
--- a/bl2/ext/mcuboot/include/hal/hal_flash.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_HAL_FLASH_
-#define H_HAL_FLASH_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <inttypes.h>
-
-int hal_flash_read(uint8_t flash_id, uint32_t address, void *dst,
- uint32_t num_bytes);
-int hal_flash_write(uint8_t flash_id, uint32_t address, const void *src,
- uint32_t num_bytes);
-int hal_flash_erase_sector(uint8_t flash_id, uint32_t sector_address);
-int hal_flash_erase(uint8_t flash_id, uint32_t address, uint32_t num_bytes);
-uint8_t hal_flash_align(uint8_t flash_id);
-int hal_flash_init(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_HAL_FLASH_ */
diff --git a/bl2/ext/mcuboot/include/target.h b/bl2/ext/mcuboot/include/target.h
index 6f85e5b..47d5a84 100644
--- a/bl2/ext/mcuboot/include/target.h
+++ b/bl2/ext/mcuboot/include/target.h
@@ -1,15 +1,52 @@
/*
* Copyright (C) 2017, Linaro Ltd
+ * Copyright (c) 2018, Arm Limited.
+ *
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef H_TARGETS_TARGET_
#define H_TARGETS_TARGET_
-#if defined(MCUBOOT_TARGET_CONFIG)
-#include MCUBOOT_TARGET_CONFIG
-#else
-#error "Board is currently not supported by bootloader"
+/* Target specific defines: flash partitions; flash driver name, etc.
+ * Comes from: platform/ext/target/<BOARD>/<SUBSYSTEM>/partition
+ */
+#include "flash_layout.h"
+
+#ifndef FLASH_BASE_ADDRESS
+#error "FLASH_BASE_ADDRESS must be defined by the target"
+#endif
+
+#ifndef FLASH_AREA_IMAGE_SECTOR_SIZE
+#error "FLASH_AREA_IMAGE_SECTOR_SIZE must be defined by the target"
+#endif
+
+#ifndef FLASH_AREA_IMAGE_0_OFFSET
+#error "FLASH_AREA_IMAGE_0_OFFSET must be defined by the target"
+#endif
+
+#ifndef FLASH_AREA_IMAGE_0_SIZE
+#error "FLASH_AREA_IMAGE_0_SIZE must be defined by the target"
+#endif
+
+#ifndef FLASH_AREA_IMAGE_1_OFFSET
+#error "FLASH_AREA_IMAGE_1_OFFSET must be defined by the target"
+#endif
+
+#ifndef FLASH_AREA_IMAGE_1_SIZE
+#error "FLASH_AREA_IMAGE_1_SIZE must be defined by the target"
+#endif
+
+#ifndef FLASH_AREA_IMAGE_SCRATCH_OFFSET
+#error "FLASH_AREA_IMAGE_SCRATCH_OFFSET must be defined by the target"
+#endif
+
+#ifndef FLASH_AREA_IMAGE_SCRATCH_SIZE
+#error "FLASH_AREA_IMAGE_SCRATCH_SIZE must be defined by the target"
+#endif
+
+#ifndef FLASH_DEV_NAME
+#error "BL2 supports CMSIS flash interface and device name must be specified"
#endif
#endif