[Feature]add MT2731_MP2_MR2_SVN388 baseline version

Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/src/bsp/lk/target/adk2012/include/target/debugconfig.h b/src/bsp/lk/target/adk2012/include/target/debugconfig.h
new file mode 100644
index 0000000..374ebbb
--- /dev/null
+++ b/src/bsp/lk/target/adk2012/include/target/debugconfig.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+//#include <stm32f10x_usart.h>
+
+//#define DEBUG_UART USART3
+//#define DEBUG_UART_IRQ USART3_IRQn
+
+#endif
diff --git a/src/bsp/lk/target/adk2012/init.c b/src/bsp/lk/target/adk2012/init.c
new file mode 100644
index 0000000..00026b1
--- /dev/null
+++ b/src/bsp/lk/target/adk2012/init.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <target.h>
+#include <compiler.h>
+
+void target_early_init(void)
+{
+}
+
+void target_init(void)
+{
+}
+
diff --git a/src/bsp/lk/target/adk2012/rules.mk b/src/bsp/lk/target/adk2012/rules.mk
new file mode 100644
index 0000000..634dd84
--- /dev/null
+++ b/src/bsp/lk/target/adk2012/rules.mk
@@ -0,0 +1,11 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+SAM_CHIP := sam3x8h
+PLATFORM := sam3
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8133m1/include/target/cust_usb.h b/src/bsp/lk/target/aiv8133m1/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8133m1/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8133m1/rules.mk b/src/bsp/lk/target/aiv8133m1/rules.mk
new file mode 100644
index 0000000..d5a0810
--- /dev/null
+++ b/src/bsp/lk/target/aiv8133m1/rules.mk
@@ -0,0 +1,49 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt8133
+DRAM_TYPE := PCDDR4
+
+TZ_PART_NAME := tee
+RECOVERY_TZ_PART_NAME = tee
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot
+RECOVERY_BOOT_PART_NAME = boot
+BL33_PART_NAME := bl33
+RECOVERY_BL33_PART_NAME := bl33
+USB_PHY := realchip
+ROOTFS_PART_NAME := system
+AB_UPGRADE_APP := yes
+MTK_NAND_PAGE_SIZE := 2048
+
+ifeq ($(LK_AS_BL33),0)
+MODULE_DEPS += \
+	$(LOCAL_DIR)/../../../dramk_8133/$(DRAM_TYPE)
+endif
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\" \
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+                  -DAB_UPGRADE_APP=\"$(AB_UPGRADE_APP)\" \
+                  -DMTK_NAND_PAGE_SIZE=$(MTK_NAND_PAGE_SIZE) \
+
+MODULE_DEPS += \
+    platform/${PLATFORM}/${MTK_PLATFORM}/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8133m1/target.c b/src/bsp/lk/target/aiv8133m1/target.c
new file mode 100644
index 0000000..543eb85
--- /dev/null
+++ b/src/bsp/lk/target/aiv8133m1/target.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2019 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <lk/init.h>
+#include <platform/nand/nand.h>
+#include <sys/types.h>
+
+extern void platform_memory_init(void);
+
+void target_early_init(void)
+{
+}
+
+void target_init(void)
+{
+}
+
+LK_INIT_HOOK(nand_init_device, &nand_init_device, LK_INIT_LEVEL_THREADING);
+LK_INIT_HOOK(platform_memory_init, &platform_memory_init, LK_INIT_LEVEL_ARCH);
diff --git a/src/bsp/lk/target/aiv8168m1-rtos/include/target/cust_usb.h b/src/bsp/lk/target/aiv8168m1-rtos/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8168m1-rtos/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8168m1-rtos/rules.mk b/src/bsp/lk/target/aiv8168m1-rtos/rules.mk
new file mode 100644
index 0000000..10088ba
--- /dev/null
+++ b/src/bsp/lk/target/aiv8168m1-rtos/rules.mk
@@ -0,0 +1,44 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt8133
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_a
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = recovery
+BL33_PART_NAME := bl33
+RECOVERY_BL33_PART_NAME := bl33
+USB_PHY := realchip
+
+ifeq ($(LK_AS_BL33),0)
+MODULE_DEPS += \
+	$(LOCAL_DIR)/../../../dramk_8133/$(DRAM_TYPE)
+endif
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\" \
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/${PLATFORM}/${MTK_PLATFORM}/drivers/mmc
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8168m1-rtos/target.c b/src/bsp/lk/target/aiv8168m1-rtos/target.c
new file mode 100644
index 0000000..2b7bf5d
--- /dev/null
+++ b/src/bsp/lk/target/aiv8168m1-rtos/target.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2019 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+#include <sys/types.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aiv8183m1v2/include/target/cust_usb.h b/src/bsp/lk/target/aiv8183m1v2/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8183m1v2/include/target/debugconfig.h b/src/bsp/lk/target/aiv8183m1v2/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aiv8183m1v2/include/target/io_pwr.h b/src/bsp/lk/target/aiv8183m1v2/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/aiv8183m1v2/rules.mk b/src/bsp/lk/target/aiv8183m1v2/rules.mk
new file mode 100644
index 0000000..a3155e8
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2/rules.mk
@@ -0,0 +1,51 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt6771
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee1
+RECOVERY_TZ_PART_NAME = tee1
+DTBO_PART_NAME := odmdtbo
+BOOT_PART_NAME := boot
+RECOVERY_BOOT_PART_NAME = boot
+SPM_PART_NAME := spmfw
+BL33_PART_NAME := UBOOT
+RECOVERY_BL33_PART_NAME := UBOOT
+ROOTFS_PART_NAME := ROOTFS
+
+CACHED_MEMPOOL_ADDR := 0x85000000
+# CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+CACHED_MEMPOOL_SIZE := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE        := 0x04000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x01000000 # 256M
+
+BL33_ADDR := 0x41e00000
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\"
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\"
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8183m1v2/target.c b/src/bsp/lk/target/aiv8183m1v2/target.c
new file mode 100644
index 0000000..51fdb48
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if 1
+    card = emmc_init_stage1(&retry_opcond);
+#endif
+}
+
+void target_init(void)
+{
+#if 1
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+#endif
+}
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b/include/target/cust_usb.h b/src/bsp/lk/target/aiv8183m1v2_64b/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b/include/target/debugconfig.h b/src/bsp/lk/target/aiv8183m1v2_64b/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b/include/target/io_pwr.h b/src/bsp/lk/target/aiv8183m1v2_64b/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b/rules.mk b/src/bsp/lk/target/aiv8183m1v2_64b/rules.mk
new file mode 100644
index 0000000..4da1756
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b/rules.mk
@@ -0,0 +1,74 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt6771
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+SSPM_PART_NAME := sspm_a
+BL33_PART_NAME := UBOOT
+RECOVERY_BL33_PART_NAME := UBOOT
+ROOTFS_PART_NAME := ROOTFS
+RTC_CHECK_FASTBOOT := yes
+SET_FDT_EMI_INFO := yes
+
+ifeq ($(WITH_KERNEL_VM),1)
+CACHED_MEMPOOL_ADDR := 0xfffffff045000000
+UNCACHED_MEMPOOL_ADDR ?= 0xfffffff044800000
+BL33_ADDR := 0xfffffff041e00000
+else
+CACHED_MEMPOOL_ADDR := 0x45000000
+UNCACHED_MEMPOOL_ADDR ?= 0x44800000
+# CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+BL33_ADDR := 0x41e00000
+endif
+
+CACHED_MEMPOOL_SIZE := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
+SCRATCH_SIZE        := 0x04000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x01000000 # 256M
+
+
+
+
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DSSPM_PART_NAME=\"$(SSPM_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\"
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SRC_CLOCK=$(SRC_CLOCK) \
+                  RTC_CHECK_FASTBOOT=$(RTC_CHECK_FASTBOOT) \
+                  SET_FDT_EMI_INFO=$(SET_FDT_EMI_INFO) 
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b/target.c b/src/bsp/lk/target/aiv8183m1v2_64b/target.c
new file mode 100644
index 0000000..895f608
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if 0
+    card = emmc_init_stage1(&retry_opcond);
+#endif
+}
+
+void target_init(void)
+{
+#if 0
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+#endif
+}
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam/include/target/cust_usb.h b/src/bsp/lk/target/aiv8183m1v2_64b_cam/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam/include/target/debugconfig.h b/src/bsp/lk/target/aiv8183m1v2_64b_cam/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam/include/target/io_pwr.h b/src/bsp/lk/target/aiv8183m1v2_64b_cam/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam/rules.mk b/src/bsp/lk/target/aiv8183m1v2_64b_cam/rules.mk
new file mode 100644
index 0000000..99970f1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam/rules.mk
@@ -0,0 +1,70 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt6771
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+SSPM_PART_NAME := sspm_a
+BL33_PART_NAME := UBOOT
+RECOVERY_BL33_PART_NAME := UBOOT
+ROOTFS_PART_NAME := ROOTFS
+RTC_CHECK_FASTBOOT := yes
+SET_FDT_EMI_INFO := yes
+
+ifeq ($(WITH_KERNEL_VM),1)
+CACHED_MEMPOOL_ADDR := 0xfffffff045000000
+UNCACHED_MEMPOOL_ADDR ?= 0xfffffff044800000
+BL33_ADDR := 0xfffffff041e00000
+else
+CACHED_MEMPOOL_ADDR := 0x45000000
+UNCACHED_MEMPOOL_ADDR ?= 0x44800000
+# CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+BL33_ADDR := 0x41e00000
+endif
+
+CACHED_MEMPOOL_SIZE := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
+SCRATCH_SIZE        := 0x04000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x01000000 # 256M
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DSSPM_PART_NAME=\"$(SSPM_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\"
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SRC_CLOCK=$(SRC_CLOCK) \
+                  RTC_CHECK_FASTBOOT=$(RTC_CHECK_FASTBOOT) \
+                  SET_FDT_EMI_INFO=$(SET_FDT_EMI_INFO)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam/target.c b/src/bsp/lk/target/aiv8183m1v2_64b_cam/target.c
new file mode 100644
index 0000000..d5e73ae
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam/target.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+#include <platform/mt_reg_base.h>
+#include <platform/mt_typedefs.h>
+#include <platform/mt6358.h>
+
+struct mmc_card *card;
+bool retry_opcond;
+
+static void stm_mcu_gpio_init(void)
+{
+    /* set AD25(GPIO169) output-low */
+    DRV_WriteReg32(GPIO_BASE + 0x450, DRV_Reg32(GPIO_BASE + 0x450) & (~ (7 << 4)));//set gpio169 gpio mode
+    DRV_WriteReg32(GPIO_BASE + 0x050, DRV_Reg32(GPIO_BASE + 0x050) | (1 << 9));//set gpio169 direction output
+    DRV_WriteReg32(GPIO_BASE + 0x150, DRV_Reg32(GPIO_BASE + 0x150) & (~ (1 << 9)));//set gpio169 output-low
+
+    /* Set Y25(GPIO165) output-low */
+    DRV_WriteReg32(GPIO_BASE + 0x440, DRV_Reg32(GPIO_BASE + 0x440) & (~(7 << 20)));//set gpio165 gpio mode
+    DRV_WriteReg32(GPIO_BASE + 0x050, DRV_Reg32(GPIO_BASE + 0x050) | (1 << 5));//set gpio165 direction output
+    DRV_WriteReg32(GPIO_BASE + 0x150, DRV_Reg32(GPIO_BASE + 0x150) & (~(1 << 5)));//set gpio165 output-high
+}
+
+void target_early_init(void)
+{
+    /* enable VCN33_bt */
+    pmic_config_interface(0x1D1C, 0x1, 0x3, 0);
+
+    stm_mcu_gpio_init();
+#if 0
+    card = emmc_init_stage1(&retry_opcond);
+#endif
+}
+
+void target_init(void)
+{
+#if 0
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+#endif
+}
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/include/target/cust_usb.h b/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/include/target/debugconfig.h b/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/include/target/io_pwr.h b/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/rules.mk b/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/rules.mk
new file mode 100644
index 0000000..99970f1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/rules.mk
@@ -0,0 +1,70 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt6771
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+SSPM_PART_NAME := sspm_a
+BL33_PART_NAME := UBOOT
+RECOVERY_BL33_PART_NAME := UBOOT
+ROOTFS_PART_NAME := ROOTFS
+RTC_CHECK_FASTBOOT := yes
+SET_FDT_EMI_INFO := yes
+
+ifeq ($(WITH_KERNEL_VM),1)
+CACHED_MEMPOOL_ADDR := 0xfffffff045000000
+UNCACHED_MEMPOOL_ADDR ?= 0xfffffff044800000
+BL33_ADDR := 0xfffffff041e00000
+else
+CACHED_MEMPOOL_ADDR := 0x45000000
+UNCACHED_MEMPOOL_ADDR ?= 0x44800000
+# CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+BL33_ADDR := 0x41e00000
+endif
+
+CACHED_MEMPOOL_SIZE := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
+SCRATCH_SIZE        := 0x04000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x01000000 # 256M
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DSSPM_PART_NAME=\"$(SSPM_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\"
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SRC_CLOCK=$(SRC_CLOCK) \
+                  RTC_CHECK_FASTBOOT=$(RTC_CHECK_FASTBOOT) \
+                  SET_FDT_EMI_INFO=$(SET_FDT_EMI_INFO)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/target.c b/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/target.c
new file mode 100644
index 0000000..d5e73ae
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_eng/target.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+#include <platform/mt_reg_base.h>
+#include <platform/mt_typedefs.h>
+#include <platform/mt6358.h>
+
+struct mmc_card *card;
+bool retry_opcond;
+
+static void stm_mcu_gpio_init(void)
+{
+    /* set AD25(GPIO169) output-low */
+    DRV_WriteReg32(GPIO_BASE + 0x450, DRV_Reg32(GPIO_BASE + 0x450) & (~ (7 << 4)));//set gpio169 gpio mode
+    DRV_WriteReg32(GPIO_BASE + 0x050, DRV_Reg32(GPIO_BASE + 0x050) | (1 << 9));//set gpio169 direction output
+    DRV_WriteReg32(GPIO_BASE + 0x150, DRV_Reg32(GPIO_BASE + 0x150) & (~ (1 << 9)));//set gpio169 output-low
+
+    /* Set Y25(GPIO165) output-low */
+    DRV_WriteReg32(GPIO_BASE + 0x440, DRV_Reg32(GPIO_BASE + 0x440) & (~(7 << 20)));//set gpio165 gpio mode
+    DRV_WriteReg32(GPIO_BASE + 0x050, DRV_Reg32(GPIO_BASE + 0x050) | (1 << 5));//set gpio165 direction output
+    DRV_WriteReg32(GPIO_BASE + 0x150, DRV_Reg32(GPIO_BASE + 0x150) & (~(1 << 5)));//set gpio165 output-high
+}
+
+void target_early_init(void)
+{
+    /* enable VCN33_bt */
+    pmic_config_interface(0x1D1C, 0x1, 0x3, 0);
+
+    stm_mcu_gpio_init();
+#if 0
+    card = emmc_init_stage1(&retry_opcond);
+#endif
+}
+
+void target_init(void)
+{
+#if 0
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+#endif
+}
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/include/target/cust_usb.h b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/include/target/debugconfig.h b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/include/target/io_pwr.h b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/rules.mk b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/rules.mk
new file mode 100644
index 0000000..99970f1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/rules.mk
@@ -0,0 +1,70 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt6771
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+SSPM_PART_NAME := sspm_a
+BL33_PART_NAME := UBOOT
+RECOVERY_BL33_PART_NAME := UBOOT
+ROOTFS_PART_NAME := ROOTFS
+RTC_CHECK_FASTBOOT := yes
+SET_FDT_EMI_INFO := yes
+
+ifeq ($(WITH_KERNEL_VM),1)
+CACHED_MEMPOOL_ADDR := 0xfffffff045000000
+UNCACHED_MEMPOOL_ADDR ?= 0xfffffff044800000
+BL33_ADDR := 0xfffffff041e00000
+else
+CACHED_MEMPOOL_ADDR := 0x45000000
+UNCACHED_MEMPOOL_ADDR ?= 0x44800000
+# CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+BL33_ADDR := 0x41e00000
+endif
+
+CACHED_MEMPOOL_SIZE := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
+SCRATCH_SIZE        := 0x04000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x01000000 # 256M
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DSSPM_PART_NAME=\"$(SSPM_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\"
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SRC_CLOCK=$(SRC_CLOCK) \
+                  RTC_CHECK_FASTBOOT=$(RTC_CHECK_FASTBOOT) \
+                  SET_FDT_EMI_INFO=$(SET_FDT_EMI_INFO)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/target.c b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/target.c
new file mode 100644
index 0000000..d5e73ae
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414/target.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+#include <platform/mt_reg_base.h>
+#include <platform/mt_typedefs.h>
+#include <platform/mt6358.h>
+
+struct mmc_card *card;
+bool retry_opcond;
+
+static void stm_mcu_gpio_init(void)
+{
+    /* set AD25(GPIO169) output-low */
+    DRV_WriteReg32(GPIO_BASE + 0x450, DRV_Reg32(GPIO_BASE + 0x450) & (~ (7 << 4)));//set gpio169 gpio mode
+    DRV_WriteReg32(GPIO_BASE + 0x050, DRV_Reg32(GPIO_BASE + 0x050) | (1 << 9));//set gpio169 direction output
+    DRV_WriteReg32(GPIO_BASE + 0x150, DRV_Reg32(GPIO_BASE + 0x150) & (~ (1 << 9)));//set gpio169 output-low
+
+    /* Set Y25(GPIO165) output-low */
+    DRV_WriteReg32(GPIO_BASE + 0x440, DRV_Reg32(GPIO_BASE + 0x440) & (~(7 << 20)));//set gpio165 gpio mode
+    DRV_WriteReg32(GPIO_BASE + 0x050, DRV_Reg32(GPIO_BASE + 0x050) | (1 << 5));//set gpio165 direction output
+    DRV_WriteReg32(GPIO_BASE + 0x150, DRV_Reg32(GPIO_BASE + 0x150) & (~(1 << 5)));//set gpio165 output-high
+}
+
+void target_early_init(void)
+{
+    /* enable VCN33_bt */
+    pmic_config_interface(0x1D1C, 0x1, 0x3, 0);
+
+    stm_mcu_gpio_init();
+#if 0
+    card = emmc_init_stage1(&retry_opcond);
+#endif
+}
+
+void target_init(void)
+{
+#if 0
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+#endif
+}
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/include/target/cust_usb.h b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/include/target/debugconfig.h b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/include/target/io_pwr.h b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/rules.mk b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/rules.mk
new file mode 100644
index 0000000..99970f1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/rules.mk
@@ -0,0 +1,70 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt6771
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+SSPM_PART_NAME := sspm_a
+BL33_PART_NAME := UBOOT
+RECOVERY_BL33_PART_NAME := UBOOT
+ROOTFS_PART_NAME := ROOTFS
+RTC_CHECK_FASTBOOT := yes
+SET_FDT_EMI_INFO := yes
+
+ifeq ($(WITH_KERNEL_VM),1)
+CACHED_MEMPOOL_ADDR := 0xfffffff045000000
+UNCACHED_MEMPOOL_ADDR ?= 0xfffffff044800000
+BL33_ADDR := 0xfffffff041e00000
+else
+CACHED_MEMPOOL_ADDR := 0x45000000
+UNCACHED_MEMPOOL_ADDR ?= 0x44800000
+# CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+BL33_ADDR := 0x41e00000
+endif
+
+CACHED_MEMPOOL_SIZE := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
+SCRATCH_SIZE        := 0x04000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x01000000 # 256M
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DSSPM_PART_NAME=\"$(SSPM_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\"
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SRC_CLOCK=$(SRC_CLOCK) \
+                  RTC_CHECK_FASTBOOT=$(RTC_CHECK_FASTBOOT) \
+                  SET_FDT_EMI_INFO=$(SET_FDT_EMI_INFO)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/target.c b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/target.c
new file mode 100644
index 0000000..d5e73ae
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_cam_k414_eng/target.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+#include <platform/mt_reg_base.h>
+#include <platform/mt_typedefs.h>
+#include <platform/mt6358.h>
+
+struct mmc_card *card;
+bool retry_opcond;
+
+static void stm_mcu_gpio_init(void)
+{
+    /* set AD25(GPIO169) output-low */
+    DRV_WriteReg32(GPIO_BASE + 0x450, DRV_Reg32(GPIO_BASE + 0x450) & (~ (7 << 4)));//set gpio169 gpio mode
+    DRV_WriteReg32(GPIO_BASE + 0x050, DRV_Reg32(GPIO_BASE + 0x050) | (1 << 9));//set gpio169 direction output
+    DRV_WriteReg32(GPIO_BASE + 0x150, DRV_Reg32(GPIO_BASE + 0x150) & (~ (1 << 9)));//set gpio169 output-low
+
+    /* Set Y25(GPIO165) output-low */
+    DRV_WriteReg32(GPIO_BASE + 0x440, DRV_Reg32(GPIO_BASE + 0x440) & (~(7 << 20)));//set gpio165 gpio mode
+    DRV_WriteReg32(GPIO_BASE + 0x050, DRV_Reg32(GPIO_BASE + 0x050) | (1 << 5));//set gpio165 direction output
+    DRV_WriteReg32(GPIO_BASE + 0x150, DRV_Reg32(GPIO_BASE + 0x150) & (~(1 << 5)));//set gpio165 output-high
+}
+
+void target_early_init(void)
+{
+    /* enable VCN33_bt */
+    pmic_config_interface(0x1D1C, 0x1, 0x3, 0);
+
+    stm_mcu_gpio_init();
+#if 0
+    card = emmc_init_stage1(&retry_opcond);
+#endif
+}
+
+void target_init(void)
+{
+#if 0
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+#endif
+}
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_eng/include/target/cust_usb.h b/src/bsp/lk/target/aiv8183m1v2_64b_eng/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_eng/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_eng/include/target/debugconfig.h b/src/bsp/lk/target/aiv8183m1v2_64b_eng/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_eng/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_eng/include/target/io_pwr.h b/src/bsp/lk/target/aiv8183m1v2_64b_eng/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_eng/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_eng/rules.mk b/src/bsp/lk/target/aiv8183m1v2_64b_eng/rules.mk
new file mode 100644
index 0000000..502a8e8
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_eng/rules.mk
@@ -0,0 +1,70 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt6771
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+SSPM_PART_NAME := sspm_a
+BL33_PART_NAME := UBOOT
+RECOVERY_BL33_PART_NAME := UBOOT
+ROOTFS_PART_NAME := ROOTFS
+RTC_CHECK_FASTBOOT := yes
+SET_FDT_EMI_INFO := yes
+
+ifeq ($(WITH_KERNEL_VM),1)
+CACHED_MEMPOOL_ADDR := 0xfffffff045000000
+UNCACHED_MEMPOOL_ADDR ?= 0xfffffff044800000
+BL33_ADDR := 0xfffffff041e00000
+else
+CACHED_MEMPOOL_ADDR := 0x45000000
+UNCACHED_MEMPOOL_ADDR ?= 0x44800000
+# CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+BL33_ADDR := 0x41e00000
+endif
+
+CACHED_MEMPOOL_SIZE := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
+SCRATCH_SIZE        := 0x04000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x01000000 # 256M
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DSSPM_PART_NAME=\"$(SSPM_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\"
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SRC_CLOCK=$(SRC_CLOCK) \
+                  RTC_CHECK_FASTBOOT=$(RTC_CHECK_FASTBOOT) \
+                  SET_FDT_EMI_INFO=$(SET_FDT_EMI_INFO) 
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_eng/target.c b/src/bsp/lk/target/aiv8183m1v2_64b_eng/target.c
new file mode 100644
index 0000000..895f608
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_eng/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if 0
+    card = emmc_init_stage1(&retry_opcond);
+#endif
+}
+
+void target_init(void)
+{
+#if 0
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+#endif
+}
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_k414/include/target/cust_usb.h b/src/bsp/lk/target/aiv8183m1v2_64b_k414/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_k414/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_k414/include/target/debugconfig.h b/src/bsp/lk/target/aiv8183m1v2_64b_k414/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_k414/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_k414/include/target/io_pwr.h b/src/bsp/lk/target/aiv8183m1v2_64b_k414/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_k414/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_k414/rules.mk b/src/bsp/lk/target/aiv8183m1v2_64b_k414/rules.mk
new file mode 100644
index 0000000..4da1756
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_k414/rules.mk
@@ -0,0 +1,74 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt6771
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+SSPM_PART_NAME := sspm_a
+BL33_PART_NAME := UBOOT
+RECOVERY_BL33_PART_NAME := UBOOT
+ROOTFS_PART_NAME := ROOTFS
+RTC_CHECK_FASTBOOT := yes
+SET_FDT_EMI_INFO := yes
+
+ifeq ($(WITH_KERNEL_VM),1)
+CACHED_MEMPOOL_ADDR := 0xfffffff045000000
+UNCACHED_MEMPOOL_ADDR ?= 0xfffffff044800000
+BL33_ADDR := 0xfffffff041e00000
+else
+CACHED_MEMPOOL_ADDR := 0x45000000
+UNCACHED_MEMPOOL_ADDR ?= 0x44800000
+# CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+BL33_ADDR := 0x41e00000
+endif
+
+CACHED_MEMPOOL_SIZE := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
+SCRATCH_SIZE        := 0x04000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x01000000 # 256M
+
+
+
+
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DSSPM_PART_NAME=\"$(SSPM_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\"
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SRC_CLOCK=$(SRC_CLOCK) \
+                  RTC_CHECK_FASTBOOT=$(RTC_CHECK_FASTBOOT) \
+                  SET_FDT_EMI_INFO=$(SET_FDT_EMI_INFO) 
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_k414/target.c b/src/bsp/lk/target/aiv8183m1v2_64b_k414/target.c
new file mode 100644
index 0000000..895f608
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_k414/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if 0
+    card = emmc_init_stage1(&retry_opcond);
+#endif
+}
+
+void target_init(void)
+{
+#if 0
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+#endif
+}
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/include/target/cust_usb.h b/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/include/target/debugconfig.h b/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/include/target/io_pwr.h b/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/rules.mk b/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/rules.mk
new file mode 100644
index 0000000..4da1756
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/rules.mk
@@ -0,0 +1,74 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt6771
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+SSPM_PART_NAME := sspm_a
+BL33_PART_NAME := UBOOT
+RECOVERY_BL33_PART_NAME := UBOOT
+ROOTFS_PART_NAME := ROOTFS
+RTC_CHECK_FASTBOOT := yes
+SET_FDT_EMI_INFO := yes
+
+ifeq ($(WITH_KERNEL_VM),1)
+CACHED_MEMPOOL_ADDR := 0xfffffff045000000
+UNCACHED_MEMPOOL_ADDR ?= 0xfffffff044800000
+BL33_ADDR := 0xfffffff041e00000
+else
+CACHED_MEMPOOL_ADDR := 0x45000000
+UNCACHED_MEMPOOL_ADDR ?= 0x44800000
+# CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+BL33_ADDR := 0x41e00000
+endif
+
+CACHED_MEMPOOL_SIZE := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
+SCRATCH_SIZE        := 0x04000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x01000000 # 256M
+
+
+
+
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DSSPM_PART_NAME=\"$(SSPM_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\"
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SRC_CLOCK=$(SRC_CLOCK) \
+                  RTC_CHECK_FASTBOOT=$(RTC_CHECK_FASTBOOT) \
+                  SET_FDT_EMI_INFO=$(SET_FDT_EMI_INFO) 
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/target.c b/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/target.c
new file mode 100644
index 0000000..895f608
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_k414_eng/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if 0
+    card = emmc_init_stage1(&retry_opcond);
+#endif
+}
+
+void target_init(void)
+{
+#if 0
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+#endif
+}
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_test/include/target/cust_usb.h b/src/bsp/lk/target/aiv8183m1v2_64b_test/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_test/include/target/debugconfig.h b/src/bsp/lk/target/aiv8183m1v2_64b_test/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_test/include/target/io_pwr.h b/src/bsp/lk/target/aiv8183m1v2_64b_test/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_test/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_test/rules.mk b/src/bsp/lk/target/aiv8183m1v2_64b_test/rules.mk
new file mode 100644
index 0000000..502a8e8
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_test/rules.mk
@@ -0,0 +1,70 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt6771
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+SSPM_PART_NAME := sspm_a
+BL33_PART_NAME := UBOOT
+RECOVERY_BL33_PART_NAME := UBOOT
+ROOTFS_PART_NAME := ROOTFS
+RTC_CHECK_FASTBOOT := yes
+SET_FDT_EMI_INFO := yes
+
+ifeq ($(WITH_KERNEL_VM),1)
+CACHED_MEMPOOL_ADDR := 0xfffffff045000000
+UNCACHED_MEMPOOL_ADDR ?= 0xfffffff044800000
+BL33_ADDR := 0xfffffff041e00000
+else
+CACHED_MEMPOOL_ADDR := 0x45000000
+UNCACHED_MEMPOOL_ADDR ?= 0x44800000
+# CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+BL33_ADDR := 0x41e00000
+endif
+
+CACHED_MEMPOOL_SIZE := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
+SCRATCH_SIZE        := 0x04000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x01000000 # 256M
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DSSPM_PART_NAME=\"$(SSPM_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\"
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SRC_CLOCK=$(SRC_CLOCK) \
+                  RTC_CHECK_FASTBOOT=$(RTC_CHECK_FASTBOOT) \
+                  SET_FDT_EMI_INFO=$(SET_FDT_EMI_INFO) 
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_test/target.c b/src/bsp/lk/target/aiv8183m1v2_64b_test/target.c
new file mode 100644
index 0000000..895f608
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_test/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if 0
+    card = emmc_init_stage1(&retry_opcond);
+#endif
+}
+
+void target_init(void)
+{
+#if 0
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+#endif
+}
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/include/target/cust_usb.h b/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/include/target/debugconfig.h b/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/include/target/io_pwr.h b/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/rules.mk b/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/rules.mk
new file mode 100644
index 0000000..502a8e8
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/rules.mk
@@ -0,0 +1,70 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt6771
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+SSPM_PART_NAME := sspm_a
+BL33_PART_NAME := UBOOT
+RECOVERY_BL33_PART_NAME := UBOOT
+ROOTFS_PART_NAME := ROOTFS
+RTC_CHECK_FASTBOOT := yes
+SET_FDT_EMI_INFO := yes
+
+ifeq ($(WITH_KERNEL_VM),1)
+CACHED_MEMPOOL_ADDR := 0xfffffff045000000
+UNCACHED_MEMPOOL_ADDR ?= 0xfffffff044800000
+BL33_ADDR := 0xfffffff041e00000
+else
+CACHED_MEMPOOL_ADDR := 0x45000000
+UNCACHED_MEMPOOL_ADDR ?= 0x44800000
+# CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+BL33_ADDR := 0x41e00000
+endif
+
+CACHED_MEMPOOL_SIZE := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
+SCRATCH_SIZE        := 0x04000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x01000000 # 256M
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DSSPM_PART_NAME=\"$(SSPM_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\"
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SRC_CLOCK=$(SRC_CLOCK) \
+                  RTC_CHECK_FASTBOOT=$(RTC_CHECK_FASTBOOT) \
+                  SET_FDT_EMI_INFO=$(SET_FDT_EMI_INFO) 
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/target.c b/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/target.c
new file mode 100644
index 0000000..895f608
--- /dev/null
+++ b/src/bsp/lk/target/aiv8183m1v2_64b_test_k414/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if 0
+    card = emmc_init_stage1(&retry_opcond);
+#endif
+}
+
+void target_init(void)
+{
+#if 0
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+#endif
+}
diff --git a/src/bsp/lk/target/aiv8365m1v1-aiot/include/target/cust_usb.h b/src/bsp/lk/target/aiv8365m1v1-aiot/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8365m1v1-aiot/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8365m1v1-aiot/rules.mk b/src/bsp/lk/target/aiv8365m1v1-aiot/rules.mk
new file mode 100644
index 0000000..9336344
--- /dev/null
+++ b/src/bsp/lk/target/aiv8365m1v1-aiot/rules.mk
@@ -0,0 +1,44 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt8133
+DRAM_TYPE := PCDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_a
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+BL33_PART_NAME := bl33
+RECOVERY_BL33_PART_NAME := bl33
+USB_PHY := realchip
+
+ifeq ($(LK_AS_BL33),0)
+MODULE_DEPS += \
+	$(LOCAL_DIR)/../../../dramk_8133/$(DRAM_TYPE)
+endif
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\" \
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/${PLATFORM}/${MTK_PLATFORM}/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8365m1v1-aiot/target.c b/src/bsp/lk/target/aiv8365m1v1-aiot/target.c
new file mode 100644
index 0000000..543eb85
--- /dev/null
+++ b/src/bsp/lk/target/aiv8365m1v1-aiot/target.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2019 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <lk/init.h>
+#include <platform/nand/nand.h>
+#include <sys/types.h>
+
+extern void platform_memory_init(void);
+
+void target_early_init(void)
+{
+}
+
+void target_init(void)
+{
+}
+
+LK_INIT_HOOK(nand_init_device, &nand_init_device, LK_INIT_LEVEL_THREADING);
+LK_INIT_HOOK(platform_memory_init, &platform_memory_init, LK_INIT_LEVEL_ARCH);
diff --git a/src/bsp/lk/target/aiv8385-linux.aiot-emmc/include/target/cust_usb.h b/src/bsp/lk/target/aiv8385-linux.aiot-emmc/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8385-linux.aiot-emmc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8385-linux.aiot-emmc/include/target/debugconfig.h b/src/bsp/lk/target/aiv8385-linux.aiot-emmc/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aiv8385-linux.aiot-emmc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aiv8385-linux.aiot-emmc/include/target/io_pwr.h b/src/bsp/lk/target/aiv8385-linux.aiot-emmc/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8385-linux.aiot-emmc/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/aiv8385-linux.aiot-emmc/rules.mk b/src/bsp/lk/target/aiv8385-linux.aiot-emmc/rules.mk
new file mode 100644
index 0000000..4da1756
--- /dev/null
+++ b/src/bsp/lk/target/aiv8385-linux.aiot-emmc/rules.mk
@@ -0,0 +1,74 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt6771
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+SSPM_PART_NAME := sspm_a
+BL33_PART_NAME := UBOOT
+RECOVERY_BL33_PART_NAME := UBOOT
+ROOTFS_PART_NAME := ROOTFS
+RTC_CHECK_FASTBOOT := yes
+SET_FDT_EMI_INFO := yes
+
+ifeq ($(WITH_KERNEL_VM),1)
+CACHED_MEMPOOL_ADDR := 0xfffffff045000000
+UNCACHED_MEMPOOL_ADDR ?= 0xfffffff044800000
+BL33_ADDR := 0xfffffff041e00000
+else
+CACHED_MEMPOOL_ADDR := 0x45000000
+UNCACHED_MEMPOOL_ADDR ?= 0x44800000
+# CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+BL33_ADDR := 0x41e00000
+endif
+
+CACHED_MEMPOOL_SIZE := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
+SCRATCH_SIZE        := 0x04000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x01000000 # 256M
+
+
+
+
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DSSPM_PART_NAME=\"$(SSPM_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\"
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SRC_CLOCK=$(SRC_CLOCK) \
+                  RTC_CHECK_FASTBOOT=$(RTC_CHECK_FASTBOOT) \
+                  SET_FDT_EMI_INFO=$(SET_FDT_EMI_INFO) 
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8385-linux.aiot-emmc/target.c b/src/bsp/lk/target/aiv8385-linux.aiot-emmc/target.c
new file mode 100644
index 0000000..895f608
--- /dev/null
+++ b/src/bsp/lk/target/aiv8385-linux.aiot-emmc/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if 0
+    card = emmc_init_stage1(&retry_opcond);
+#endif
+}
+
+void target_init(void)
+{
+#if 0
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+#endif
+}
diff --git a/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/include/target/cust_usb.h b/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/include/target/debugconfig.h b/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/include/target/io_pwr.h b/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/rules.mk b/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/rules.mk
new file mode 100644
index 0000000..4da1756
--- /dev/null
+++ b/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/rules.mk
@@ -0,0 +1,74 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 26000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt6771
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+SSPM_PART_NAME := sspm_a
+BL33_PART_NAME := UBOOT
+RECOVERY_BL33_PART_NAME := UBOOT
+ROOTFS_PART_NAME := ROOTFS
+RTC_CHECK_FASTBOOT := yes
+SET_FDT_EMI_INFO := yes
+
+ifeq ($(WITH_KERNEL_VM),1)
+CACHED_MEMPOOL_ADDR := 0xfffffff045000000
+UNCACHED_MEMPOOL_ADDR ?= 0xfffffff044800000
+BL33_ADDR := 0xfffffff041e00000
+else
+CACHED_MEMPOOL_ADDR := 0x45000000
+UNCACHED_MEMPOOL_ADDR ?= 0x44800000
+# CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+BL33_ADDR := 0x41e00000
+endif
+
+CACHED_MEMPOOL_SIZE := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
+SCRATCH_SIZE        := 0x04000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x01000000 # 256M
+
+
+
+
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DSSPM_PART_NAME=\"$(SSPM_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\"
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SRC_CLOCK=$(SRC_CLOCK) \
+                  RTC_CHECK_FASTBOOT=$(RTC_CHECK_FASTBOOT) \
+                  SET_FDT_EMI_INFO=$(SET_FDT_EMI_INFO) 
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/target.c b/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/target.c
new file mode 100644
index 0000000..895f608
--- /dev/null
+++ b/src/bsp/lk/target/aiv8385-linux.aiot-emmc_k414/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if 0
+    card = emmc_init_stage1(&retry_opcond);
+#endif
+}
+
+void target_init(void)
+{
+#if 0
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+#endif
+}
diff --git a/src/bsp/lk/target/armemu/armemu.conf b/src/bsp/lk/target/armemu/armemu.conf
new file mode 100644
index 0000000..db8021d
--- /dev/null
+++ b/src/bsp/lk/target/armemu/armemu.conf
@@ -0,0 +1,23 @@
+[cpu]
+core = cortex-a8
+
+# the rom file is loaded at address 0x0
+[rom]
+file = lk.bin
+
+[system]
+display = yes
+console = yes
+network = no
+block = yes
+
+[network]
+device = /dev/tap0
+
+[block]
+file = ../blk.bin
+
+[display]
+width = 800
+height = 600
+depth = 32
diff --git a/src/bsp/lk/target/armemu/rules.mk b/src/bsp/lk/target/armemu/rules.mk
new file mode 100644
index 0000000..4c7bdd1
--- /dev/null
+++ b/src/bsp/lk/target/armemu/rules.mk
@@ -0,0 +1,11 @@
+# mostly null target configuration for the arm emulator, since there's only one real
+# implementation.
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+PLATFORM := armemu
+
+$(BUILDDIR)/armemu.conf: $(LOCAL_DIR)/armemu.conf
+	cp $< $@
+
+EXTRA_BUILDDEPS += $(BUILDDIR)/armemu.conf
+GENERATED += $(BUILDDIR)/armemu.conf
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc-128m-lp4/include/target/cust_usb.h b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m-lp4/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m-lp4/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc-128m-lp4/include/target/debugconfig.h b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m-lp4/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m-lp4/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc-128m-lp4/rules.mk b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m-lp4/rules.mk
new file mode 100644
index 0000000..c03a2f6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m-lp4/rules.mk
@@ -0,0 +1,66 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+SPI_NAND_PROJECT := y
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff00000e600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff000010600000UL
+BL33_ADDR               := 0xffff000011000000UL
+NAND_BUF_ADDR           := 0xffff000010900000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x41000000
+UNCACHED_MEMPOOL_ADDR   := 0x43000000
+BL33_ADDR               := 0x43a00000
+NAND_BUF_ADDR           := 0x43300000
+endif
+
+CACHED_MEMPOOL_SIZE     := 0x2000000 # 48MB
+UNCACHED_MEMPOOL_SIZE   := 0x0007D000 # 500k
+
+SCRATCH_SIZE		:= 0x800000 # 8MB
+
+MAX_TEE_DRAM_SIZE	:= 0x00400000 # 4M
+MAX_KERNEL_SIZE		:= 0x01000000 # 16M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc-128m-lp4/target.c b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m-lp4/target.c
new file mode 100644
index 0000000..de4f9d8
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m-lp4/target.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc-128m/include/target/cust_usb.h b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc-128m/include/target/debugconfig.h b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc-128m/rules.mk b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m/rules.mk
new file mode 100644
index 0000000..c03a2f6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m/rules.mk
@@ -0,0 +1,66 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+SPI_NAND_PROJECT := y
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff00000e600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff000010600000UL
+BL33_ADDR               := 0xffff000011000000UL
+NAND_BUF_ADDR           := 0xffff000010900000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x41000000
+UNCACHED_MEMPOOL_ADDR   := 0x43000000
+BL33_ADDR               := 0x43a00000
+NAND_BUF_ADDR           := 0x43300000
+endif
+
+CACHED_MEMPOOL_SIZE     := 0x2000000 # 48MB
+UNCACHED_MEMPOOL_SIZE   := 0x0007D000 # 500k
+
+SCRATCH_SIZE		:= 0x800000 # 8MB
+
+MAX_TEE_DRAM_SIZE	:= 0x00400000 # 4M
+MAX_KERNEL_SIZE		:= 0x01000000 # 16M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc-128m/target.c b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m/target.c
new file mode 100644
index 0000000..de4f9d8
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc-128m/target.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc-64m/include/target/cust_usb.h b/src/bsp/lk/target/aud8512am1v1-linux-slc-64m/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc-64m/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc-64m/include/target/debugconfig.h b/src/bsp/lk/target/aud8512am1v1-linux-slc-64m/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc-64m/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc-64m/rules.mk b/src/bsp/lk/target/aud8512am1v1-linux-slc-64m/rules.mk
new file mode 100644
index 0000000..ddbac55
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc-64m/rules.mk
@@ -0,0 +1,65 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+SPI_NAND_PROJECT := y
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff00001C000000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00001C200000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+UNCACHED_MEMPOOL_ADDR   := 0x4EA00000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4EC00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE   := 0x00200000 # 2MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc-64m/target.c b/src/bsp/lk/target/aud8512am1v1-linux-slc-64m/target.c
new file mode 100644
index 0000000..de4f9d8
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc-64m/target.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc/include/target/cust_usb.h b/src/bsp/lk/target/aud8512am1v1-linux-slc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc/include/target/debugconfig.h b/src/bsp/lk/target/aud8512am1v1-linux-slc/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc/rules.mk b/src/bsp/lk/target/aud8512am1v1-linux-slc/rules.mk
new file mode 100644
index 0000000..c03a2f6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc/rules.mk
@@ -0,0 +1,66 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+SPI_NAND_PROJECT := y
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff00000e600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff000010600000UL
+BL33_ADDR               := 0xffff000011000000UL
+NAND_BUF_ADDR           := 0xffff000010900000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x41000000
+UNCACHED_MEMPOOL_ADDR   := 0x43000000
+BL33_ADDR               := 0x43a00000
+NAND_BUF_ADDR           := 0x43300000
+endif
+
+CACHED_MEMPOOL_SIZE     := 0x2000000 # 48MB
+UNCACHED_MEMPOOL_SIZE   := 0x0007D000 # 500k
+
+SCRATCH_SIZE		:= 0x800000 # 8MB
+
+MAX_TEE_DRAM_SIZE	:= 0x00400000 # 4M
+MAX_KERNEL_SIZE		:= 0x01000000 # 16M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512am1v1-linux-slc/target.c b/src/bsp/lk/target/aud8512am1v1-linux-slc/target.c
new file mode 100644
index 0000000..de4f9d8
--- /dev/null
+++ b/src/bsp/lk/target/aud8512am1v1-linux-slc/target.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
diff --git a/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m-test/rules.mk b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m-test/rules.mk
new file mode 100644
index 0000000..c03a2f6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m-test/rules.mk
@@ -0,0 +1,66 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+SPI_NAND_PROJECT := y
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff00000e600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff000010600000UL
+BL33_ADDR               := 0xffff000011000000UL
+NAND_BUF_ADDR           := 0xffff000010900000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x41000000
+UNCACHED_MEMPOOL_ADDR   := 0x43000000
+BL33_ADDR               := 0x43a00000
+NAND_BUF_ADDR           := 0x43300000
+endif
+
+CACHED_MEMPOOL_SIZE     := 0x2000000 # 48MB
+UNCACHED_MEMPOOL_SIZE   := 0x0007D000 # 500k
+
+SCRATCH_SIZE		:= 0x800000 # 8MB
+
+MAX_TEE_DRAM_SIZE	:= 0x00400000 # 4M
+MAX_KERNEL_SIZE		:= 0x01000000 # 16M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m-test/target.c b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m-test/target.c
new file mode 100644
index 0000000..de4f9d8
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m-test/target.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
diff --git a/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m/include/target/cust_usb.h b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m/include/target/debugconfig.h b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m/rules.mk b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m/rules.mk
new file mode 100644
index 0000000..c03a2f6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m/rules.mk
@@ -0,0 +1,66 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+SPI_NAND_PROJECT := y
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff00000e600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff000010600000UL
+BL33_ADDR               := 0xffff000011000000UL
+NAND_BUF_ADDR           := 0xffff000010900000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x41000000
+UNCACHED_MEMPOOL_ADDR   := 0x43000000
+BL33_ADDR               := 0x43a00000
+NAND_BUF_ADDR           := 0x43300000
+endif
+
+CACHED_MEMPOOL_SIZE     := 0x2000000 # 48MB
+UNCACHED_MEMPOOL_SIZE   := 0x0007D000 # 500k
+
+SCRATCH_SIZE		:= 0x800000 # 8MB
+
+MAX_TEE_DRAM_SIZE	:= 0x00400000 # 4M
+MAX_KERNEL_SIZE		:= 0x01000000 # 16M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m/target.c b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m/target.c
new file mode 100644
index 0000000..de4f9d8
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap1v1-linux-slc-128m/target.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
diff --git a/src/bsp/lk/target/aud8512ap1v1-linux-slc/include/target/cust_usb.h b/src/bsp/lk/target/aud8512ap1v1-linux-slc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap1v1-linux-slc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512ap1v1-linux-slc/include/target/debugconfig.h b/src/bsp/lk/target/aud8512ap1v1-linux-slc/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap1v1-linux-slc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512ap1v1-linux-slc/rules.mk b/src/bsp/lk/target/aud8512ap1v1-linux-slc/rules.mk
new file mode 100644
index 0000000..c03a2f6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap1v1-linux-slc/rules.mk
@@ -0,0 +1,66 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+SPI_NAND_PROJECT := y
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff00000e600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff000010600000UL
+BL33_ADDR               := 0xffff000011000000UL
+NAND_BUF_ADDR           := 0xffff000010900000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x41000000
+UNCACHED_MEMPOOL_ADDR   := 0x43000000
+BL33_ADDR               := 0x43a00000
+NAND_BUF_ADDR           := 0x43300000
+endif
+
+CACHED_MEMPOOL_SIZE     := 0x2000000 # 48MB
+UNCACHED_MEMPOOL_SIZE   := 0x0007D000 # 500k
+
+SCRATCH_SIZE		:= 0x800000 # 8MB
+
+MAX_TEE_DRAM_SIZE	:= 0x00400000 # 4M
+MAX_KERNEL_SIZE		:= 0x01000000 # 16M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512ap1v1-linux-slc/target.c b/src/bsp/lk/target/aud8512ap1v1-linux-slc/target.c
new file mode 100644
index 0000000..de4f9d8
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap1v1-linux-slc/target.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m-test/rules.mk b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m-test/rules.mk
new file mode 100644
index 0000000..c03a2f6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m-test/rules.mk
@@ -0,0 +1,66 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+SPI_NAND_PROJECT := y
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff00000e600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff000010600000UL
+BL33_ADDR               := 0xffff000011000000UL
+NAND_BUF_ADDR           := 0xffff000010900000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x41000000
+UNCACHED_MEMPOOL_ADDR   := 0x43000000
+BL33_ADDR               := 0x43a00000
+NAND_BUF_ADDR           := 0x43300000
+endif
+
+CACHED_MEMPOOL_SIZE     := 0x2000000 # 48MB
+UNCACHED_MEMPOOL_SIZE   := 0x0007D000 # 500k
+
+SCRATCH_SIZE		:= 0x800000 # 8MB
+
+MAX_TEE_DRAM_SIZE	:= 0x00400000 # 4M
+MAX_KERNEL_SIZE		:= 0x01000000 # 16M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m-test/target.c b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m-test/target.c
new file mode 100644
index 0000000..de4f9d8
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m-test/target.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m/include/target/cust_usb.h b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m/include/target/debugconfig.h b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m/rules.mk b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m/rules.mk
new file mode 100644
index 0000000..c03a2f6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m/rules.mk
@@ -0,0 +1,66 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+SPI_NAND_PROJECT := y
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff00000e600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff000010600000UL
+BL33_ADDR               := 0xffff000011000000UL
+NAND_BUF_ADDR           := 0xffff000010900000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x41000000
+UNCACHED_MEMPOOL_ADDR   := 0x43000000
+BL33_ADDR               := 0x43a00000
+NAND_BUF_ADDR           := 0x43300000
+endif
+
+CACHED_MEMPOOL_SIZE     := 0x2000000 # 48MB
+UNCACHED_MEMPOOL_SIZE   := 0x0007D000 # 500k
+
+SCRATCH_SIZE		:= 0x800000 # 8MB
+
+MAX_TEE_DRAM_SIZE	:= 0x00400000 # 4M
+MAX_KERNEL_SIZE		:= 0x01000000 # 16M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m/target.c b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m/target.c
new file mode 100644
index 0000000..de4f9d8
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc-128m/target.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8512ap2v1-linux-slc-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8512ap2v1-linux-slc-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc-test/rules.mk b/src/bsp/lk/target/aud8512ap2v1-linux-slc-test/rules.mk
new file mode 100644
index 0000000..c03a2f6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc-test/rules.mk
@@ -0,0 +1,66 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+SPI_NAND_PROJECT := y
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff00000e600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff000010600000UL
+BL33_ADDR               := 0xffff000011000000UL
+NAND_BUF_ADDR           := 0xffff000010900000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x41000000
+UNCACHED_MEMPOOL_ADDR   := 0x43000000
+BL33_ADDR               := 0x43a00000
+NAND_BUF_ADDR           := 0x43300000
+endif
+
+CACHED_MEMPOOL_SIZE     := 0x2000000 # 48MB
+UNCACHED_MEMPOOL_SIZE   := 0x0007D000 # 500k
+
+SCRATCH_SIZE		:= 0x800000 # 8MB
+
+MAX_TEE_DRAM_SIZE	:= 0x00400000 # 4M
+MAX_KERNEL_SIZE		:= 0x01000000 # 16M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc-test/target.c b/src/bsp/lk/target/aud8512ap2v1-linux-slc-test/target.c
new file mode 100644
index 0000000..de4f9d8
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc-test/target.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc/include/target/cust_usb.h b/src/bsp/lk/target/aud8512ap2v1-linux-slc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc/include/target/debugconfig.h b/src/bsp/lk/target/aud8512ap2v1-linux-slc/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc/rules.mk b/src/bsp/lk/target/aud8512ap2v1-linux-slc/rules.mk
new file mode 100644
index 0000000..c03a2f6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc/rules.mk
@@ -0,0 +1,66 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+SPI_NAND_PROJECT := y
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff00000e600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff000010600000UL
+BL33_ADDR               := 0xffff000011000000UL
+NAND_BUF_ADDR           := 0xffff000010900000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x41000000
+UNCACHED_MEMPOOL_ADDR   := 0x43000000
+BL33_ADDR               := 0x43a00000
+NAND_BUF_ADDR           := 0x43300000
+endif
+
+CACHED_MEMPOOL_SIZE     := 0x2000000 # 48MB
+UNCACHED_MEMPOOL_SIZE   := 0x0007D000 # 500k
+
+SCRATCH_SIZE		:= 0x800000 # 8MB
+
+MAX_TEE_DRAM_SIZE	:= 0x00400000 # 4M
+MAX_KERNEL_SIZE		:= 0x01000000 # 16M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512ap2v1-linux-slc/target.c b/src/bsp/lk/target/aud8512ap2v1-linux-slc/target.c
new file mode 100644
index 0000000..de4f9d8
--- /dev/null
+++ b/src/bsp/lk/target/aud8512ap2v1-linux-slc/target.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
diff --git a/src/bsp/lk/target/aud8512bm1-emmc-32b/include/target/cust_usb.h b/src/bsp/lk/target/aud8512bm1-emmc-32b/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bm1-emmc-32b/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512bm1-emmc-32b/include/target/debugconfig.h b/src/bsp/lk/target/aud8512bm1-emmc-32b/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bm1-emmc-32b/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512bm1-emmc-32b/rules.mk b/src/bsp/lk/target/aud8512bm1-emmc-32b/rules.mk
new file mode 100644
index 0000000..965c54b
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bm1-emmc-32b/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+TZ_PART_NAME := tee1
+RECOVERY_TZ_PART_NAME = tee2
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot
+RECOVERY_BOOT_PART_NAME = recovery
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff00001C000000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+UNCACHED_MEMPOOL_ADDR   := 0x4EA00000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE   := 0x00200000 # 2MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512bm1-emmc-32b/target.c b/src/bsp/lk/target/aud8512bm1-emmc-32b/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bm1-emmc-32b/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8512bm1-snand-32b/include/target/cust_usb.h b/src/bsp/lk/target/aud8512bm1-snand-32b/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bm1-snand-32b/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512bm1-snand-32b/include/target/debugconfig.h b/src/bsp/lk/target/aud8512bm1-snand-32b/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bm1-snand-32b/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512bm1-snand-32b/rules.mk b/src/bsp/lk/target/aud8512bm1-snand-32b/rules.mk
new file mode 100644
index 0000000..ddbac55
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bm1-snand-32b/rules.mk
@@ -0,0 +1,65 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+SPI_NAND_PROJECT := y
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff00001C000000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00001C200000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+UNCACHED_MEMPOOL_ADDR   := 0x4EA00000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4EC00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE   := 0x00200000 # 2MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512bm1-snand-32b/target.c b/src/bsp/lk/target/aud8512bm1-snand-32b/target.c
new file mode 100644
index 0000000..de4f9d8
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bm1-snand-32b/target.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
diff --git a/src/bsp/lk/target/aud8512bp1-emmc-32b/include/target/cust_usb.h b/src/bsp/lk/target/aud8512bp1-emmc-32b/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bp1-emmc-32b/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512bp1-emmc-32b/include/target/debugconfig.h b/src/bsp/lk/target/aud8512bp1-emmc-32b/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bp1-emmc-32b/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512bp1-emmc-32b/rules.mk b/src/bsp/lk/target/aud8512bp1-emmc-32b/rules.mk
new file mode 100644
index 0000000..965c54b
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bp1-emmc-32b/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+TZ_PART_NAME := tee1
+RECOVERY_TZ_PART_NAME = tee2
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot
+RECOVERY_BOOT_PART_NAME = recovery
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff00001C000000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+UNCACHED_MEMPOOL_ADDR   := 0x4EA00000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE   := 0x00200000 # 2MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512bp1-emmc-32b/target.c b/src/bsp/lk/target/aud8512bp1-emmc-32b/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bp1-emmc-32b/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8512bp1-snand-32b/include/target/cust_usb.h b/src/bsp/lk/target/aud8512bp1-snand-32b/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bp1-snand-32b/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512bp1-snand-32b/include/target/debugconfig.h b/src/bsp/lk/target/aud8512bp1-snand-32b/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bp1-snand-32b/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512bp1-snand-32b/rules.mk b/src/bsp/lk/target/aud8512bp1-snand-32b/rules.mk
new file mode 100644
index 0000000..ddbac55
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bp1-snand-32b/rules.mk
@@ -0,0 +1,65 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8512
+
+SPI_NAND_PROJECT := y
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The UNCACHED_MEMPOOL_ADDR virtual address would be 0xffff000011600000UL + 0x0AA00000 = 0xffff00001C000000UL
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+UNCACHED_MEMPOOL_ADDR   := 0xffff00001C000000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00001C200000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+UNCACHED_MEMPOOL_ADDR   := 0x4EA00000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4EC00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+UNCACHED_MEMPOOL_SIZE   := 0x00200000 # 2MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+                  UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512bp1-snand-32b/target.c b/src/bsp/lk/target/aud8512bp1-snand-32b/target.c
new file mode 100644
index 0000000..de4f9d8
--- /dev/null
+++ b/src/bsp/lk/target/aud8512bp1-snand-32b/target.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
diff --git a/src/bsp/lk/target/aud8512fpga-ldvt-slc/include/target/cust_usb.h b/src/bsp/lk/target/aud8512fpga-ldvt-slc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8512fpga-ldvt-slc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8512fpga-ldvt-slc/include/target/debugconfig.h b/src/bsp/lk/target/aud8512fpga-ldvt-slc/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8512fpga-ldvt-slc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8512fpga-ldvt-slc/rules.mk b/src/bsp/lk/target/aud8512fpga-ldvt-slc/rules.mk
new file mode 100644
index 0000000..8b279d9
--- /dev/null
+++ b/src/bsp/lk/target/aud8512fpga-ldvt-slc/rules.mk
@@ -0,0 +1,59 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := TEE1
+RECOVERY_TZ_PART_NAME = TEE2
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := BOOTIMG1
+RECOVERY_BOOT_PART_NAME = BOOTIMG2
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8512fpga-ldvt-slc/target.c b/src/bsp/lk/target/aud8512fpga-ldvt-slc/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8512fpga-ldvt-slc/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/custom_emi.c b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/custom_emi.c
new file mode 100644
index 0000000..daa433f
--- /dev/null
+++ b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/custom_emi.c
@@ -0,0 +1,172 @@
+/*****************************************************************************
+*  Copyright Statement:
+*  --------------------
+*  This software is protected by Copyright and the information contained
+*  herein is confidential. The software may not be copied and the information
+*  contained herein may not be used or disclosed except with the written
+*  permission of MediaTek Inc. (C) 2008
+*
+*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ *   custom_emi.c
+ *
+ * Project:
+ * --------
+ *   Android
+ *
+ * Description:
+ * ------------
+ *   This Module defines the EMI (external memory interface) related setting.
+ *
+ * Author:
+ * -------
+ *  EMI auto generator V0.01
+ *
+ *   Memory Device database last modified on 2015/6/26
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * $Revision$
+ * $Modtime$
+ * $Log$
+ *
+ *------------------------------------------------------------------------------
+ * WARNING!!!  WARNING!!!   WARNING!!!  WARNING!!!  WARNING!!!  WARNING!!!
+ * This file is generated by EMI Auto-gen Tool.
+ * Please do not modify the content directly!
+ * It could be overwritten!
+ *============================================================================
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+#include <platform/emi.h>
+
+#define NUM_EMI_RECORD (1)
+int num_of_emi_records = NUM_EMI_RECORD;
+
+EMI_SETTINGS emi_settings[NUM_EMI_RECORD] = {
+#if defined (COMMON_DDR3_16BIT)
+    {
+        0x1,        /* sub_version */
+        0x0004,     /* TYPE */
+        0,      /* EMMC ID/FW ID checking length */
+        0,      /* FW length */
+        {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},      /* NAND_EMMC_ID */
+        {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},      /* FW_ID */
+        0x00002010,     /* EMI_CONA_VAL */
+        0x00000003,     /* EMI_CONH_VAL */
+        {   {
+                0x09090640,     /* U 00 */
+                0x19491401,     /* U 01 */
+                0x0B090201,     /* U 02 */
+                0x550C0306,     /* U 03 */
+                0x23566560,     /* U 04 */
+                0x00000908,     /* U 05 */
+                0x14140000,     /* U 06 */
+                0x00000000      /* U 07 */
+            }
+        },
+        {0x20000000,0,0,0},     /* DRAM RANK SIZE */
+        0x04210000,     /* EMI_CONF_VAL */
+        0x00000000,     /* CHN0_EMI_CONA_VAL */
+        0x00000000,     /* CHN1_EMI_CONA_VAL */
+        0x0,        /* dram_cbt_mode */
+        {0,0,0,0,0,0},      /* reserved 6 */
+        0x40000000,     /* PCDDR3_MODE_REG5 */
+        0,      /* PIN_MUX_TYPE for tablet */
+    } ,
+#else
+    {
+        0x1,            /* sub_version */
+        0x0003,         /* TYPE */
+        0,              /* EMMC ID/FW ID checking length */
+        0,              /* FW length */
+        {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},              /* NAND_EMMC_ID */
+        {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},              /* FW_ID */
+        0x0002a052,             /* EMI_CONA_VAL */
+        0x00000003,             /* EMI_CONH_VAL */
+        {
+            {
+                0x09090640,             /* U 00 */
+                0x19491401,             /* U 01 */
+                0x0B090201,             /* U 02 */
+                0x550C0306,             /* U 03 */
+                0x23566560,             /* U 04 */
+                0x00000908,             /* U 05 */
+                0x14140000,             /* U 06 */
+                0x00000000              /* U 07 */
+            }
+        },
+        {0x40000000,0x40000000,0,0},            /* DRAM RANK SIZE */
+        0x04210000,             /* EMI_CONF_VAL */
+        0x00000000,             /* CHN0_EMI_CONA_VAL */
+        0x00000000,             /* CHN1_EMI_CONA_VAL */
+        0x0,            /* dram_cbt_mode */
+        {0,0,0,0,0,0},          /* reserved 6 */
+        0x00000006,             /* LPDDR3_MODE_REG5 */
+        2,              /* PIN_MUX_TYPE for tablet */
+    } ,
+#endif
+};
+
+EMI_SETTINGS default_emi_setting = {
+    0x1,        /* sub_version */
+    0x0004,     /* TYPE */
+    0,      /* EMMC ID/FW ID checking length */
+    0,      /* FW length */
+    {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},      /* NAND_EMMC_ID */
+    {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},      /* FW_ID */
+    0x00002010,     /* EMI_CONA_VAL */
+    0x00000003,     /* EMI_CONH_VAL */
+    {   {
+            0x09090640,     /* U 00 */
+            0x19491401,     /* U 01 */
+            0x0B090201,     /* U 02 */
+            0x550C0306,     /* U 03 */
+            0x23566560,     /* U 04 */
+            0x00000908,     /* U 05 */
+            0x14140000,     /* U 06 */
+            0x00000000
+        }
+    },     /* U 07 */
+    {0x20000000,0,0,0},     /* DRAM RANK SIZE */
+    0x04210000,     /* EMI_CONF_VAL */
+    0x00000000,     /* CHN0_EMI_CONA_VAL */
+    0x00000000,     /* CHN1_EMI_CONA_VAL */
+    0x0,        /* dram_cbt_mode */
+    {0,0,0,0,0,0},      /* reserved 6 */
+    0x40000000,     /* PCDDR3_MODE_REG5 */
+    0,      /* PIN_MUX_TYPE for tablet */
+};
+
diff --git a/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/include/custom_emi.h b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/include/custom_emi.h
new file mode 100644
index 0000000..cdce2ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/include/custom_emi.h
@@ -0,0 +1,76 @@
+/*****************************************************************************
+*  Copyright Statement:
+*  --------------------
+*  This software is protected by Copyright and the information contained
+*  herein is confidential. The software may not be copied and the information
+*  contained herein may not be used or disclosed except with the written
+*  permission of MediaTek Inc. (C) 2008
+*
+*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ *   custom_emi.h
+ *
+ * Project:
+ * --------
+ *   Android
+ *
+ * Description:
+ * ------------
+ *   This Module defines the EMI (external memory interface) related setting.
+ *
+ * Author:
+ * -------
+ *  EMI auto generator V0.01
+ *
+ *   Memory Device database last modified on 2015/6/26
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * $Revision$
+ * $Modtime$
+ * $Log$
+ *
+ *------------------------------------------------------------------------------
+ * WARNING!!!  WARNING!!!   WARNING!!!  WARNING!!!  WARNING!!!  WARNING!!!
+ * This file is generated by EMI Auto-gen Tool.
+ * Please do not modify the content directly!
+ * It could be overwritten!
+ *============================================================================
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#pragma once
+
+#define COMBO_LPDDR2 (0+0)
+#define COMBO_LPDDR3 (0+0)
+#define COMBO_PCDDR3 (0+1)
diff --git a/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/rules.mk b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/rules.mk
new file mode 100644
index 0000000..2ee26cd
--- /dev/null
+++ b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/rules.mk
@@ -0,0 +1,60 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8516
+
+DDR_TYPE := COMMON_DDR3_16BIT
+TZ_PART_NAME := TEE1
+RECOVERY_TZ_PART_NAME = TEE2
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := BOOTIMG1
+RECOVERY_BOOT_PART_NAME = BOOTIMG2
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The SCRATCH_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff00000f400000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+SCRATCH_ADDR		:= 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00001b900000UL
+else
+SCRATCH_ADDR            := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+SCRATCH_SIZE		:= 0x04000000 # 64MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # reduce to 64M since DRAM in mt2635 only 256M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# SCRATCH_ADDR + SCRATCH_SIZE for upgrade
+# SCRATCH_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+# NAND_BUF_ADDR + MAX_NAND_BUF_SIZE for nand reserved dram buffer
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  SCRATCH_ADDR=$(SCRATCH_ADDR) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  MAX_TEE_DRAM_SIZE=$(MAX_TEE_DRAM_SIZE) \
+                  MAX_KERNEL_SIZE=$(MAX_KERNEL_SIZE) \
+                  MAX_DTB_SIZE=$(MAX_DTB_SIZE) \
+                  MAX_LZ4_BUF_SIZE=$(MAX_LZ4_BUF_SIZE) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/target.c b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/target.c
new file mode 100644
index 0000000..83003a0
--- /dev/null
+++ b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs-test/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+void target_init(void)
+{
+	emmc_init();
+}
+
diff --git a/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/custom_emi.c b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/custom_emi.c
new file mode 100644
index 0000000..daa433f
--- /dev/null
+++ b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/custom_emi.c
@@ -0,0 +1,172 @@
+/*****************************************************************************
+*  Copyright Statement:
+*  --------------------
+*  This software is protected by Copyright and the information contained
+*  herein is confidential. The software may not be copied and the information
+*  contained herein may not be used or disclosed except with the written
+*  permission of MediaTek Inc. (C) 2008
+*
+*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ *   custom_emi.c
+ *
+ * Project:
+ * --------
+ *   Android
+ *
+ * Description:
+ * ------------
+ *   This Module defines the EMI (external memory interface) related setting.
+ *
+ * Author:
+ * -------
+ *  EMI auto generator V0.01
+ *
+ *   Memory Device database last modified on 2015/6/26
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * $Revision$
+ * $Modtime$
+ * $Log$
+ *
+ *------------------------------------------------------------------------------
+ * WARNING!!!  WARNING!!!   WARNING!!!  WARNING!!!  WARNING!!!  WARNING!!!
+ * This file is generated by EMI Auto-gen Tool.
+ * Please do not modify the content directly!
+ * It could be overwritten!
+ *============================================================================
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+#include <platform/emi.h>
+
+#define NUM_EMI_RECORD (1)
+int num_of_emi_records = NUM_EMI_RECORD;
+
+EMI_SETTINGS emi_settings[NUM_EMI_RECORD] = {
+#if defined (COMMON_DDR3_16BIT)
+    {
+        0x1,        /* sub_version */
+        0x0004,     /* TYPE */
+        0,      /* EMMC ID/FW ID checking length */
+        0,      /* FW length */
+        {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},      /* NAND_EMMC_ID */
+        {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},      /* FW_ID */
+        0x00002010,     /* EMI_CONA_VAL */
+        0x00000003,     /* EMI_CONH_VAL */
+        {   {
+                0x09090640,     /* U 00 */
+                0x19491401,     /* U 01 */
+                0x0B090201,     /* U 02 */
+                0x550C0306,     /* U 03 */
+                0x23566560,     /* U 04 */
+                0x00000908,     /* U 05 */
+                0x14140000,     /* U 06 */
+                0x00000000      /* U 07 */
+            }
+        },
+        {0x20000000,0,0,0},     /* DRAM RANK SIZE */
+        0x04210000,     /* EMI_CONF_VAL */
+        0x00000000,     /* CHN0_EMI_CONA_VAL */
+        0x00000000,     /* CHN1_EMI_CONA_VAL */
+        0x0,        /* dram_cbt_mode */
+        {0,0,0,0,0,0},      /* reserved 6 */
+        0x40000000,     /* PCDDR3_MODE_REG5 */
+        0,      /* PIN_MUX_TYPE for tablet */
+    } ,
+#else
+    {
+        0x1,            /* sub_version */
+        0x0003,         /* TYPE */
+        0,              /* EMMC ID/FW ID checking length */
+        0,              /* FW length */
+        {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},              /* NAND_EMMC_ID */
+        {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},              /* FW_ID */
+        0x0002a052,             /* EMI_CONA_VAL */
+        0x00000003,             /* EMI_CONH_VAL */
+        {
+            {
+                0x09090640,             /* U 00 */
+                0x19491401,             /* U 01 */
+                0x0B090201,             /* U 02 */
+                0x550C0306,             /* U 03 */
+                0x23566560,             /* U 04 */
+                0x00000908,             /* U 05 */
+                0x14140000,             /* U 06 */
+                0x00000000              /* U 07 */
+            }
+        },
+        {0x40000000,0x40000000,0,0},            /* DRAM RANK SIZE */
+        0x04210000,             /* EMI_CONF_VAL */
+        0x00000000,             /* CHN0_EMI_CONA_VAL */
+        0x00000000,             /* CHN1_EMI_CONA_VAL */
+        0x0,            /* dram_cbt_mode */
+        {0,0,0,0,0,0},          /* reserved 6 */
+        0x00000006,             /* LPDDR3_MODE_REG5 */
+        2,              /* PIN_MUX_TYPE for tablet */
+    } ,
+#endif
+};
+
+EMI_SETTINGS default_emi_setting = {
+    0x1,        /* sub_version */
+    0x0004,     /* TYPE */
+    0,      /* EMMC ID/FW ID checking length */
+    0,      /* FW length */
+    {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},      /* NAND_EMMC_ID */
+    {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},      /* FW_ID */
+    0x00002010,     /* EMI_CONA_VAL */
+    0x00000003,     /* EMI_CONH_VAL */
+    {   {
+            0x09090640,     /* U 00 */
+            0x19491401,     /* U 01 */
+            0x0B090201,     /* U 02 */
+            0x550C0306,     /* U 03 */
+            0x23566560,     /* U 04 */
+            0x00000908,     /* U 05 */
+            0x14140000,     /* U 06 */
+            0x00000000
+        }
+    },     /* U 07 */
+    {0x20000000,0,0,0},     /* DRAM RANK SIZE */
+    0x04210000,     /* EMI_CONF_VAL */
+    0x00000000,     /* CHN0_EMI_CONA_VAL */
+    0x00000000,     /* CHN1_EMI_CONA_VAL */
+    0x0,        /* dram_cbt_mode */
+    {0,0,0,0,0,0},      /* reserved 6 */
+    0x40000000,     /* PCDDR3_MODE_REG5 */
+    0,      /* PIN_MUX_TYPE for tablet */
+};
+
diff --git a/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/include/custom_emi.h b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/include/custom_emi.h
new file mode 100644
index 0000000..cdce2ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/include/custom_emi.h
@@ -0,0 +1,76 @@
+/*****************************************************************************
+*  Copyright Statement:
+*  --------------------
+*  This software is protected by Copyright and the information contained
+*  herein is confidential. The software may not be copied and the information
+*  contained herein may not be used or disclosed except with the written
+*  permission of MediaTek Inc. (C) 2008
+*
+*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ *   custom_emi.h
+ *
+ * Project:
+ * --------
+ *   Android
+ *
+ * Description:
+ * ------------
+ *   This Module defines the EMI (external memory interface) related setting.
+ *
+ * Author:
+ * -------
+ *  EMI auto generator V0.01
+ *
+ *   Memory Device database last modified on 2015/6/26
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * $Revision$
+ * $Modtime$
+ * $Log$
+ *
+ *------------------------------------------------------------------------------
+ * WARNING!!!  WARNING!!!   WARNING!!!  WARNING!!!  WARNING!!!  WARNING!!!
+ * This file is generated by EMI Auto-gen Tool.
+ * Please do not modify the content directly!
+ * It could be overwritten!
+ *============================================================================
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#pragma once
+
+#define COMBO_LPDDR2 (0+0)
+#define COMBO_LPDDR3 (0+0)
+#define COMBO_PCDDR3 (0+1)
diff --git a/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/include/target/cust_usb.h b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/include/target/debugconfig.h b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/rules.mk b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/rules.mk
new file mode 100644
index 0000000..2ee26cd
--- /dev/null
+++ b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/rules.mk
@@ -0,0 +1,60 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8516
+
+DDR_TYPE := COMMON_DDR3_16BIT
+TZ_PART_NAME := TEE1
+RECOVERY_TZ_PART_NAME = TEE2
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := BOOTIMG1
+RECOVERY_BOOT_PART_NAME = BOOTIMG2
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The SCRATCH_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff00000f400000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+SCRATCH_ADDR		:= 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00001b900000UL
+else
+SCRATCH_ADDR            := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+SCRATCH_SIZE		:= 0x04000000 # 64MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # reduce to 64M since DRAM in mt2635 only 256M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# SCRATCH_ADDR + SCRATCH_SIZE for upgrade
+# SCRATCH_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+# NAND_BUF_ADDR + MAX_NAND_BUF_SIZE for nand reserved dram buffer
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  SCRATCH_ADDR=$(SCRATCH_ADDR) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  MAX_TEE_DRAM_SIZE=$(MAX_TEE_DRAM_SIZE) \
+                  MAX_KERNEL_SIZE=$(MAX_KERNEL_SIZE) \
+                  MAX_DTB_SIZE=$(MAX_DTB_SIZE) \
+                  MAX_LZ4_BUF_SIZE=$(MAX_LZ4_BUF_SIZE) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/target.c b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/target.c
new file mode 100644
index 0000000..83003a0
--- /dev/null
+++ b/src/bsp/lk/target/aud8516m3v5-emmc-32b-avs/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+void target_init(void)
+{
+	emmc_init();
+}
+
diff --git a/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/custom_emi.c b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/custom_emi.c
new file mode 100644
index 0000000..562845d
--- /dev/null
+++ b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/custom_emi.c
@@ -0,0 +1,117 @@
+/*****************************************************************************
+*  Copyright Statement:
+*  --------------------
+*  This software is protected by Copyright and the information contained
+*  herein is confidential. The software may not be copied and the information
+*  contained herein may not be used or disclosed except with the written
+*  permission of MediaTek Inc. (C) 2008
+*
+*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ *   custom_emi.c
+ *
+ * Project:
+ * --------
+ *   Android
+ *
+ * Description:
+ * ------------
+ *   This Module defines the EMI (external memory interface) related setting.
+ *
+ * Author:
+ * -------
+ *  EMI auto generator V0.01
+ *
+ *   Memory Device database last modified on 2015/6/26
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * $Revision$
+ * $Modtime$
+ * $Log$
+ *
+ *------------------------------------------------------------------------------
+ * WARNING!!!  WARNING!!!   WARNING!!!  WARNING!!!  WARNING!!!  WARNING!!!
+ * This file is generated by EMI Auto-gen Tool.
+ * Please do not modify the content directly!
+ * It could be overwritten!
+ *============================================================================
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+#include <platform/emi.h>
+
+#define NUM_EMI_RECORD (1)
+
+int num_of_emi_records = NUM_EMI_RECORD ;
+
+EMI_SETTINGS emi_settings[] = {
+    //COMMON_DDR3_1GB
+    {
+        0x0,        /* sub_version */
+        0x0004,     /* TYPE */
+        0,      /* EMMC ID/FW ID checking length */
+        0,      /* FW length */
+        {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},      /* NAND_EMMC_ID */
+        {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},      /* FW_ID */
+        0x00003122,     /* EMI_CONA_VAL */
+        0xAA00AA00,     /* DRAMC_DRVCTL0_VAL */
+        0xAA00AA00,     /* DRAMC_DRVCTL1_VAL */
+        0x448B47B7,     /* DRAMC_ACTIM_VAL */
+        0x01000000,     /* DRAMC_GDDR3CTL1_VAL */
+        0xF07486A3,     /* DRAMC_CONF1_VAL */
+        0xB18E22C1,     /* DRAMC_DDR2CTL_VAL */
+        0xBF8D0401,     /* DRAMC_TEST2_3_VAL */
+        0x03046960,     /* DRAMC_CONF2_VAL */
+        0xD5642842,     /* DRAMC_PD_CTRL_VAL */
+        0x00008888,     /* DRAMC_PADCTL3_VAL */
+        0x88888888,     /* DRAMC_DQODLY_VAL */
+        0x00000000,     /* DRAMC_ADDR_OUTPUT_DLY */
+        0x00000000,     /* DRAMC_CLK_OUTPUT_DLY */
+        0x00000660,     /* DRAMC_ACTIM1_VAL*/
+        0x07800000,     /* DRAMC_MISCTL0_VAL*/
+        0x040000D1,     /* DRAMC_ACTIM05T_VAL*/
+        {0x40000000,0,0,0},     /* DRAM RANK SIZE */
+        {0x00000004,0,0,0,0,0,0,0,0,0},     /* reserved 10 */
+        {   {
+                0x00001D71,     /* PCDDR3_MODE_REG0 */
+                0x00002000,     /* PCDDR3_MODE_REG1 */
+                0x00004018,     /* PCDDR3_MODE_REG2 */
+                0x00006000,     /* PCDDR3_MODE_REG3 */
+                0x00000024,     /* PCDDR3_MODE_REG4 */
+                0x00000000
+            }
+        },     /* PCDDR3_MODE_REG5 */
+    },
+};
diff --git a/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/custom_emi.h b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/custom_emi.h
new file mode 100644
index 0000000..cdce2ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/custom_emi.h
@@ -0,0 +1,76 @@
+/*****************************************************************************
+*  Copyright Statement:
+*  --------------------
+*  This software is protected by Copyright and the information contained
+*  herein is confidential. The software may not be copied and the information
+*  contained herein may not be used or disclosed except with the written
+*  permission of MediaTek Inc. (C) 2008
+*
+*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ *   custom_emi.h
+ *
+ * Project:
+ * --------
+ *   Android
+ *
+ * Description:
+ * ------------
+ *   This Module defines the EMI (external memory interface) related setting.
+ *
+ * Author:
+ * -------
+ *  EMI auto generator V0.01
+ *
+ *   Memory Device database last modified on 2015/6/26
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * $Revision$
+ * $Modtime$
+ * $Log$
+ *
+ *------------------------------------------------------------------------------
+ * WARNING!!!  WARNING!!!   WARNING!!!  WARNING!!!  WARNING!!!  WARNING!!!
+ * This file is generated by EMI Auto-gen Tool.
+ * Please do not modify the content directly!
+ * It could be overwritten!
+ *============================================================================
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#pragma once
+
+#define COMBO_LPDDR2 (0+0)
+#define COMBO_LPDDR3 (0+0)
+#define COMBO_PCDDR3 (0+1)
diff --git a/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/target/cust_usb.h b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/target/debugconfig.h b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/rules.mk b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/rules.mk
new file mode 100644
index 0000000..35be0a3
--- /dev/null
+++ b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/rules.mk
@@ -0,0 +1,62 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8516
+
+TZ_PART_NAME := TEE1
+RECOVERY_TZ_PART_NAME = TEE2
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := BOOTIMG1
+RECOVERY_BOOT_PART_NAME = BOOTIMG2
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The SCRATCH_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff00000f400000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+SCRATCH_ADDR		    := 0xffff00000DC00000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+SCRATCH_ADDR            := 0x40600000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x42400000
+endif
+SCRATCH_SIZE		    := 0x00800000 #  64M -> 40M for max rootfs ->8M
+
+MAX_TEE_DRAM_SIZE	:= 0x00300000 # 2M ->3M
+MAX_KERNEL_SIZE		:= 0x00600000 # 12M  ->6M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# SCRATCH_ADDR + SCRATCH_SIZE for upgrade
+# SCRATCH_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+# NAND_BUF_ADDR + MAX_NAND_BUF_SIZE for nand reserved dram buffer
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  SCRATCH_ADDR=$(SCRATCH_ADDR) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  MAX_TEE_DRAM_SIZE=$(MAX_TEE_DRAM_SIZE) \
+                  MAX_KERNEL_SIZE=$(MAX_KERNEL_SIZE) \
+                  MAX_DTB_SIZE=$(MAX_DTB_SIZE) \
+                  MAX_LZ4_BUF_SIZE=$(MAX_LZ4_BUF_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR) \
+                  MAX_NAND_BUF_SIZE=$(MAX_NAND_BUF_SIZE)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/nand \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/target.c b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/target.c
new file mode 100644
index 0000000..a47315d
--- /dev/null
+++ b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/target.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+#include "platform/led.h"
+
+void target_init(void)
+{
+    nand_init_device();
+    led_init();
+}
+
diff --git a/src/bsp/lk/target/aud8518am1-emmc/include/target/cust_usb.h b/src/bsp/lk/target/aud8518am1-emmc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518am1-emmc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518am1-emmc/include/target/debugconfig.h b/src/bsp/lk/target/aud8518am1-emmc/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518am1-emmc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518am1-emmc/rules.mk b/src/bsp/lk/target/aud8518am1-emmc/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518am1-emmc/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518am1-emmc/target.c b/src/bsp/lk/target/aud8518am1-emmc/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518am1-emmc/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518am1-slc/include/target/cust_usb.h b/src/bsp/lk/target/aud8518am1-slc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518am1-slc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518am1-slc/include/target/debugconfig.h b/src/bsp/lk/target/aud8518am1-slc/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518am1-slc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518am1-slc/rules.mk b/src/bsp/lk/target/aud8518am1-slc/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518am1-slc/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518am1-slc/target.c b/src/bsp/lk/target/aud8518am1-slc/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518am1-slc/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518am2-emmc/include/target/cust_usb.h b/src/bsp/lk/target/aud8518am2-emmc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518am2-emmc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518am2-emmc/include/target/debugconfig.h b/src/bsp/lk/target/aud8518am2-emmc/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518am2-emmc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518am2-emmc/rules.mk b/src/bsp/lk/target/aud8518am2-emmc/rules.mk
new file mode 100644
index 0000000..862b069
--- /dev/null
+++ b/src/bsp/lk/target/aud8518am2-emmc/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518am2-emmc/target.c b/src/bsp/lk/target/aud8518am2-emmc/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8518am2-emmc/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-amic/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-emmc-32b-amic/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-amic/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-amic/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-emmc-32b-amic/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-amic/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-amic/rules.mk b/src/bsp/lk/target/aud8518ap1-emmc-32b-amic/rules.mk
new file mode 100644
index 0000000..e7b212d
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-amic/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-amic/target.c b/src/bsp/lk/target/aud8518ap1-emmc-32b-amic/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-amic/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-avs-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-avs-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-avs-test/rules.mk b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs-test/rules.mk
new file mode 100644
index 0000000..e7b212d
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs-test/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-avs-test/target.c b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs-test/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs-test/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-avs/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-avs/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-avs/rules.mk b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs/rules.mk
new file mode 100644
index 0000000..e7b212d
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-avs/target.c b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-avs/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-eng/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-eng/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-eng/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-eng/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-eng/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-eng/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-eng/rules.mk b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-eng/rules.mk
new file mode 100644
index 0000000..e7b212d
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-eng/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-eng/target.c b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-eng/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-eng/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-user/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-user/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-user/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-user/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-user/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-user/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-user/rules.mk b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-user/rules.mk
new file mode 100644
index 0000000..e7b212d
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-user/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-user/target.c b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-user/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b-gva-user/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-emmc-32b/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-emmc-32b/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b/rules.mk b/src/bsp/lk/target/aud8518ap1-emmc-32b/rules.mk
new file mode 100644
index 0000000..e7b212d
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-emmc-32b/target.c b/src/bsp/lk/target/aud8518ap1-emmc-32b/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-emmc-32b/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-apo-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-slc-32b-apo-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-apo-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-apo-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-slc-32b-apo-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-apo-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-apo-test/rules.mk b/src/bsp/lk/target/aud8518ap1-slc-32b-apo-test/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-apo-test/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-apo-test/target.c b/src/bsp/lk/target/aud8518ap1-slc-32b-apo-test/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-apo-test/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-apo/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-slc-32b-apo/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-apo/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-apo/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-slc-32b-apo/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-apo/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-apo/rules.mk b/src/bsp/lk/target/aud8518ap1-slc-32b-apo/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-apo/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-apo/target.c b/src/bsp/lk/target/aud8518ap1-slc-32b-apo/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-apo/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-avs-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-avs-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-avs-test/rules.mk b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-test/rules.mk
new file mode 100644
index 0000000..f720869
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-test/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR) \
+				  WITH_LP5523_LED=$(WITH_LP5523_LED)
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-avs-test/target.c b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-test/target.c
new file mode 100644
index 0000000..7f63ab7
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-test/target.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+#include "platform/led.h"
+
+void target_init(void)
+{
+	nand_init_device();
+#if WITH_LP5523_LED
+	led_init();
+#endif
+}
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-avs-vad-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-vad-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-vad-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-avs-vad-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-vad-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-vad-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-avs-vad-test/rules.mk b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-vad-test/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-vad-test/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-avs-vad-test/target.c b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-vad-test/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-avs-vad-test/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-avs/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-slc-32b-avs/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-avs/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-avs/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-slc-32b-avs/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-avs/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-avs/rules.mk b/src/bsp/lk/target/aud8518ap1-slc-32b-avs/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-avs/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-avs/target.c b/src/bsp/lk/target/aud8518ap1-slc-32b-avs/target.c
new file mode 100644
index 0000000..7f63ab7
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-avs/target.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+#include "platform/led.h"
+
+void target_init(void)
+{
+	nand_init_device();
+#if WITH_LP5523_LED
+	led_init();
+#endif
+}
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-codecdev-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-slc-32b-codecdev-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-codecdev-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-codecdev-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-slc-32b-codecdev-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-codecdev-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-codecdev-test/rules.mk b/src/bsp/lk/target/aud8518ap1-slc-32b-codecdev-test/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-codecdev-test/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-codecdev-test/target.c b/src/bsp/lk/target/aud8518ap1-slc-32b-codecdev-test/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-codecdev-test/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-gva-eng/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-eng/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-eng/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-gva-eng/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-eng/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-eng/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-gva-eng/rules.mk b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-eng/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-eng/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-gva-eng/target.c b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-eng/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-eng/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-gva-user/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-user/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-user/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-gva-user/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-user/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-user/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-gva-user/rules.mk b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-user/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-user/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-gva-user/target.c b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-user/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-gva-user/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-slc-32b-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-slc-32b-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-test/rules.mk b/src/bsp/lk/target/aud8518ap1-slc-32b-test/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-test/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-test/target.c b/src/bsp/lk/target/aud8518ap1-slc-32b-test/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-test/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-uboot/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-slc-32b-uboot/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-uboot/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-uboot/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-slc-32b-uboot/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-uboot/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-uboot/rules.mk b/src/bsp/lk/target/aud8518ap1-slc-32b-uboot/rules.mk
new file mode 100644
index 0000000..abfec02
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-uboot/rules.mk
@@ -0,0 +1,68 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+WITH_UBOOT :=1
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+ifeq ($(WITH_UBOOT),1)
+BOOT_PART_NAME :=  bl2_a
+RECOVERY_BOOT_PART_NAME =  bl2_b
+else
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+endif
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+
+
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR) \
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-uboot/target.c b/src/bsp/lk/target/aud8518ap1-slc-32b-uboot/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-uboot/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-vad-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-slc-32b-vad-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-vad-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-vad-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-slc-32b-vad-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-vad-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-vad-test/rules.mk b/src/bsp/lk/target/aud8518ap1-slc-32b-vad-test/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-vad-test/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b-vad-test/target.c b/src/bsp/lk/target/aud8518ap1-slc-32b-vad-test/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b-vad-test/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-slc-32b/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-slc-32b/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b/rules.mk b/src/bsp/lk/target/aud8518ap1-slc-32b/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-slc-32b/target.c b/src/bsp/lk/target/aud8518ap1-slc-32b/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-32b/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-slc-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-slc-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-slc-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc-test/rules.mk b/src/bsp/lk/target/aud8518ap1-slc-test/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-test/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-slc-test/target.c b/src/bsp/lk/target/aud8518ap1-slc-test/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc-test/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc/include/target/cust_usb.h b/src/bsp/lk/target/aud8518ap1-slc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518ap1-slc/include/target/debugconfig.h b/src/bsp/lk/target/aud8518ap1-slc/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518ap1-slc/rules.mk b/src/bsp/lk/target/aud8518ap1-slc/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518ap1-slc/target.c b/src/bsp/lk/target/aud8518ap1-slc/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518ap1-slc/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518bm1-emmc/include/target/cust_usb.h b/src/bsp/lk/target/aud8518bm1-emmc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm1-emmc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518bm1-emmc/include/target/debugconfig.h b/src/bsp/lk/target/aud8518bm1-emmc/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm1-emmc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518bm1-emmc/rules.mk b/src/bsp/lk/target/aud8518bm1-emmc/rules.mk
new file mode 100644
index 0000000..862b069
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm1-emmc/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518bm1-emmc/target.c b/src/bsp/lk/target/aud8518bm1-emmc/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm1-emmc/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8518bm1-ldvt-slc/include/target/cust_usb.h b/src/bsp/lk/target/aud8518bm1-ldvt-slc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm1-ldvt-slc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518bm1-ldvt-slc/include/target/debugconfig.h b/src/bsp/lk/target/aud8518bm1-ldvt-slc/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm1-ldvt-slc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518bm1-ldvt-slc/rules.mk b/src/bsp/lk/target/aud8518bm1-ldvt-slc/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm1-ldvt-slc/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518bm1-ldvt-slc/target.c b/src/bsp/lk/target/aud8518bm1-ldvt-slc/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm1-ldvt-slc/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518bm1-slc/include/target/cust_usb.h b/src/bsp/lk/target/aud8518bm1-slc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm1-slc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518bm1-slc/include/target/debugconfig.h b/src/bsp/lk/target/aud8518bm1-slc/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm1-slc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518bm1-slc/rules.mk b/src/bsp/lk/target/aud8518bm1-slc/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm1-slc/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518bm1-slc/target.c b/src/bsp/lk/target/aud8518bm1-slc/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm1-slc/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518bm2-emmc/include/target/cust_usb.h b/src/bsp/lk/target/aud8518bm2-emmc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm2-emmc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518bm2-emmc/include/target/debugconfig.h b/src/bsp/lk/target/aud8518bm2-emmc/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm2-emmc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518bm2-emmc/rules.mk b/src/bsp/lk/target/aud8518bm2-emmc/rules.mk
new file mode 100644
index 0000000..862b069
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm2-emmc/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518bm2-emmc/target.c b/src/bsp/lk/target/aud8518bm2-emmc/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bm2-emmc/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-avs-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518bp1-slc-32b-avs-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-avs-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-avs-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518bp1-slc-32b-avs-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-avs-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-avs-test/rules.mk b/src/bsp/lk/target/aud8518bp1-slc-32b-avs-test/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-avs-test/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-avs-test/target.c b/src/bsp/lk/target/aud8518bp1-slc-32b-avs-test/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-avs-test/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-avs/include/target/cust_usb.h b/src/bsp/lk/target/aud8518bp1-slc-32b-avs/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-avs/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-avs/include/target/debugconfig.h b/src/bsp/lk/target/aud8518bp1-slc-32b-avs/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-avs/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-avs/rules.mk b/src/bsp/lk/target/aud8518bp1-slc-32b-avs/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-avs/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-avs/target.c b/src/bsp/lk/target/aud8518bp1-slc-32b-avs/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-avs/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-gva-eng/include/target/cust_usb.h b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-eng/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-eng/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-gva-eng/include/target/debugconfig.h b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-eng/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-eng/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-gva-eng/rules.mk b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-eng/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-eng/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-gva-eng/target.c b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-eng/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-eng/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-gva-user/include/target/cust_usb.h b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-user/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-user/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-gva-user/include/target/debugconfig.h b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-user/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-user/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-gva-user/rules.mk b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-user/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-user/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-gva-user/target.c b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-user/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-gva-user/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518bp1-slc-32b-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518bp1-slc-32b-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-test/rules.mk b/src/bsp/lk/target/aud8518bp1-slc-32b-test/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-test/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b-test/target.c b/src/bsp/lk/target/aud8518bp1-slc-32b-test/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b-test/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b/include/target/cust_usb.h b/src/bsp/lk/target/aud8518bp1-slc-32b/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b/include/target/debugconfig.h b/src/bsp/lk/target/aud8518bp1-slc-32b/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b/rules.mk b/src/bsp/lk/target/aud8518bp1-slc-32b/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518bp1-slc-32b/target.c b/src/bsp/lk/target/aud8518bp1-slc-32b/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-32b/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518bp1-slc-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518bp1-slc-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518bp1-slc-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc-test/rules.mk b/src/bsp/lk/target/aud8518bp1-slc-test/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-test/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518bp1-slc-test/target.c b/src/bsp/lk/target/aud8518bp1-slc-test/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc-test/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc/include/target/cust_usb.h b/src/bsp/lk/target/aud8518bp1-slc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518bp1-slc/include/target/debugconfig.h b/src/bsp/lk/target/aud8518bp1-slc/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518bp1-slc/rules.mk b/src/bsp/lk/target/aud8518bp1-slc/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518bp1-slc/target.c b/src/bsp/lk/target/aud8518bp1-slc/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518bp1-slc/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518fpga-slc/include/target/cust_usb.h b/src/bsp/lk/target/aud8518fpga-slc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518fpga-slc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518fpga-slc/include/target/debugconfig.h b/src/bsp/lk/target/aud8518fpga-slc/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518fpga-slc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518fpga-slc/rules.mk b/src/bsp/lk/target/aud8518fpga-slc/rules.mk
new file mode 100644
index 0000000..37e39a5
--- /dev/null
+++ b/src/bsp/lk/target/aud8518fpga-slc/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x06000000 # 96MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518fpga-slc/target.c b/src/bsp/lk/target/aud8518fpga-slc/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518fpga-slc/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518fpga/include/target/cust_usb.h b/src/bsp/lk/target/aud8518fpga/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518fpga/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518fpga/include/target/debugconfig.h b/src/bsp/lk/target/aud8518fpga/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518fpga/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518fpga/rules.mk b/src/bsp/lk/target/aud8518fpga/rules.mk
new file mode 100644
index 0000000..fcf20ef
--- /dev/null
+++ b/src/bsp/lk/target/aud8518fpga/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x06000000 # 96MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518fpga/target.c b/src/bsp/lk/target/aud8518fpga/target.c
new file mode 100644
index 0000000..9a0bc02
--- /dev/null
+++ b/src/bsp/lk/target/aud8518fpga/target.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
+
diff --git a/src/bsp/lk/target/aud8518sm1-slc-32b/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sm1-slc-32b/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sm1-slc-32b/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sm1-slc-32b/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sm1-slc-32b/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sm1-slc-32b/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sm1-slc-32b/rules.mk b/src/bsp/lk/target/aud8518sm1-slc-32b/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sm1-slc-32b/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sm1-slc-32b/target.c b/src/bsp/lk/target/aud8518sm1-slc-32b/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sm1-slc-32b/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518sp2-emmc-32b-uboot/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp2-emmc-32b-uboot/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-emmc-32b-uboot/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp2-emmc-32b-uboot/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp2-emmc-32b-uboot/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-emmc-32b-uboot/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp2-emmc-32b-uboot/rules.mk b/src/bsp/lk/target/aud8518sp2-emmc-32b-uboot/rules.mk
new file mode 100644
index 0000000..f371fb1
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-emmc-32b-uboot/rules.mk
@@ -0,0 +1,63 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+WITH_UBOOT :=1
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+ifeq ($(WITH_UBOOT),1)
+BOOT_PART_NAME :=  bl2_a
+RECOVERY_BOOT_PART_NAME =  bl2_b
+else
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+endif
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp2-emmc-32b-uboot/target.c b/src/bsp/lk/target/aud8518sp2-emmc-32b-uboot/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-emmc-32b-uboot/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8518sp2-emmc-uboot/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp2-emmc-uboot/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-emmc-uboot/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp2-emmc-uboot/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp2-emmc-uboot/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-emmc-uboot/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp2-emmc-uboot/rules.mk b/src/bsp/lk/target/aud8518sp2-emmc-uboot/rules.mk
new file mode 100644
index 0000000..f371fb1
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-emmc-uboot/rules.mk
@@ -0,0 +1,63 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+WITH_UBOOT :=1
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+ifeq ($(WITH_UBOOT),1)
+BOOT_PART_NAME :=  bl2_a
+RECOVERY_BOOT_PART_NAME =  bl2_b
+else
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+endif
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp2-emmc-uboot/target.c b/src/bsp/lk/target/aud8518sp2-emmc-uboot/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-emmc-uboot/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-eng/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-eng/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-eng/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-eng/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-eng/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-eng/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-eng/rules.mk b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-eng/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-eng/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-eng/target.c b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-eng/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-eng/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user-test/rules.mk b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user-test/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user-test/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user-test/target.c b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user-test/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user-test/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user/rules.mk b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user/target.c b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-c4a-user/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-dsp/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp2-slc-32b-dsp/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-dsp/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-dsp/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp2-slc-32b-dsp/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-dsp/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-dsp/rules.mk b/src/bsp/lk/target/aud8518sp2-slc-32b-dsp/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-dsp/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-dsp/target.c b/src/bsp/lk/target/aud8518sp2-slc-32b-dsp/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-dsp/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-gva-eng/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-eng/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-eng/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-gva-eng/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-eng/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-eng/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-gva-eng/rules.mk b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-eng/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-eng/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-gva-eng/target.c b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-eng/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-eng/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user-test/rules.mk b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user-test/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user-test/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user-test/target.c b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user-test/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user-test/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user/rules.mk b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user/target.c b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-gva-user/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-disp/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-disp/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-disp/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-disp/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-disp/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-disp/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-disp/rules.mk b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-disp/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-disp/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-disp/target.c b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-disp/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-disp/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-test/rules.mk b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-test/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-test/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-test/target.c b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-test/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663-test/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663/rules.mk b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663/rules.mk
new file mode 100644
index 0000000..9dcc6bb
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x4e300000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE       := 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663/target.c b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-mt7663/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp2-slc-32b-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp2-slc-32b-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-test/rules.mk b/src/bsp/lk/target/aud8518sp2-slc-32b-test/rules.mk
new file mode 100644
index 0000000..7b03d16
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-test/rules.mk
@@ -0,0 +1,65 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff000010900000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x43300000
+endif
+
+CACHED_MEMPOOL_SIZE     := 0x2000000 # 48MB
+
+
+SCRATCH_SIZE		:= 0x800000 # 8MB
+
+MAX_TEE_DRAM_SIZE	:= 0x00400000 # 4M
+MAX_KERNEL_SIZE		:= 0x01000000 # 16M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b-test/target.c b/src/bsp/lk/target/aud8518sp2-slc-32b-test/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b-test/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp2-slc-32b/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp2-slc-32b/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b/rules.mk b/src/bsp/lk/target/aud8518sp2-slc-32b/rules.mk
new file mode 100644
index 0000000..7b03d16
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b/rules.mk
@@ -0,0 +1,65 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+# The NAND_BUF_ADDR virtual address would be 0xffff00001C000000UL + 0x00200000 = 0xffff00001C200000UL
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff000010900000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x43300000
+endif
+
+CACHED_MEMPOOL_SIZE     := 0x2000000 # 48MB
+
+
+SCRATCH_SIZE		:= 0x800000 # 8MB
+
+MAX_TEE_DRAM_SIZE	:= 0x00400000 # 4M
+MAX_KERNEL_SIZE		:= 0x01000000 # 16M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR)
+
+MODULE_DEPS += \
+	platform/$(PLATFORM)/drivers/nand
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp2-slc-32b/target.c b/src/bsp/lk/target/aud8518sp2-slc-32b/target.c
new file mode 100644
index 0000000..2ef9563
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp2-slc-32b/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+	nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-eng/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-eng/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-eng/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-eng/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-eng/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-eng/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-eng/rules.mk b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-eng/rules.mk
new file mode 100644
index 0000000..862b069
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-eng/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-eng/target.c b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-eng/target.c
new file mode 100644
index 0000000..69115c1
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-eng/target.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+#include <platform/mt_reg_base.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+    writel(0x7, GPIO_BASE + 0x408);//set gpio80 gpio mode
+    writel(0x1, GPIO_BASE + 0x054);//set gpio80 output
+    writel(0x1, GPIO_BASE + 0x154);//set gpio80 output-high
+}
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user-test/rules.mk b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user-test/rules.mk
new file mode 100644
index 0000000..862b069
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user-test/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user-test/target.c b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user-test/target.c
new file mode 100644
index 0000000..69115c1
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user-test/target.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+#include <platform/mt_reg_base.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+    writel(0x7, GPIO_BASE + 0x408);//set gpio80 gpio mode
+    writel(0x1, GPIO_BASE + 0x054);//set gpio80 output
+    writel(0x1, GPIO_BASE + 0x154);//set gpio80 output-high
+}
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user/rules.mk b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user/rules.mk
new file mode 100644
index 0000000..862b069
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user/target.c b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user/target.c
new file mode 100644
index 0000000..69115c1
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-c4a-user/target.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+#include <platform/mt_reg_base.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+    writel(0x7, GPIO_BASE + 0x408);//set gpio80 gpio mode
+    writel(0x1, GPIO_BASE + 0x054);//set gpio80 output
+    writel(0x1, GPIO_BASE + 0x154);//set gpio80 output-high
+}
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-eng/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-eng/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-eng/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-eng/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-eng/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-eng/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-eng/rules.mk b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-eng/rules.mk
new file mode 100644
index 0000000..862b069
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-eng/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-eng/target.c b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-eng/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-eng/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user-test/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user-test/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user-test/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user-test/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user-test/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user-test/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user-test/rules.mk b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user-test/rules.mk
new file mode 100644
index 0000000..862b069
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user-test/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user-test/target.c b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user-test/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user-test/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user/rules.mk b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user/rules.mk
new file mode 100644
index 0000000..862b069
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user/target.c b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user/target.c
new file mode 100644
index 0000000..1ab1536
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-gva-user/target.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-mt7663-disp/include/target/cust_usb.h b/src/bsp/lk/target/aud8518sp3-emmc-32b-mt7663-disp/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-mt7663-disp/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-mt7663-disp/include/target/debugconfig.h b/src/bsp/lk/target/aud8518sp3-emmc-32b-mt7663-disp/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-mt7663-disp/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-mt7663-disp/rules.mk b/src/bsp/lk/target/aud8518sp3-emmc-32b-mt7663-disp/rules.mk
new file mode 100644
index 0000000..862b069
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-mt7663-disp/rules.mk
@@ -0,0 +1,57 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8518
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_b
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot_a
+RECOVERY_BOOT_PART_NAME = boot_b
+SPM_PART_NAME := spmfw
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The CACHED_MEMPOOL_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff000011600000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+SCRATCH_SIZE		:= 0x1E00000 # 30MB
+
+MAX_TEE_DRAM_SIZE	:= 0x04000000 # 64M
+MAX_KERNEL_SIZE		:= 0x02000000 # 32M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+
+# CACHED_MEMPOOL_ADDR + CACHED_MEMPOOL_SIZE for upgrade
+# CACHED_MEMPOOL_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8518sp3-emmc-32b-mt7663-disp/target.c b/src/bsp/lk/target/aud8518sp3-emmc-32b-mt7663-disp/target.c
new file mode 100644
index 0000000..69115c1
--- /dev/null
+++ b/src/bsp/lk/target/aud8518sp3-emmc-32b-mt7663-disp/target.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+#include <platform/mmc_core.h>
+#include <platform/mt_reg_base.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+    writel(0x7, GPIO_BASE + 0x408);//set gpio80 gpio mode
+    writel(0x1, GPIO_BASE + 0x054);//set gpio80 output
+    writel(0x1, GPIO_BASE + 0x154);//set gpio80 output-high
+}
diff --git a/src/bsp/lk/target/aud8521pevb2-nand/include/target/cust_usb.h b/src/bsp/lk/target/aud8521pevb2-nand/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aud8521pevb2-nand/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8521pevb2-nand/include/target/debugconfig.h b/src/bsp/lk/target/aud8521pevb2-nand/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aud8521pevb2-nand/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8521pevb2-nand/rules.mk b/src/bsp/lk/target/aud8521pevb2-nand/rules.mk
new file mode 100644
index 0000000..9e94be6
--- /dev/null
+++ b/src/bsp/lk/target/aud8521pevb2-nand/rules.mk
@@ -0,0 +1,51 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c \
+
+PLATFORM := mt2701
+
+TZ_PART_NAME := TEE1
+RECOVERY_TZ_PART_NAME = TEE2
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := UBOOT1
+RECOVERY_BOOT_PART_NAME = UBOOT2
+
+CACHED_MEMPOOL_ADDR := 0x85000000
+CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+
+SCRATCH_SIZE        := 0x08000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x10000000 # 256M
+
+BL33_ADDR := 0x81e00000
+
+OPTION_CLEAR_FASTBOOT_FLAG := 1
+OPTION_CLEAR_RECOVERY_FLAG := 1
+
+# NAND page address of PMBR for those NAND projects that PMBR is not at LBA0
+NAND_PAGE_ADDR_OF_PMBR := 512
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  OPTION_CLEAR_FASTBOOT_FLAG=$(OPTION_CLEAR_FASTBOOT_FLAG) \
+                  OPTION_CLEAR_RECOVERY_FLAG=$(OPTION_CLEAR_RECOVERY_FLAG) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  CUSTOM_DEFAULT_STACK_SIZE=10240 \
+                  NAND_PAGE_ADDR_OF_PMBR=$(NAND_PAGE_ADDR_OF_PMBR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/nand \
+    platform/$(PLATFORM)/drivers/efuse \
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/aud8521pevb2-nand/target.c b/src/bsp/lk/target/aud8521pevb2-nand/target.c
new file mode 100644
index 0000000..db4e219
--- /dev/null
+++ b/src/bsp/lk/target/aud8521pevb2-nand/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+
+void target_init(void)
+{
+    nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/aud8521pevb2/include/target/cust_usb.h b/src/bsp/lk/target/aud8521pevb2/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/aud8521pevb2/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8521pevb2/include/target/debugconfig.h b/src/bsp/lk/target/aud8521pevb2/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aud8521pevb2/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8521pevb2/rules.mk b/src/bsp/lk/target/aud8521pevb2/rules.mk
new file mode 100644
index 0000000..197fcdb
--- /dev/null
+++ b/src/bsp/lk/target/aud8521pevb2/rules.mk
@@ -0,0 +1,46 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c \
+
+PLATFORM := mt2701
+
+TZ_PART_NAME := TEE1
+RECOVERY_TZ_PART_NAME = TEE1
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := BOOTIMG
+RECOVERY_BOOT_PART_NAME = RECOVERY
+
+CACHED_MEMPOOL_ADDR := 0x85000000
+CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+
+SCRATCH_SIZE        := 0x08000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x10000000 # 256M
+
+BL33_ADDR := 0x81e00000
+
+OPTION_CLEAR_FASTBOOT_FLAG := 1
+OPTION_CLEAR_RECOVERY_FLAG := 1
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  OPTION_CLEAR_FASTBOOT_FLAG=$(OPTION_CLEAR_FASTBOOT_FLAG) \
+                  OPTION_CLEAR_RECOVERY_FLAG=$(OPTION_CLEAR_RECOVERY_FLAG) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+    platform/$(PLATFORM)/drivers/efuse \
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/aud8521pevb2/target.c b/src/bsp/lk/target/aud8521pevb2/target.c
new file mode 100644
index 0000000..740ca9e
--- /dev/null
+++ b/src/bsp/lk/target/aud8521pevb2/target.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+void target_init(void)
+{
+    emmc_init();
+}
+
diff --git a/src/bsp/lk/target/auto2635evb2-ivt/include/target/cust_usb.h b/src/bsp/lk/target/auto2635evb2-ivt/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/auto2635evb2-ivt/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2635evb2-ivt/include/target/debugconfig.h b/src/bsp/lk/target/auto2635evb2-ivt/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2635evb2-ivt/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2635evb2-ivt/rules.mk b/src/bsp/lk/target/auto2635evb2-ivt/rules.mk
new file mode 100644
index 0000000..194d17e
--- /dev/null
+++ b/src/bsp/lk/target/auto2635evb2-ivt/rules.mk
@@ -0,0 +1,34 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+PLATFORM := mt2635
+
+TZ_PART_NAME := tee1
+RECOVERY_TZ_PART_NAME = tee2
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := boot
+RECOVERY_BOOT_PART_NAME = recovery
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The SCRATCH_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff00000f400000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+CACHED_MEMPOOL_ADDR     := 0xffff000011600000UL
+BL33_ADDR               := 0xffff00000f400000UL
+else
+CACHED_MEMPOOL_ADDR     := 0x44000000
+BL33_ADDR               := 0x41e00000
+endif
+CACHED_MEMPOOL_SIZE     := 0x0AA00000 # 170MB
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
diff --git a/src/bsp/lk/target/auto2701evb2-ivi/include/target/cust_usb.h b/src/bsp/lk/target/auto2701evb2-ivi/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/auto2701evb2-ivi/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2701evb2-ivi/include/target/debugconfig.h b/src/bsp/lk/target/auto2701evb2-ivi/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2701evb2-ivi/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2701evb2-ivi/rules.mk b/src/bsp/lk/target/auto2701evb2-ivi/rules.mk
new file mode 100644
index 0000000..97fd0a3
--- /dev/null
+++ b/src/bsp/lk/target/auto2701evb2-ivi/rules.mk
@@ -0,0 +1,45 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c \
+
+PLATFORM := mt2701
+
+TZ_PART_NAME := TEE1
+RECOVERY_TZ_PART_NAME = TEE1
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := BOOTIMG
+RECOVERY_BOOT_PART_NAME = RECOVERY
+
+CACHED_MEMPOOL_ADDR := 0x85000000
+CACHED_MEMPOOL_SIZE := 0x1AE00000 # 430MB
+
+SCRATCH_SIZE        := 0x08000000 # 128MB
+MAX_TEE_DRAM_SIZE   := 0x10000000 # 256M
+
+BL33_ADDR := 0x81e00000
+
+# SCRATCH_ADDR + SCRATCH_SIZE for upgrade
+# SCRATCH_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+                  CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+                  BL33_ADDR=$(BL33_ADDR)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/nor \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/auto2701evb2-ivi/target.c b/src/bsp/lk/target/auto2701evb2-ivi/target.c
new file mode 100644
index 0000000..302a7d9
--- /dev/null
+++ b/src/bsp/lk/target/auto2701evb2-ivi/target.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+#include <platform/mtk_nor.h>
+
+void target_init(void)
+{
+    nor_init_device();
+    emmc_init();
+}
+
diff --git a/src/bsp/lk/target/auto2712-emmc/include/target/cust_usb.h b/src/bsp/lk/target/auto2712-emmc/include/target/cust_usb.h
new file mode 100644
index 0000000..ff7e84d
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-emmc/include/target/cust_usb.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2712-emmc/include/target/debugconfig.h b/src/bsp/lk/target/auto2712-emmc/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-emmc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2712-emmc/include/target/io_pwr.h b/src/bsp/lk/target/auto2712-emmc/include/target/io_pwr.h
new file mode 100644
index 0000000..905dfdd
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-emmc/include/target/io_pwr.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2712m1v1 io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
diff --git a/src/bsp/lk/target/auto2712-emmc/rules.mk b/src/bsp/lk/target/auto2712-emmc/rules.mk
new file mode 100644
index 0000000..0ae698f
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-emmc/rules.mk
@@ -0,0 +1,22 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt2712
+DRAM_TYPE := LPDDR4
+
+SRC_CLOCK := 26000000
+
+GLOBAL_CFLAGS +=  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2712-emmc/target.c b/src/bsp/lk/target/auto2712-emmc/target.c
new file mode 100644
index 0000000..c574153
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-emmc/target.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <errno.h>
+#include <lib/bio.h>
+#include <platform/mmc_core.h>
+#include <platform/mtk_bio_ioctl.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if LK_AS_BL33
+    card = emmc_init_stage1(&retry_opcond, true);
+#else
+    card = emmc_init_stage1(&retry_opcond, false);
+#endif
+
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    if (card) {
+#if LK_AS_BL33
+        emmc_init_stage2(card, retry_opcond, true);
+#else
+        emmc_init_stage2(card, retry_opcond, false);
+#endif
+    }
+    extern void do_check_mrdump(void) __attribute__((weak));
+    if (do_check_mrdump)
+        do_check_mrdump();
+}
+
+int target_ab_set_active_bootdev(int slot)
+{
+    bdev_t *dev;
+    int ret;
+
+    /* check slot validity */
+    if ((slot < 0) || (slot > 1))
+        return -EINVAL;
+
+    dev = bio_open("mmc0");
+    if (!dev)
+        return -ENXIO;
+
+    slot += 1; /* emmc driver expects slot parameter is 1 or 2 */
+    ret = bio_ioctl(dev, BIO_IOCTL_MMC_SET_BOOT, &slot);
+    if (ret < 0)
+        ret = -EIO;
+
+    bio_close(dev);
+
+    return ret;
+}
diff --git a/src/bsp/lk/target/auto2712-nand/include/target/cust_usb.h b/src/bsp/lk/target/auto2712-nand/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nand/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2712-nand/include/target/debugconfig.h b/src/bsp/lk/target/auto2712-nand/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nand/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2712-nand/include/target/io_pwr.h b/src/bsp/lk/target/auto2712-nand/include/target/io_pwr.h
new file mode 100644
index 0000000..41e10d6
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nand/include/target/io_pwr.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2712m1v1 io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
diff --git a/src/bsp/lk/target/auto2712-nand/rules.mk b/src/bsp/lk/target/auto2712-nand/rules.mk
new file mode 100644
index 0000000..719905d
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nand/rules.mk
@@ -0,0 +1,22 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt2712
+DRAM_TYPE := LPDDR4
+
+SRC_CLOCK := 26000000
+
+GLOBAL_CFLAGS +=  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/nand \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2712-nand/target.c b/src/bsp/lk/target/auto2712-nand/target.c
new file mode 100644
index 0000000..51bec3f
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nand/target.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand/nand.h>
+
+extern void platform_memory_init(void);
+
+void target_early_init(void)
+{
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/auto2712-nor_emmc/include/target/cust_usb.h b/src/bsp/lk/target/auto2712-nor_emmc/include/target/cust_usb.h
new file mode 100644
index 0000000..ff7e84d
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nor_emmc/include/target/cust_usb.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2712-nor_emmc/include/target/debugconfig.h b/src/bsp/lk/target/auto2712-nor_emmc/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nor_emmc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2712-nor_emmc/include/target/io_pwr.h b/src/bsp/lk/target/auto2712-nor_emmc/include/target/io_pwr.h
new file mode 100644
index 0000000..905dfdd
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nor_emmc/include/target/io_pwr.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2712m1v1 io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
diff --git a/src/bsp/lk/target/auto2712-nor_emmc/rules.mk b/src/bsp/lk/target/auto2712-nor_emmc/rules.mk
new file mode 100644
index 0000000..0ae698f
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nor_emmc/rules.mk
@@ -0,0 +1,22 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt2712
+DRAM_TYPE := LPDDR4
+
+SRC_CLOCK := 26000000
+
+GLOBAL_CFLAGS +=  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2712-nor_emmc/target.c b/src/bsp/lk/target/auto2712-nor_emmc/target.c
new file mode 100644
index 0000000..cd39cd4
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nor_emmc/target.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+#include <platform/mtk_nor.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if LK_AS_BL33
+    card = emmc_init_stage1(&retry_opcond, true);
+#else
+    card = emmc_init_stage1(&retry_opcond, false);
+#endif
+
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    nor_init_device();
+    if (card) {
+#if LK_AS_BL33
+        emmc_init_stage2(card, retry_opcond, true);
+#else
+        emmc_init_stage2(card, retry_opcond, false);
+#endif
+    }
+
+    extern void do_check_mrdump(void) __attribute__((weak));
+    if (do_check_mrdump)
+        do_check_mrdump();
+}
+
diff --git a/src/bsp/lk/target/auto2712-nor_emmc_ab/include/target/cust_usb.h b/src/bsp/lk/target/auto2712-nor_emmc_ab/include/target/cust_usb.h
new file mode 100644
index 0000000..ff7e84d
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nor_emmc_ab/include/target/cust_usb.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2712-nor_emmc_ab/include/target/debugconfig.h b/src/bsp/lk/target/auto2712-nor_emmc_ab/include/target/debugconfig.h
new file mode 100644
index 0000000..e24dd65
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nor_emmc_ab/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2712-nor_emmc_ab/include/target/io_pwr.h b/src/bsp/lk/target/auto2712-nor_emmc_ab/include/target/io_pwr.h
new file mode 100644
index 0000000..905dfdd
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nor_emmc_ab/include/target/io_pwr.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2712m1v1 io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
diff --git a/src/bsp/lk/target/auto2712-nor_emmc_ab/rules.mk b/src/bsp/lk/target/auto2712-nor_emmc_ab/rules.mk
new file mode 100644
index 0000000..0ae698f
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nor_emmc_ab/rules.mk
@@ -0,0 +1,22 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt2712
+DRAM_TYPE := LPDDR4
+
+SRC_CLOCK := 26000000
+
+GLOBAL_CFLAGS +=  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2712-nor_emmc_ab/target.c b/src/bsp/lk/target/auto2712-nor_emmc_ab/target.c
new file mode 100644
index 0000000..cd39cd4
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-nor_emmc_ab/target.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+#include <platform/mtk_nor.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if LK_AS_BL33
+    card = emmc_init_stage1(&retry_opcond, true);
+#else
+    card = emmc_init_stage1(&retry_opcond, false);
+#endif
+
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    nor_init_device();
+    if (card) {
+#if LK_AS_BL33
+        emmc_init_stage2(card, retry_opcond, true);
+#else
+        emmc_init_stage2(card, retry_opcond, false);
+#endif
+    }
+
+    extern void do_check_mrdump(void) __attribute__((weak));
+    if (do_check_mrdump)
+        do_check_mrdump();
+}
+
diff --git a/src/bsp/lk/target/auto2712-sdboot/include/target/cust_usb.h b/src/bsp/lk/target/auto2712-sdboot/include/target/cust_usb.h
new file mode 100644
index 0000000..2a57e6e
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-sdboot/include/target/cust_usb.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2712-sdboot/include/target/debugconfig.h b/src/bsp/lk/target/auto2712-sdboot/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-sdboot/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2712-sdboot/include/target/io_pwr.h b/src/bsp/lk/target/auto2712-sdboot/include/target/io_pwr.h
new file mode 100644
index 0000000..a68a43c
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-sdboot/include/target/io_pwr.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2712m1v1 io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
diff --git a/src/bsp/lk/target/auto2712-sdboot/rules.mk b/src/bsp/lk/target/auto2712-sdboot/rules.mk
new file mode 100644
index 0000000..0ae698f
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-sdboot/rules.mk
@@ -0,0 +1,22 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt2712
+DRAM_TYPE := LPDDR4
+
+SRC_CLOCK := 26000000
+
+GLOBAL_CFLAGS +=  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2712-sdboot/target.c b/src/bsp/lk/target/auto2712-sdboot/target.c
new file mode 100644
index 0000000..ed6c6e6
--- /dev/null
+++ b/src/bsp/lk/target/auto2712-sdboot/target.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+void target_early_init(void)
+{
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    sdmmc_init(1, false);
+}
+
diff --git a/src/bsp/lk/target/auto2712fpga-ivi/include/target/cust_usb.h b/src/bsp/lk/target/auto2712fpga-ivi/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2712fpga-ivi/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2712fpga-ivi/include/target/debugconfig.h b/src/bsp/lk/target/auto2712fpga-ivi/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2712fpga-ivi/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2712fpga-ivi/include/target/io_pwr.h b/src/bsp/lk/target/auto2712fpga-ivi/include/target/io_pwr.h
new file mode 100644
index 0000000..52032e8
--- /dev/null
+++ b/src/bsp/lk/target/auto2712fpga-ivi/include/target/io_pwr.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2712fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
diff --git a/src/bsp/lk/target/auto2712fpga-ivi/rules.mk b/src/bsp/lk/target/auto2712fpga-ivi/rules.mk
new file mode 100644
index 0000000..c34258b
--- /dev/null
+++ b/src/bsp/lk/target/auto2712fpga-ivi/rules.mk
@@ -0,0 +1,33 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt2712
+DRAM_TYPE := LPDDR4
+
+SRC_CLOCK := 10000000
+
+TZ_PART_NAME := TEE1
+RECOVERY_TZ_PART_NAME = TEE1
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := BOOTIMG
+RECOVERY_BOOT_PART_NAME = RECOVERY
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2712fpga-ivi/target.c b/src/bsp/lk/target/auto2712fpga-ivi/target.c
new file mode 100644
index 0000000..806ea5e
--- /dev/null
+++ b/src/bsp/lk/target/auto2712fpga-ivi/target.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if LK_AS_BL33
+    card = emmc_init_stage1(&retry_opcond, true);
+#else
+    card = emmc_init_stage1(&retry_opcond, false);
+#endif
+
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    if (card) {
+#if LK_AS_BL33
+        emmc_init_stage2(card, retry_opcond, true);
+#else
+        emmc_init_stage2(card, retry_opcond, false);
+#endif
+    }
+}
+
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-emmc/include/target/cust_usb.h b/src/bsp/lk/target/auto2712m1v1-ivi-emmc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-emmc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-emmc/include/target/debugconfig.h b/src/bsp/lk/target/auto2712m1v1-ivi-emmc/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-emmc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-emmc/include/target/io_pwr.h b/src/bsp/lk/target/auto2712m1v1-ivi-emmc/include/target/io_pwr.h
new file mode 100644
index 0000000..41e10d6
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-emmc/include/target/io_pwr.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2712m1v1 io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-emmc/rules.mk b/src/bsp/lk/target/auto2712m1v1-ivi-emmc/rules.mk
new file mode 100644
index 0000000..9c231aa
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-emmc/rules.mk
@@ -0,0 +1,44 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt2712
+DRAM_TYPE := LPDDR4
+
+SRC_CLOCK := 26000000
+
+ifeq ($(strip $(AB_OTA_UPDATER)),yes)
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_a
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := bootimg
+ROOTFS_PART_NAME := rootfs
+RECOVERY_BOOT_PART_NAME = RECOVERY
+else
+TZ_PART_NAME := TEE1
+RECOVERY_TZ_PART_NAME = TEE1
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := BOOTIMG
+ROOTFS_PART_NAME := ROOTFS
+RECOVERY_BOOT_PART_NAME = RECOVERY
+endif
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-emmc/target.c b/src/bsp/lk/target/auto2712m1v1-ivi-emmc/target.c
new file mode 100644
index 0000000..806ea5e
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-emmc/target.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if LK_AS_BL33
+    card = emmc_init_stage1(&retry_opcond, true);
+#else
+    card = emmc_init_stage1(&retry_opcond, false);
+#endif
+
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    if (card) {
+#if LK_AS_BL33
+        emmc_init_stage2(card, retry_opcond, true);
+#else
+        emmc_init_stage2(card, retry_opcond, false);
+#endif
+    }
+}
+
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-nand/include/target/cust_usb.h b/src/bsp/lk/target/auto2712m1v1-ivi-nand/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-nand/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-nand/include/target/debugconfig.h b/src/bsp/lk/target/auto2712m1v1-ivi-nand/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-nand/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-nand/include/target/io_pwr.h b/src/bsp/lk/target/auto2712m1v1-ivi-nand/include/target/io_pwr.h
new file mode 100644
index 0000000..41e10d6
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-nand/include/target/io_pwr.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2712m1v1 io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-nand/rules.mk b/src/bsp/lk/target/auto2712m1v1-ivi-nand/rules.mk
new file mode 100644
index 0000000..d4b6c28
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-nand/rules.mk
@@ -0,0 +1,33 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt2712
+DRAM_TYPE := LPDDR4
+
+SRC_CLOCK := 26000000
+
+TZ_PART_NAME := TEE1
+RECOVERY_TZ_PART_NAME = TEE1
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := BOOTIMG
+RECOVERY_BOOT_PART_NAME = RECOVERY
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/nand \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-nand/target.c b/src/bsp/lk/target/auto2712m1v1-ivi-nand/target.c
new file mode 100644
index 0000000..51bec3f
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-nand/target.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand/nand.h>
+
+extern void platform_memory_init(void);
+
+void target_early_init(void)
+{
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/include/target/cust_usb.h b/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/include/target/cust_usb.h
new file mode 100644
index 0000000..2a57e6e
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/include/target/cust_usb.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/include/target/debugconfig.h b/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/include/target/debugconfig.h
new file mode 100644
index 0000000..9513af6
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/include/target/io_pwr.h b/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/include/target/io_pwr.h
new file mode 100644
index 0000000..a68a43c
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/include/target/io_pwr.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2712m1v1 io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/rules.mk b/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/rules.mk
new file mode 100644
index 0000000..9251806
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/rules.mk
@@ -0,0 +1,37 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt2712
+DRAM_TYPE := LPDDR4
+
+SRC_CLOCK := 26000000
+
+TZ_PART_NAME := TEE1
+RECOVERY_TZ_PART_NAME = TEE1
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := BOOTIMG
+ROOTFS_PART_NAME := ROOTFS
+RECOVERY_BOOT_PART_NAME = RECOVERY
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+MODULE_EXTRA_OBJS += $(LOCAL_DIR)/../../../lk_ext_mod/platform/mt2712/drivers/efuse/arm64/VM/libefuse.o
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/target.c b/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/target.c
new file mode 100644
index 0000000..ed6c6e6
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi-sdboot/target.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+void target_early_init(void)
+{
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    sdmmc_init(1, false);
+}
+
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi/include/target/cust_usb.h b/src/bsp/lk/target/auto2712m1v1-ivi/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi/include/target/debugconfig.h b/src/bsp/lk/target/auto2712m1v1-ivi/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi/include/target/io_pwr.h b/src/bsp/lk/target/auto2712m1v1-ivi/include/target/io_pwr.h
new file mode 100644
index 0000000..41e10d6
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi/include/target/io_pwr.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2712m1v1 io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi/rules.mk b/src/bsp/lk/target/auto2712m1v1-ivi/rules.mk
new file mode 100644
index 0000000..8d67ce5
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi/rules.mk
@@ -0,0 +1,47 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c \
+    $(LOCAL_DIR)/vefuse.c
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt2712
+DRAM_TYPE := LPDDR4
+
+SRC_CLOCK := 10000000
+
+ifeq ($(strip $(AB_OTA_UPDATER)),yes)
+TZ_PART_NAME := TEE1
+RECOVERY_TZ_PART_NAME = TEE1
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := bootimg
+ROOTFS_PART_NAME := rootfs
+RECOVERY_BOOT_PART_NAME = RECOVERY
+else
+TZ_PART_NAME := TEE1
+RECOVERY_TZ_PART_NAME = TEE1
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := BOOTIMG
+ROOTFS_PART_NAME := ROOTFS
+RECOVERY_BOOT_PART_NAME = RECOVERY
+endif
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/$(MTK_PLATFORM)/drivers/mmc \
+
+MODULE_EXTRA_OBJS += $(LOCAL_DIR)/../../../lk_ext_mod/platform/mt2712/drivers/efuse/arm64/VM/libefuse.o
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi/target.c b/src/bsp/lk/target/auto2712m1v1-ivi/target.c
new file mode 100644
index 0000000..bbf786e
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi/target.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+#include <platform/mtk_nor.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+#if LK_AS_BL33
+    card = emmc_init_stage1(&retry_opcond, true);
+#else
+    card = emmc_init_stage1(&retry_opcond, false);
+#endif
+
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    nor_init_device();
+    if (card) {
+#if LK_AS_BL33
+        emmc_init_stage2(card, retry_opcond, true);
+#else
+        emmc_init_stage2(card, retry_opcond, false);
+#endif
+    }
+}
+
diff --git a/src/bsp/lk/target/auto2712m1v1-ivi/vefuse.c b/src/bsp/lk/target/auto2712m1v1-ivi/vefuse.c
new file mode 100644
index 0000000..8876765
--- /dev/null
+++ b/src/bsp/lk/target/auto2712m1v1-ivi/vefuse.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+#include <debug.h>
+#include <platform/mt_reg_base.h>
+#include <reg.h>
+
+#define GPIO127_DIR_SET    (GPIO_BASE + 0x074)
+#define GPIO127_DOUT_SET    (GPIO_BASE + 0x374)
+#define GPIO127_DOUT_RST    (GPIO_BASE + 0x378)
+
+void enable_vefuse(void)
+{
+    /* set to output control and output register is 1 */
+    writel((1U << 15), GPIO127_DIR_SET);
+    writel((1U << 15), GPIO127_DOUT_SET);
+    spin(10000);
+}
+
+void disable_vefuse(void)
+{
+    /* set to output control and output register is 0 */
+    writel((1U << 15), GPIO127_DIR_SET);
+    writel((1U << 15), GPIO127_DOUT_RST);
+    spin(10000);
+}
diff --git a/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/include/target/cust_usb.h b/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/include/target/debugconfig.h b/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/include/target/io_pwr.h b/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/rules.mk b/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/rules.mk
new file mode 100644
index 0000000..9bbd012
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/rules.mk
@@ -0,0 +1,21 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt2731
+PMIC := $(MTK_PMIC_CHIP_TYPE)
+ifeq ($(findstring PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES += PMIC_CHIP_$(shell echo $(PMIC) | tr '[a-z]' '[A-Z]')
+endif
+
+LOW_POWER_VERSION := lpddr4
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/target.c b/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/target.c
new file mode 100644
index 0000000..f6e1d02
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-emmc-lp4/target.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-emmc/include/target/cust_usb.h b/src/bsp/lk/target/auto2731evb-ivt-emmc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-emmc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2731evb-ivt-emmc/include/target/debugconfig.h b/src/bsp/lk/target/auto2731evb-ivt-emmc/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-emmc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-emmc/include/target/io_pwr.h b/src/bsp/lk/target/auto2731evb-ivt-emmc/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-emmc/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-emmc/rules.mk b/src/bsp/lk/target/auto2731evb-ivt-emmc/rules.mk
new file mode 100644
index 0000000..ab0a161
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-emmc/rules.mk
@@ -0,0 +1,19 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt2731
+PMIC := $(MTK_PMIC_CHIP_TYPE)
+ifeq ($(findstring PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES += PMIC_CHIP_$(shell echo $(PMIC) | tr '[a-z]' '[A-Z]')
+endif
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2731evb-ivt-emmc/target.c b/src/bsp/lk/target/auto2731evb-ivt-emmc/target.c
new file mode 100644
index 0000000..f6e1d02
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-emmc/target.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/include/target/cust_usb.h b/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/include/target/debugconfig.h b/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/include/target/io_pwr.h b/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/rules.mk b/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/rules.mk
new file mode 100644
index 0000000..e9db329
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/rules.mk
@@ -0,0 +1,22 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt2731
+PMIC := $(MTK_PMIC_CHIP_TYPE)
+ifeq ($(findstring PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES += PMIC_CHIP_$(shell echo $(PMIC) | tr '[a-z]' '[A-Z]')
+endif
+GLOBAL_DEFINES += BOOT_DEV_NAND
+
+LOW_POWER_VERSION := lpddr4
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/nand \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/target.c b/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/target.c
new file mode 100644
index 0000000..cb05b59
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand-lp4/target.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand/nand.h>
+
+extern void platform_memory_init(void);
+
+void target_early_init(void)
+{
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand/include/target/cust_usb.h b/src/bsp/lk/target/auto2731evb-ivt-nand/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand/include/target/debugconfig.h b/src/bsp/lk/target/auto2731evb-ivt-nand/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand/include/target/io_pwr.h b/src/bsp/lk/target/auto2731evb-ivt-nand/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand/rules.mk b/src/bsp/lk/target/auto2731evb-ivt-nand/rules.mk
new file mode 100644
index 0000000..320f233
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand/rules.mk
@@ -0,0 +1,20 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt2731
+PMIC := $(MTK_PMIC_CHIP_TYPE)
+ifeq ($(findstring PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES += PMIC_CHIP_$(shell echo $(PMIC) | tr '[a-z]' '[A-Z]')
+endif
+GLOBAL_DEFINES += BOOT_DEV_NAND
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/nand \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand/target.c b/src/bsp/lk/target/auto2731evb-ivt-nand/target.c
new file mode 100644
index 0000000..cb05b59
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand/target.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand/nand.h>
+
+extern void platform_memory_init(void);
+
+void target_early_init(void)
+{
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/include/target/cust_usb.h b/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/include/target/debugconfig.h b/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/include/target/io_pwr.h b/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/rules.mk b/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/rules.mk
new file mode 100644
index 0000000..320f233
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/rules.mk
@@ -0,0 +1,20 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt2731
+PMIC := $(MTK_PMIC_CHIP_TYPE)
+ifeq ($(findstring PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES += PMIC_CHIP_$(shell echo $(PMIC) | tr '[a-z]' '[A-Z]')
+endif
+GLOBAL_DEFINES += BOOT_DEV_NAND
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/nand \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/target.c b/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/target.c
new file mode 100644
index 0000000..cb05b59
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand_bl33/target.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand/nand.h>
+
+extern void platform_memory_init(void);
+
+void target_early_init(void)
+{
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/include/target/cust_usb.h b/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/include/target/debugconfig.h b/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/include/target/io_pwr.h b/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/include/target/io_pwr.h
new file mode 100644
index 0000000..22beef1
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/include/target/io_pwr.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Use of this source code is governed by a MIT-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/MIT
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2731fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/rules.mk b/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/rules.mk
new file mode 100644
index 0000000..fa4c7ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/rules.mk
@@ -0,0 +1,20 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt2731
+PMIC := $(MTK_PMIC_CHIP_TYPE)
+ifeq ($(findstring PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES += PMIC_CHIP_$(shell echo $(PMIC) | tr '[a-z]' '[A-Z]')
+endif
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/nand \
+    platform/$(PLATFORM)/drivers/mmc
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/target.c b/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/target.c
new file mode 100644
index 0000000..1dc5e10
--- /dev/null
+++ b/src/bsp/lk/target/auto2731evb-ivt-nand_emmc/target.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+#include <platform/nand/nand.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    nand_init_device();
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+
+    extern void do_check_mrdump(void) __attribute__((weak));
+    if (do_check_mrdump) {
+        do_check_mrdump();
+    }
+}
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/include/target/cust_usb.h b/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/include/target/debugconfig.h b/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/include/target/io_pwr.h b/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/include/target/io_pwr.h
new file mode 100644
index 0000000..d40045d
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/include/target/io_pwr.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2735fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/rules.mk b/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/rules.mk
new file mode 100644
index 0000000..e46f854
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/rules.mk
@@ -0,0 +1,25 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt2735
+PMIC := $(MTK_PMIC_CHIP_TYPE)
+ifeq ($(findstring PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES += PMIC_CHIP_$(shell echo $(PMIC) | tr '[a-z]' '[A-Z]')
+endif
+SUB_PMIC := $(MTK_SUB_PMIC_CHIP_TYPE)
+ifeq ($(findstring SUB_PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES +=EXT_BUCK_MT6315
+endif
+
+LOW_POWER_VERSION := lpddr4
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/target.c b/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/target.c
new file mode 100644
index 0000000..f6e1d02
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-emmc-lp4/target.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-emmc/include/target/cust_usb.h b/src/bsp/lk/target/auto2735evb-ivt-emmc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-emmc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2735evb-ivt-emmc/include/target/debugconfig.h b/src/bsp/lk/target/auto2735evb-ivt-emmc/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-emmc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-emmc/include/target/io_pwr.h b/src/bsp/lk/target/auto2735evb-ivt-emmc/include/target/io_pwr.h
new file mode 100644
index 0000000..d40045d
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-emmc/include/target/io_pwr.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2735fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-emmc/rules.mk b/src/bsp/lk/target/auto2735evb-ivt-emmc/rules.mk
new file mode 100644
index 0000000..9e59489
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-emmc/rules.mk
@@ -0,0 +1,23 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt2735
+PMIC := $(MTK_PMIC_CHIP_TYPE)
+ifeq ($(findstring PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES += PMIC_CHIP_$(shell echo $(PMIC) | tr '[a-z]' '[A-Z]')
+endif
+SUB_PMIC := $(MTK_SUB_PMIC_CHIP_TYPE)
+ifeq ($(findstring SUB_PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES +=EXT_BUCK_MT6315
+endif
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/mmc \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2735evb-ivt-emmc/target.c b/src/bsp/lk/target/auto2735evb-ivt-emmc/target.c
new file mode 100644
index 0000000..f6e1d02
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-emmc/target.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/include/target/cust_usb.h b/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/include/target/debugconfig.h b/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/include/target/io_pwr.h b/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/include/target/io_pwr.h
new file mode 100644
index 0000000..d40045d
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/include/target/io_pwr.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2735fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/rules.mk b/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/rules.mk
new file mode 100644
index 0000000..9fbc0da
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/rules.mk
@@ -0,0 +1,26 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt2735
+PMIC := $(MTK_PMIC_CHIP_TYPE)
+ifeq ($(findstring PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES += PMIC_CHIP_$(shell echo $(PMIC) | tr '[a-z]' '[A-Z]')
+endif
+SUB_PMIC := $(MTK_SUB_PMIC_CHIP_TYPE)
+ifeq ($(findstring SUB_PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES +=EXT_BUCK_MT6315
+endif
+GLOBAL_DEFINES += BOOT_DEV_NAND
+
+LOW_POWER_VERSION := lpddr4
+
+SLC_NAND_PROJECT := y
+SPI_NAND_PROJECT := n
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/target.c b/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/target.c
new file mode 100644
index 0000000..cb05b59
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand-lp4/target.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand/nand.h>
+
+extern void platform_memory_init(void);
+
+void target_early_init(void)
+{
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand/include/target/cust_usb.h b/src/bsp/lk/target/auto2735evb-ivt-nand/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand/include/target/debugconfig.h b/src/bsp/lk/target/auto2735evb-ivt-nand/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand/include/target/io_pwr.h b/src/bsp/lk/target/auto2735evb-ivt-nand/include/target/io_pwr.h
new file mode 100644
index 0000000..d40045d
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand/include/target/io_pwr.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2735fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand/rules.mk b/src/bsp/lk/target/auto2735evb-ivt-nand/rules.mk
new file mode 100644
index 0000000..f1a39d4
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand/rules.mk
@@ -0,0 +1,24 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt2735
+PMIC := $(MTK_PMIC_CHIP_TYPE)
+ifeq ($(findstring PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES += PMIC_CHIP_$(shell echo $(PMIC) | tr '[a-z]' '[A-Z]')
+endif
+SUB_PMIC := $(MTK_SUB_PMIC_CHIP_TYPE)
+ifeq ($(findstring SUB_PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES +=EXT_BUCK_MT6315
+endif
+GLOBAL_DEFINES += BOOT_DEV_NAND
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/nand \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand/target.c b/src/bsp/lk/target/auto2735evb-ivt-nand/target.c
new file mode 100644
index 0000000..cb05b59
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand/target.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand/nand.h>
+
+extern void platform_memory_init(void);
+
+void target_early_init(void)
+{
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/include/target/cust_usb.h b/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/include/target/debugconfig.h b/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/include/target/io_pwr.h b/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/include/target/io_pwr.h
new file mode 100644
index 0000000..d40045d
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/include/target/io_pwr.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2735fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/rules.mk b/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/rules.mk
new file mode 100644
index 0000000..c83162a
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/rules.mk
@@ -0,0 +1,24 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt2735
+PMIC := $(MTK_PMIC_CHIP_TYPE)
+ifeq ($(findstring PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES += PMIC_CHIP_$(shell echo $(PMIC) | tr '[a-z]' '[A-Z]')
+endif
+SUB_PMIC := $(MTK_SUB_PMIC_CHIP_TYPE)
+ifeq ($(findstring SUB_PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES +=EXT_BUCK_MT6315
+endif
+GLOBAL_DEFINES += BOOT_DEV_NAND
+
+SLC_NAND_PROJECT := y
+SPI_NAND_PROJECT := n
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/target.c b/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/target.c
new file mode 100644
index 0000000..cb05b59
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand_bl33/target.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand/nand.h>
+
+extern void platform_memory_init(void);
+
+void target_early_init(void)
+{
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    nand_init_device();
+}
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/include/target/cust_usb.h b/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/include/target/debugconfig.h b/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/include/target/io_pwr.h b/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/include/target/io_pwr.h
new file mode 100644
index 0000000..d40045d
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/include/target/io_pwr.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef IO_PWR_H
+#define IO_PWR_H
+
+/*
+ * auto2735fpga io power domain
+ * define 1: 3.3v
+ * define 0: 1.8v
+ */
+
+#define VCC3IO_GPIO    1
+#define VCC3IO_GBE     1
+#define VCC3IO_NOR     1
+#define VCC3IO_MSDC1   1
+#define VCC3IO_MSDC2   1
+#define VCC3IO_UART4B  1
+#define VCC3IO_SPICTP  0
+#define VCC3IO_SPIMCU  1
+#define VCC3IO_I2S102  1
+#define VCC3IO_I2SIO1  1
+#define VCC3IO_I2SO02  1
+#define VCC3IO_TDMO    1
+
+#endif
+
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/rules.mk b/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/rules.mk
new file mode 100644
index 0000000..0903922
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/rules.mk
@@ -0,0 +1,24 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt2735
+PMIC := $(MTK_PMIC_CHIP_TYPE)
+ifeq ($(findstring PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES += PMIC_CHIP_$(shell echo $(PMIC) | tr '[a-z]' '[A-Z]')
+endif
+SUB_PMIC := $(MTK_SUB_PMIC_CHIP_TYPE)
+ifeq ($(findstring SUB_PMIC, $(strip $(DEFINES))),)
+GLOBAL_DEFINES +=EXT_BUCK_MT6315
+endif
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/nand \
+    platform/$(PLATFORM)/drivers/mmc
+
+include make/module.mk
diff --git a/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/target.c b/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/target.c
new file mode 100644
index 0000000..1dc5e10
--- /dev/null
+++ b/src/bsp/lk/target/auto2735evb-ivt-nand_emmc/target.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2018 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/mmc_core.h>
+#include <platform/nand/nand.h>
+
+extern void platform_memory_init(void);
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    nand_init_device();
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+
+    extern void do_check_mrdump(void) __attribute__((weak));
+    if (do_check_mrdump) {
+        do_check_mrdump();
+    }
+}
+
diff --git a/src/bsp/lk/target/beagle/include/target/debugconfig.h b/src/bsp/lk/target/beagle/include/target/debugconfig.h
new file mode 100644
index 0000000..0928eea
--- /dev/null
+++ b/src/bsp/lk/target/beagle/include/target/debugconfig.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2008 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+#define DEBUG_UART 2
+
+#endif
diff --git a/src/bsp/lk/target/beagle/rules.mk b/src/bsp/lk/target/beagle/rules.mk
new file mode 100644
index 0000000..e89f0f8
--- /dev/null
+++ b/src/bsp/lk/target/beagle/rules.mk
@@ -0,0 +1,15 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+GLOBAL_INCLUDES += \
+	$(LOCAL_DIR)/include
+
+PLATFORM := omap3
+
+MODULES += \
+	dev/pmic/twl4030
+
+MEMSIZE := 0x08000000	# 128MB
+
+GLOBAL_DEFINES += \
+	SDRAM_SIZE=$(MEMSIZE)
+
diff --git a/src/bsp/lk/target/beaglebone/rules.mk b/src/bsp/lk/target/beaglebone/rules.mk
new file mode 100644
index 0000000..ea0ac1f
--- /dev/null
+++ b/src/bsp/lk/target/beaglebone/rules.mk
@@ -0,0 +1,17 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+#MODULE := $(LOCAL_DIR)
+
+GLOBAL_INCLUDES += \
+	$(LOCAL_DIR)/include
+
+PLATFORM := am335x
+
+MODULES += \
+
+MEMSIZE := 0x10000000	# 256MB
+
+GLOBAL_DEFINES += \
+
+#include make/module.mk
+
diff --git a/src/bsp/lk/target/dartuinoP0/display/LS013B7DH06.c b/src/bsp/lk/target/dartuinoP0/display/LS013B7DH06.c
new file mode 100644
index 0000000..2b1f813
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/display/LS013B7DH06.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015 Gurjant Kalsi <me@gurjantkalsi.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// 1.33 Inch 3-Bit RGB Sharp Color LCD
+#include <target/display/LS013B7DH06.h>
+#include <string.h>
+
+#define SET_BIT(BUF, BITNUM) ((BUF)[(BITNUM) >> 3] |= (0xff & (0x1 << ((BITNUM) & 0x07))))
+
+uint8_t lcd_get_line(uint8_t *framebuffer, uint8_t idx, uint8_t *result)
+{
+    framebuffer += MLCD_WIDTH * idx;
+
+    memset(result, 0, MLCD_BYTES_LINE);
+
+    for (int i = 0; i < MLCD_WIDTH; ++i) {
+        uint8_t inpix = framebuffer[i];
+
+        int j = i * 3;
+
+        if (inpix & 0x80) {
+            SET_BIT(result, j);
+        }
+        if (inpix & 0x10) {
+            SET_BIT(result, j + 1);
+        }
+        if (inpix & 0x02) {
+            SET_BIT(result, j + 2);
+        }
+
+    }
+    return MLCD_BYTES_LINE;
+}
\ No newline at end of file
diff --git a/src/bsp/lk/target/dartuinoP0/display/LS027B7DH01.c b/src/bsp/lk/target/dartuinoP0/display/LS027B7DH01.c
new file mode 100644
index 0000000..6e275ca
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/display/LS027B7DH01.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015 Gurjant Kalsi <me@gurjantkalsi.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// 2.7 Inch Monocromatic Sharp Memory LCD
+
+#include <target/display/LS027B7DH01.h>
+#include <string.h>
+
+#define SET_BIT(BUF, BITNUM) ((BUF)[(BITNUM) >> 3] |= (0xff & (0x1 << ((BITNUM) & 0x07))))
+
+uint8_t lcd_get_line(uint8_t *framebuffer, uint8_t idx, uint8_t *result)
+{
+    framebuffer += MLCD_WIDTH * idx;
+
+    memset(result, 0, MLCD_BYTES_LINE);
+
+    for (uint i = 0; i < MLCD_WIDTH; ++i) {
+        if (framebuffer[i] > 128) {
+            SET_BIT(result, i);
+        }
+    }
+
+    return MLCD_BYTES_LINE;
+}
\ No newline at end of file
diff --git a/src/bsp/lk/target/dartuinoP0/include/target/bmi055.h b/src/bsp/lk/target/dartuinoP0/include/target/bmi055.h
new file mode 100644
index 0000000..7fd75ff
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/include/target/bmi055.h
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2015 Eric Holland
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __SENSOR_BMI055_H
+#define __SENSOR_BMI055_H
+
+#include <sys/types.h>
+
+#define BMI055_ADDRESS_READ(x) (x | 0x80)
+#define BMI055_ADDERSS_WRITE(x) (x & 0x7F)
+
+/**
+*       definitions for accelerometer IC
+*/
+#define BMI055_ACC_BGW_CHPID        0x00
+#define BMI055_ACC_ACCD_X_LSB       0X02
+#define BMI055_ACC_ACCD_X_MSB       0X03
+#define BMI055_ACC_ACCD_Y_LSB       0X04
+#define BMI055_ACC_ACCD_Y_MSB       0X05
+#define BMI055_ACC_ACCD_Z_LSB       0X06
+#define BMI055_ACC_ACCD_Z_MSB       0X07
+#define BMI055_ACC_ACCD_TEMP        0X08
+#define BMI055_ACC_INT_STATUS_0     0X09
+#define BMI055_ACC_INT_STATUS_1     0X0a
+#define BMI055_ACC_INT_STATUS_2     0x0b
+#define BMI055_ACC_INT_STATUS_3     0x0c
+#define BMI055_ACC_FIFO_STATUS      0x0e
+#define BMI055_ACC_PMU_RANGE        0x0f
+#define BMI055_ACC_PMU_BW           0x10
+#define BMI055_ACC_PMU_LPW          0x11
+#define BMI055_ACC_PMU_LOW_POWER    0x12
+#define BMI055_ACC_ACCD_HBW         0x13
+#define BMI055_ACC_BGW_SOFTRESET    0x14
+#define BMI055_ACC_INT_EN_0         0x16
+#define BMI055_ACC_INT_EN_1         0x17
+#define BMI055_ACC_INT_EN_2         0x18
+#define BMI055_ACC_INT_MAP_0        0x19
+#define BMI055_ACC_INT_MAP_1        0x1A
+#define BMI055_ACC_INT_MAP_2        0x1B
+#define BMI055_ACC_INT_SRC          0x1E
+#define BMI055_ACC_INT_OUT_CTRL     0x20
+#define BMI055_ACC_INT_RST_LATCH    0x21
+#define BMI055_ACC_INT_0            0x22
+#define BMI055_ACC_INT_1            0x23
+#define BMI055_ACC_INT_2            0x24
+#define BMI055_ACC_INT_3            0x25
+#define BMI055_ACC_INT_4            0x26
+#define BMI055_ACC_INT_5            0x27
+#define BMI055_ACC_INT_6            0x28
+#define BMI055_ACC_INT_7            0x29
+#define BMI055_ACC_INT_8            0x2a
+#define BMI055_ACC_INT_9            0x2b
+#define BMI055_ACC_INT_A            0x2c
+#define BMI055_ACC_INT_B            0x2d
+#define BMI055_ACC_INT_C            0x2e
+#define BMI055_ACC_INT_D            0x2f
+#define BMI055_ACC_FIFO_CONFIG_0    0x30
+#define BMI055_ACC_PMU_SELF_TEST    0x32
+#define BMI055_ACC_TRIM_NVM_CTRL    0x33
+#define BMI055_ACC_BGW_SPI3_WDT     0x34
+#define BMI055_ACC_OFC_CTRL         0x36
+#define BMI055_ACC_OFC_SETTING      0x37
+#define BMI055_ACC_OFC_OFFSET_X     0x38
+#define BMI055_ACC_OFC_OFFSET_Y     0x39
+#define BMI055_ACC_OFC_OFFSET_Z     0x3A
+#define BMI055_ACC_TRIM_GP0         0x3B
+#define BMI055_ACC_TRIM_GP1         0x3C
+#define BMI055_ACC_FIFO_CONFIG_1    0x3E
+#define BMI055_ACC_FIFO_DATA        0x3F
+
+
+/**
+*       definitions for gyro IC
+*/
+#define BMI055_GYRO_CHIP_ID          0x00
+#define BMI055_GYRO_RATE_X_LSB       0X02
+#define BMI055_GYRO_RATE_X_MSB       0X03
+#define BMI055_GYRO_RATE_Y_LSB       0X04
+#define BMI055_GYRO_RATE_Y_MSB       0X05
+#define BMI055_GYRO_RATE_Z_LSB       0X06
+#define BMI055_GYRO_RATE_Z_MSB       0X07
+#define BMI055_GYRO_INT_STATUS_0     0X09
+#define BMI055_GYRO_INT_STATUS_1     0X0a
+#define BMI055_GYRO_INT_STATUS_2     0x0b
+#define BMI055_GYRO_INT_STATUS_3     0x0c
+#define BMI055_GYRO_FIFO_STATUS      0x0e
+#define BMI055_GYRO_RANGE            0x0f
+#define BMI055_GYRO_BW               0x10
+#define BMI055_GYRO_LPM1             0x11
+#define BMI055_GYRO_LPM2             0x12
+#define BMI055_GYRO_RATE_HBW         0x13
+#define BMI055_GYRO_BGW_SOFTRESET    0x14
+#define BMI055_GYRO_INT_EN_0         0x15
+#define BMI055_GYRO_INT_EN_1         0x16
+#define BMI055_GYRO_INT_MAP_0        0x17
+#define BMI055_GYRO_INT_MAP_1        0x18
+#define BMI055_GYRO_INT_MAP_2        0x19
+#define BMI055_GYRO_0X1A             0x1A
+#define BMI055_GYRO_0X1B             0x1B
+#define BMI055_GYRO_0X1C             0x1C
+#define BMI055_GYRO_0X1E             0x1E
+#define BMI055_GYRO_INT_RST_LATCH    0x21
+#define BMI055_GYRO_HIGH_TH_X        0x22
+#define BMI055_GYRO_HIGH_DUR_X       0x23
+#define BMI055_GYRO_HIGH_TH_Y        0x24
+#define BMI055_GYRO_HIGH_DUR_Y       0x25
+#define BMI055_GYRO_HIGH_TH_Z        0x26
+#define BMI055_GYRO_HIGH_DUR_Z       0x27
+#define BMI055_GYRO_SOC              0x31
+#define BMI055_GYRO_A_FOC            0x32
+#define BMI055_GYRO_TRIM_NVM_CTRL    0x33
+#define BMI055_GYRO_BGW_SPI3_WDT     0x34
+#define BMI055_GYRO_OFC1             0x36
+#define BMI055_GYRO_OFC2             0x37
+#define BMI055_GYRO_OFC3             0x38
+#define BMI055_GYRO_OFC4             0x39
+#define BMI055_GYRO_TRIM_GP0         0x3A
+#define BMI055_GYRO_TRIM_GP1         0x3B
+#define BMI055_GYRO_BIST             0x3C
+#define BMI055_GYRO_FIFO_CONFIG_0    0x3D
+#define BMI055_GYRO_FIFO_CONFIG_1    0x3E
+
+
+
+
+
+
+
+
+#endif
+
diff --git a/src/bsp/lk/target/dartuinoP0/include/target/debugconfig.h b/src/bsp/lk/target/dartuinoP0/include/target/debugconfig.h
new file mode 100644
index 0000000..02f6ba9
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/include/target/debugconfig.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+#define DEBUG_UART 3 
+
+#endif
diff --git a/src/bsp/lk/target/dartuinoP0/include/target/display/LS013B7DH06.h b/src/bsp/lk/target/dartuinoP0/include/target/display/LS013B7DH06.h
new file mode 100644
index 0000000..10249b2
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/include/target/display/LS013B7DH06.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015 Gurjant Kalsi <me@gurjantkalsi.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// 1.33 Inch 3-Bit RGB Sharp Color LCD
+
+#pragma once
+
+#include <lib/gfx.h>
+
+#define MLCD_WIDTH  ((uint16_t)128)
+#define MLCD_HEIGHT ((uint16_t)128)
+#define MLCD_GFX_FORMAT (GFX_FORMAT_RGB_332)
+
+// 3 bits per pixel (1 for each of RBG) divided by 8 bits per byte.
+#define MLCD_BYTES_LINE  ((MLCD_WIDTH * 3) / 8)
+
+uint8_t lcd_get_line(uint8_t *framebuffer, uint8_t idx, uint8_t *result);
diff --git a/src/bsp/lk/target/dartuinoP0/include/target/display/LS027B7DH01.h b/src/bsp/lk/target/dartuinoP0/include/target/display/LS027B7DH01.h
new file mode 100644
index 0000000..bde64f6
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/include/target/display/LS027B7DH01.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015 Gurjant Kalsi <me@gurjantkalsi.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+// 2.7 Inch Monocromatic Sharp Memory LCD
+
+#pragma once
+
+#include <lib/gfx.h>
+
+#define MLCD_WIDTH  ((uint16_t)400)
+#define MLCD_HEIGHT ((uint16_t)240)
+#define MLCD_GFX_FORMAT (GFX_FORMAT_MONO)
+
+// 1 bit per pixel divided by 8 bits per byte
+#define MLCD_BYTES_LINE  (MLCD_WIDTH / 8)
+
+uint8_t lcd_get_line(uint8_t *framebuffer, uint8_t idx, uint8_t *result);
diff --git a/src/bsp/lk/target/dartuinoP0/include/target/fsconfig.h b/src/bsp/lk/target/dartuinoP0/include/target/fsconfig.h
new file mode 100644
index 0000000..fda5ed6
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/include/target/fsconfig.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015 Gurjant Kalsi <me@gurjantkalsi.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ #pragma once
+
+ #define SPIFS_MOUNT_POINT   "/spifs"
+ #define SPIFS_NAME 		 "spifs"
+ #define SPIFS_TARGET_DEVICE "qspi-flash"
\ No newline at end of file
diff --git a/src/bsp/lk/target/dartuinoP0/include/target/gpioconfig.h b/src/bsp/lk/target/dartuinoP0/include/target/gpioconfig.h
new file mode 100644
index 0000000..0a1a5cf
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/include/target/gpioconfig.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_GPIOCONFIG_H
+#define __TARGET_GPIOCONFIG_H
+
+#include <platform/gpio.h>
+#include <platform/stm32.h>
+
+#define GPIO_LED_ON GPIO_PIN_RESET
+#define GPIO_LED_OFF GPIO_PIN_SET
+
+#define GPIO_USART3_TX GPIO(GPIO_PORT_B, 10)
+#define GPIO_USART3_RX GPIO(GPIO_PORT_B, 11)
+
+#define GPIO_LED108 GPIO(GPIO_PORT_E, 3)
+#define GPIO_LED109 GPIO(GPIO_PORT_E, 4)
+#define GPIO_LED110 GPIO(GPIO_PORT_E, 5)
+#define GPIO_LED111 GPIO(GPIO_PORT_E, 6)
+
+#define GPIO_LED112 GPIO(GPIO_PORT_D, 6)
+#define GPIO_LED113 GPIO(GPIO_PORT_D, 7)
+#define GPIO_LED114 GPIO(GPIO_PORT_J, 10)
+#define GPIO_LED115 GPIO(GPIO_PORT_J, 11)
+
+#define GPIO_SHIELD_D0 GPIO(GPIO_PORT_B, 11)
+#define GPIO_SHIELD_D1 GPIO(GPIO_PORT_B, 10)
+#define GPIO_SHIELD_D2 GPIO(GPIO_PORT_E, 3)
+#define GPIO_SHIELD_D3 GPIO(GPIO_PORT_E, 4)
+#define GPIO_SHIELD_D4 GPIO(GPIO_PORT_E, 5)
+#define GPIO_SHIELD_D5 GPIO(GPIO_PORT_E, 6)
+#define GPIO_SHIELD_D6 GPIO(GPIO_PORT_D, 6)
+#define GPIO_SHIELD_D7 GPIO(GPIO_PORT_D, 7)
+#define GPIO_SHIELD_D8 GPIO(GPIO_PORT_J, 10)
+#define GPIO_SHIELD_D9 GPIO(GPIO_PORT_J, 11)
+#define GPIO_SHIELD_D10 GPIO(GPIO_PORT_J, 12)
+#define GPIO_SHIELD_D11 GPIO(GPIO_PORT_J, 13)
+#define GPIO_SHIELD_D12 GPIO(GPIO_PORT_J, 14)
+#define GPIO_SHIELD_D13 GPIO(GPIO_PORT_J, 15)
+
+#define GPIO_SHIELD_ADC0 GPIO(GPIO_PORT_F, 6)
+#define GPIO_SHIELD_ADC1 GPIO(GPIO_PORT_F, 10)
+#define GPIO_SHIELD_ADC2 GPIO(GPIO_PORT_A, 3)
+#define GPIO_SHIELD_ADC3 GPIO(GPIO_PORT_A, 5)
+#define GPIO_SHIELD_ADC4 GPIO(GPIO_PORT_A, 6)
+#define GPIO_SHIELD_ADC5 GPIO(GPIO_PORT_B, 0)
+
+#define GPIO_SW100 GPIO(GPIO_PORT_J, 12)
+#define GPIO_SW101 GPIO(GPIO_PORT_J, 13)
+#define GPIO_SW102 GPIO(GPIO_PORT_J, 14)
+#define GPIO_SW103 GPIO(GPIO_PORT_J, 15)
+
+/**
+ *  Definitions for sensor bus signals. Includes
+ *   nrf51, accelerometer, and gyroscope
+ */
+
+#define __HAL_SENSOR_BUS_GPIO_CLK_ENABLE() \
+            __HAL_RCC_GPIOK_CLK_ENABLE(); \
+            __HAL_RCC_GPIOF_CLK_ENABLE()
+
+#define GPIO_NRF_CS         GPIO(GPIO_PORT_K, 0)
+#define GPIO_NRF_INT        GPIO(GPIO_PORT_K, 1)
+#define GPIO_GYRO_nCS       GPIO(GPIO_PORT_K, 4)
+#define GPIO_GYRO_INT       GPIO(GPIO_PORT_K, 5)
+#define GPIO_ACC_nCS        GPIO(GPIO_PORT_K, 2)
+#define GPIO_ACC_INT        GPIO(GPIO_PORT_K, 3)
+#define GPIO_SPI5_SCK       GPIO(GPIO_PORT_F, 7)
+#define GPIO_SPI5_MISO      GPIO(GPIO_PORT_F, 8)
+#define GPIO_SPI5_MOSI      GPIO(GPIO_PORT_F, 9)
+
+
+
+#endif
diff --git a/src/bsp/lk/target/dartuinoP0/include/target/memory_lcd.h b/src/bsp/lk/target/dartuinoP0/include/target/memory_lcd.h
new file mode 100644
index 0000000..410079c
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/include/target/memory_lcd.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2015 Gurjant Kalsi <me@gurjantkalsi.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __TARGET_DARTUINOP0_MEMORY_LCD_H_
+#define __TARGET_DARTUINOP0_MEMORY_LCD_H_
+
+#include <stm32f7xx.h>
+
+// Initialize the QSPI Flash device.
+status_t memory_lcd_init(void);
+
+#endif  // __TARGET_DARTUINOP0_MEMORY_LCD_H_
diff --git a/src/bsp/lk/target/dartuinoP0/include/target/sensor_bus.h b/src/bsp/lk/target/dartuinoP0/include/target/sensor_bus.h
new file mode 100644
index 0000000..97b0a4c
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/include/target/sensor_bus.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2015 Eric Holland
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __SENSOR_BUS_H
+#define __SENSOR_BUS_H
+
+#include <sys/types.h>
+#include <dev/accelerometer.h>
+
+status_t sensor_bus_init_early(void);
+
+void sensor_bus_init(void);
+
+status_t acc_read(uint8_t address, uint8_t *data);
+
+status_t acc_flush(uint8_t * tbuff, uint8_t * rbuff, uint8_t numbytes);
+
+
+#endif
diff --git a/src/bsp/lk/target/dartuinoP0/init.c b/src/bsp/lk/target/dartuinoP0/init.c
new file mode 100644
index 0000000..0d3d08d
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/init.c
@@ -0,0 +1,486 @@
+/*
+ * Copyright (c) 2015 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <stdlib.h>
+#include <debug.h>
+#include <trace.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/gpio.h>
+#include <dev/usb.h>
+#include <dev/accelerometer.h>
+#include <platform/stm32.h>
+#include <platform/sdram.h>
+#include <platform/gpio.h>
+#include <platform/eth.h>
+#include <platform/qspi.h>
+#include <platform/n25q128a.h>
+#include <target/bmi055.h>
+#include <target/debugconfig.h>
+#include <target/gpioconfig.h>
+#include <target/memory_lcd.h>
+#include <target/sensor_bus.h>
+#include <reg.h>
+
+#if WITH_LIB_MINIP
+#include <lib/minip.h>
+#endif
+
+#if WITH_LIB_FS_SPIFS
+#include <lib/fs.h>
+#include <target/fsconfig.h>
+#endif
+
+extern void target_usb_setup(void);
+
+const sdram_config_t target_sdram_config = {
+    .bus_width = SDRAM_BUS_WIDTH_16,
+    .cas_latency = SDRAM_CAS_LATENCY_2,
+    .col_bits_num = SDRAM_COLUMN_BITS_8
+};
+
+void target_early_init(void)
+{
+    GPIO_InitTypeDef gpio_init;
+
+    __HAL_RCC_GPIOE_CLK_ENABLE();
+    __HAL_RCC_GPIOD_CLK_ENABLE();
+    __HAL_RCC_GPIOJ_CLK_ENABLE();
+
+#if DEBUG_UART == 3
+    // configure usart 3 pins.
+    gpio_config(GPIO_USART3_TX, GPIO_STM32_AF | GPIO_STM32_AFn(GPIO_AF7_USART3) | GPIO_PULLUP);
+    gpio_config(GPIO_USART3_RX, GPIO_STM32_AF | GPIO_STM32_AFn(GPIO_AF7_USART3) | GPIO_PULLUP);
+#else
+#error need to configure gpio pins for debug uart
+#endif
+
+    gpio_init.Mode    = GPIO_MODE_OUTPUT_PP;
+    gpio_init.Pull    = GPIO_NOPULL;
+    gpio_init.Speed   = GPIO_SPEED_LOW;
+
+    gpio_init.Pin  = GPIO_TO_PIN_MASK(GPIO_LED108) | GPIO_TO_PIN_MASK(GPIO_LED109) |
+                     GPIO_TO_PIN_MASK(GPIO_LED110) | GPIO_TO_PIN_MASK(GPIO_LED111);
+    HAL_GPIO_Init(GPIOE, &gpio_init);
+
+    gpio_init.Pin  = GPIO_TO_PIN_MASK(GPIO_LED112) | GPIO_TO_PIN_MASK(GPIO_LED113);
+    HAL_GPIO_Init(GPIOD, &gpio_init);
+
+    gpio_init.Pin  = GPIO_TO_PIN_MASK(GPIO_LED114) | GPIO_TO_PIN_MASK(GPIO_LED115);
+    HAL_GPIO_Init(GPIOJ, &gpio_init);
+
+    // Initialize to a pattern just so we know we have something
+    gpio_set(GPIO_LED108, GPIO_LED_ON);
+    gpio_set(GPIO_LED109, GPIO_LED_ON);
+    gpio_set(GPIO_LED110, GPIO_LED_ON);
+    gpio_set(GPIO_LED111, GPIO_LED_ON);
+    gpio_set(GPIO_LED112, GPIO_LED_ON);
+    gpio_set(GPIO_LED113, GPIO_LED_ON);
+    gpio_set(GPIO_LED114, GPIO_LED_ON);
+    gpio_set(GPIO_LED115, GPIO_LED_ON);
+
+    // Initialize the switches GPIOs for interrupt on raising edge. In order
+    // to use stm32_EXTI15_10_IRQ() handler needs to be provided and EXTI15_10_IRQn
+    // needs to be enabled.
+    gpio_init.Mode   = GPIO_MODE_INPUT;
+    gpio_init.Pull   = GPIO_NOPULL;
+    gpio_init.Speed  = GPIO_SPEED_FAST;
+    gpio_init.Mode   = GPIO_MODE_IT_RISING;
+
+    gpio_init.Pin  =  GPIO_TO_PIN_MASK(GPIO_SW100) | GPIO_TO_PIN_MASK(GPIO_SW101) |
+                      GPIO_TO_PIN_MASK(GPIO_SW102) | GPIO_TO_PIN_MASK(GPIO_SW103);
+    HAL_GPIO_Init(GPIOJ, &gpio_init);
+
+    // Initialize Sensor bus (accelerometer / gyroscope / nrf51 spi bus
+    sensor_bus_init_early();
+
+    // now that the uart gpios are configured, enable the debug uart.
+    stm32_debug_early_init();
+
+    // default all the debug leds to off
+    target_set_debug_led(0, false);
+    target_set_debug_led(1, false);
+    target_set_debug_led(2, false);
+    target_set_debug_led(3, false);
+}
+
+
+void target_init(void)
+{
+    stm32_debug_init();
+
+    qspi_flash_init(N25Q128A_FLASH_SIZE);
+
+    memory_lcd_init();
+
+#if WITH_LIB_MINIP
+    uint8_t mac_addr[6];
+    gen_random_mac_address(mac_addr);
+    eth_init(mac_addr, PHY_KSZ8721);
+
+    /* start minip */
+    minip_set_macaddr(mac_addr);
+
+    uint32_t ip_addr = IPV4(192, 168, 0, 98);
+    uint32_t ip_mask = IPV4(255, 255, 255, 0);
+    uint32_t ip_gateway = IPV4_NONE;
+
+    minip_init(stm32_eth_send_minip_pkt, NULL, ip_addr, ip_mask, ip_gateway);
+#endif
+
+#if WITH_LIB_FS_SPIFS
+    status_t mount_success =
+            fs_mount(SPIFS_MOUNT_POINT, SPIFS_NAME, SPIFS_TARGET_DEVICE);
+    if (mount_success != NO_ERROR) {
+        printf("failed to mount '%s' at path '%s' on '%s'."
+               " Make sure that device is formatted\n",
+               SPIFS_NAME, SPIFS_MOUNT_POINT, SPIFS_TARGET_DEVICE);
+    }
+
+#endif
+
+    // start usb
+    target_usb_setup();
+
+    sensor_bus_init();
+}
+
+void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
+{
+    GPIO_InitTypeDef  GPIO_InitStruct;
+    if (hspi->Instance == SPI2) {
+        /*##-1- Enable peripherals and GPIO Clocks #################################*/
+        /* Enable GPIO TX/RX clock */
+        __HAL_RCC_GPIOD_CLK_ENABLE();
+        __HAL_RCC_GPIOK_CLK_ENABLE();
+        __HAL_RCC_GPIOB_CLK_ENABLE();
+        /* Enable SPI clock */
+        __HAL_RCC_SPI2_CLK_ENABLE();
+
+        /*##-2- Configure peripheral GPIO ##########################################*/
+        /* SPI SCK GPIO pin configuration  */
+        GPIO_InitStruct.Pin       = GPIO_PIN_3;
+        GPIO_InitStruct.Mode      = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull      = GPIO_PULLDOWN;
+        GPIO_InitStruct.Speed     = GPIO_SPEED_HIGH;
+        GPIO_InitStruct.Alternate = GPIO_AF5_SPI2;
+        HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
+
+        /* SPI MOSI GPIO pin configuration  */
+        GPIO_InitStruct.Pin = GPIO_PIN_15;
+        HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+        GPIO_InitStruct.Mode      = GPIO_MODE_OUTPUT_PP;
+        GPIO_InitStruct.Pull      = GPIO_NOPULL;
+
+        /* LCD_ON Pin configuration */
+        GPIO_InitStruct.Pin = GPIO_PIN_6;
+        HAL_GPIO_Init(GPIOK, &GPIO_InitStruct);
+
+        /* LCD_CS Pin configuration */
+        GPIO_InitStruct.Pin = GPIO_PIN_12;
+        HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+
+        /*##-3- Configure the NVIC for SPI #########################################*/
+        /* NVIC for SPI */
+        HAL_NVIC_EnableIRQ(SPI2_IRQn);
+    }
+}
+
+/**
+  * @brief  Initializes SDRAM GPIO.
+  * called back from stm32_sdram_init
+  */
+void stm_sdram_GPIO_init(void)
+{
+    GPIO_InitTypeDef gpio_init_structure;
+
+    /* Enable GPIOs clock */
+    __HAL_RCC_GPIOC_CLK_ENABLE();
+    __HAL_RCC_GPIOD_CLK_ENABLE();
+    __HAL_RCC_GPIOE_CLK_ENABLE();
+    __HAL_RCC_GPIOF_CLK_ENABLE();
+    __HAL_RCC_GPIOG_CLK_ENABLE();
+    __HAL_RCC_GPIOH_CLK_ENABLE();
+
+    /* Common GPIO configuration */
+    gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+    gpio_init_structure.Pull      = GPIO_PULLUP;
+    gpio_init_structure.Speed     = GPIO_SPEED_FAST;
+    gpio_init_structure.Alternate = GPIO_AF12_FMC;
+
+    /* GPIOC configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_3;
+    HAL_GPIO_Init(GPIOC, &gpio_init_structure);
+
+    /* GPIOD configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_3 | GPIO_PIN_8| GPIO_PIN_9 | GPIO_PIN_10 |\
+                                GPIO_PIN_14 | GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOD, &gpio_init_structure);
+
+    /* GPIOE configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_7| GPIO_PIN_8 | GPIO_PIN_9 |\
+                                GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 |\
+                                GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOE, &gpio_init_structure);
+
+    /* GPIOF configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2| GPIO_PIN_3 | GPIO_PIN_4 |\
+                                GPIO_PIN_5 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 |\
+                                GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOF, &gpio_init_structure);
+
+    /* GPIOG configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4| GPIO_PIN_5 | GPIO_PIN_8 |\
+                                GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOG, &gpio_init_structure);
+
+    /* GPIOH configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_3 | GPIO_PIN_5;
+    HAL_GPIO_Init(GPIOH, &gpio_init_structure);
+}
+
+
+/**
+  * @brief  Initializes the ETH MSP.
+  * @param  heth: ETH handle
+  * @retval None
+  */
+/* called back from the HAL_ETH_Init routine */
+void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
+{
+    GPIO_InitTypeDef GPIO_InitStructure;
+
+    /* Enable GPIOs clocks */
+    __HAL_RCC_GPIOA_CLK_ENABLE();
+    __HAL_RCC_GPIOC_CLK_ENABLE();
+    __HAL_RCC_GPIOG_CLK_ENABLE();
+
+    /* Ethernet pins configuration ************************************************/
+    /*
+        RMII_REF_CLK ----------------------> PA1
+        RMII_MDIO -------------------------> PA2
+        RMII_MDC --------------------------> PC1
+        RMII_MII_CRS_DV -------------------> PA7
+        RMII_MII_RXD0 ---------------------> PC4
+        RMII_MII_RXD1 ---------------------> PC5
+        RMII_MII_TX_EN --------------------> PG11
+        RMII_MII_TXD0 ---------------------> PG13
+        RMII_MII_TXD1 ---------------------> PG14
+    */
+
+    /* Configure PA1, PA2 and PA7 */
+    GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
+    GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
+    GPIO_InitStructure.Pull = GPIO_NOPULL;
+    GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
+    GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
+    HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
+
+    /* Configure PC1, PC4 and PC5 */
+    GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5;
+    HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
+
+    /* Configure PG2, PG11, PG13 and PG14 */
+    GPIO_InitStructure.Pin =  GPIO_PIN_2 | GPIO_PIN_11 | GPIO_PIN_13 | GPIO_PIN_14;
+    HAL_GPIO_Init(GPIOG, &GPIO_InitStructure);
+}
+
+void HAL_QSPI_MspInit(QSPI_HandleTypeDef *hqspi)
+{
+    GPIO_InitTypeDef GPIO_InitStruct;
+
+    /*##-1- Enable peripherals and GPIO Clocks #################################*/
+    /* Enable GPIO clocks */
+    __HAL_RCC_GPIOB_CLK_ENABLE();
+    __HAL_RCC_GPIOD_CLK_ENABLE();
+    __HAL_RCC_GPIOE_CLK_ENABLE();
+
+    /*##-2- Configure peripheral GPIO ##########################################*/
+    /* QSPI CS GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_6;
+    GPIO_InitStruct.Mode      = GPIO_MODE_AF_PP;
+    GPIO_InitStruct.Pull      = GPIO_PULLUP;
+    GPIO_InitStruct.Speed     = GPIO_SPEED_HIGH;
+    GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;
+    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+    /* QSPI CLK GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_2;
+    GPIO_InitStruct.Pull      = GPIO_NOPULL;
+    GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
+    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+    /* QSPI D0 GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_11;
+    GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
+    HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
+
+    /* QSPI D1 GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_12;
+    GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
+    HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
+
+    /* QSPI D2 GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_2;
+    GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
+    HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
+
+    /* QSPI D3 GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_13;
+    GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
+    HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
+}
+
+/**
+  * @brief  Initializes the PCD MSP.
+  * @param  hpcd: PCD handle
+  * @retval None
+  */
+void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
+{
+    GPIO_InitTypeDef  GPIO_InitStruct;
+
+    if (hpcd->Instance == USB_OTG_FS) {
+        /* Configure USB FS GPIOs */
+        __HAL_RCC_GPIOA_CLK_ENABLE();
+
+        /* Configure DM DP Pins */
+        GPIO_InitStruct.Pin = (GPIO_PIN_11 | GPIO_PIN_12);
+        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull = GPIO_NOPULL;
+        GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+        GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
+        HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+        /* Enable USB FS Clock */
+        __HAL_RCC_USB_OTG_FS_CLK_ENABLE();
+
+        /* Set USBFS Interrupt priority */
+        HAL_NVIC_SetPriority(OTG_FS_IRQn, 5, 0);
+
+        /* Enable USBFS Interrupt */
+        HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
+
+        if (hpcd->Init.low_power_enable == 1) {
+            /* Enable EXTI Line 18 for USB wakeup*/
+            __HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG();
+            __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_EDGE();
+            __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_IT();
+
+            /* Set EXTI Wakeup Interrupt priority*/
+            HAL_NVIC_SetPriority(OTG_FS_WKUP_IRQn, 0, 0);
+
+            /* Enable EXTI Interrupt */
+            HAL_NVIC_EnableIRQ(OTG_FS_WKUP_IRQn);
+        }
+    } else if (hpcd->Instance == USB_OTG_HS) {
+        /* Configure USB FS GPIOs */
+        __HAL_RCC_GPIOA_CLK_ENABLE();
+        __HAL_RCC_GPIOB_CLK_ENABLE();
+        __HAL_RCC_GPIOC_CLK_ENABLE();
+        __HAL_RCC_GPIOH_CLK_ENABLE();
+
+        /* CLK */
+        GPIO_InitStruct.Pin = GPIO_PIN_5;
+        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull = GPIO_NOPULL;
+        GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+        GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
+        HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+        /* D0 */
+        GPIO_InitStruct.Pin = GPIO_PIN_3;
+        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull = GPIO_NOPULL;
+        GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+        GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
+        HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+        /* D1 D2 D3 D4 D5 D6 D7 */
+        GPIO_InitStruct.Pin = GPIO_PIN_0  | GPIO_PIN_1  | GPIO_PIN_5 |\
+                              GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13;
+        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull = GPIO_NOPULL;
+        GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
+        HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+        /* STP */
+        GPIO_InitStruct.Pin = GPIO_PIN_0;
+        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull = GPIO_NOPULL;
+        GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
+        HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
+
+        /* NXT */
+        GPIO_InitStruct.Pin = GPIO_PIN_4;
+        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull = GPIO_NOPULL;
+        GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
+        HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
+
+        /* DIR */
+        GPIO_InitStruct.Pin = GPIO_PIN_2;
+        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull = GPIO_NOPULL;
+        GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
+        HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
+
+        __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE();
+
+        /* Enable USB HS Clocks */
+        __HAL_RCC_USB_OTG_HS_CLK_ENABLE();
+
+        /* Set USBHS Interrupt to the lowest priority */
+        HAL_NVIC_SetPriority(OTG_HS_IRQn, 5, 0);
+
+        /* Enable USBHS Interrupt */
+        HAL_NVIC_EnableIRQ(OTG_HS_IRQn);
+    }
+}
+
+void target_set_debug_led(unsigned int led, bool on)
+{
+    uint32_t gpio;
+
+    switch (led) {
+        case 0:
+            gpio = GPIO_LED112;
+            break;
+        case 1:
+            gpio = GPIO_LED113;
+            break;
+        case 2:
+            gpio = GPIO_LED114;
+            break;
+        case 3:
+            gpio = GPIO_LED115;
+            break;
+        default:
+            return;
+    }
+
+    gpio_set(gpio, on ? GPIO_LED_ON : GPIO_LED_OFF);
+}
+
diff --git a/src/bsp/lk/target/dartuinoP0/memory_lcd.c b/src/bsp/lk/target/dartuinoP0/memory_lcd.c
new file mode 100644
index 0000000..c73f85d
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/memory_lcd.c
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2015 Gurjant Kalsi <me@gurjantkalsi.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <err.h>
+#include <debug.h>
+#include <trace.h>
+#include <rand.h>
+
+#include <dev/display.h>
+#include <lib/gfx.h>
+#include <platform/gpio.h>
+#include <target/memory_lcd.h>
+
+#if defined (LCD_LS013B7DH06)
+#include <target/display/LS013B7DH06.h>
+#elif defined (LCD_LS027B7DH01)
+#include <target/display/LS027B7DH01.h>
+#endif
+
+#define LOCAL_TRACE 0
+
+SPI_HandleTypeDef SpiHandle;
+
+#define MLCD_WR 0x01  // LCD Write Command
+#define MLCD_CM 0x04  // LCD Clear Memory Command
+#define MLCD_NO 0x00  // LCD No-op command
+
+// 5 bytes used as control bytes, MLCD_BYTES_LINE bytes used to data
+#define MLCD_BUF_SIZE  (MLCD_BYTES_LINE + 5)
+
+#define VCOM_HI 0x02
+#define VCOM_LO 0x00
+
+static uint8_t framebuffer[MLCD_HEIGHT * MLCD_WIDTH];
+static uint8_t vcom_state;
+
+static void chip_select(bool s)
+{
+    if (s) {
+        gpio_set(GPIO(GPIO_PORT_B, 12), GPIO_PIN_SET);
+    } else {
+        gpio_set(GPIO(GPIO_PORT_B, 12), GPIO_PIN_RESET);
+    }
+}
+
+static void lcd_power(bool s)
+{
+    if (s) {
+        gpio_set(GPIO(GPIO_PORT_K, 6), GPIO_PIN_SET);
+    } else {
+        gpio_set(GPIO(GPIO_PORT_K, 6), GPIO_PIN_RESET);
+    }
+}
+
+static void mlcd_clear(void)
+{
+
+    uint8_t clear[2];
+    clear[0] = MLCD_CM;
+    clear[1] = 0;
+
+    chip_select(true);
+    HAL_SPI_Transmit(&SpiHandle, clear, 2, HAL_MAX_DELAY);
+    chip_select(false);
+}
+
+
+status_t memory_lcd_init(void)
+{
+    SpiHandle.Instance               = SPI2;
+    SpiHandle.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_4;
+    SpiHandle.Init.Direction         = SPI_DIRECTION_1LINE;
+    SpiHandle.Init.CLKPhase          = SPI_PHASE_1EDGE;
+    SpiHandle.Init.CLKPolarity       = SPI_POLARITY_LOW;
+    SpiHandle.Init.DataSize          = SPI_DATASIZE_8BIT;
+    SpiHandle.Init.FirstBit          = SPI_FIRSTBIT_LSB;
+    SpiHandle.Init.TIMode            = SPI_TIMODE_DISABLE;
+    SpiHandle.Init.CRCCalculation    = SPI_CRCCALCULATION_DISABLE;
+    SpiHandle.Init.CRCPolynomial     = 7;
+    SpiHandle.Init.NSS               = SPI_NSS_SOFT;
+    SpiHandle.Init.Mode              = SPI_MODE_MASTER;
+
+    if (HAL_SPI_Init(&SpiHandle) != HAL_OK) {
+        return ERR_GENERIC;
+    }
+
+    vcom_state = VCOM_LO;
+
+    lcd_power(true);
+
+    mlcd_clear();
+
+    return NO_ERROR;
+}
+
+
+
+static void mlcd_flush(uint starty, uint endy)
+{
+    chip_select(true);
+
+    static uint8_t localbuf[MLCD_BUF_SIZE];
+    uint8_t *bufptr = localbuf;
+
+    // The first line is preceeded with a write command.
+    *bufptr++ = MLCD_WR | vcom_state;
+
+    vcom_state = vcom_state == VCOM_HI ? VCOM_LO : VCOM_HI;
+
+    // Send the image data.
+    for (uint j = starty; j <= endy; ++j) {
+        *bufptr++ = (j + 1);
+
+        bufptr += lcd_get_line(framebuffer, j, bufptr);
+
+        if (HAL_SPI_Transmit(&SpiHandle, localbuf, bufptr - localbuf, HAL_MAX_DELAY) != HAL_OK) {
+            goto finish;
+        }
+
+        bufptr = localbuf;
+
+        *bufptr++ = (j + 1);
+    }
+
+    uint8_t trailer = 0;
+    if (HAL_SPI_Transmit(&SpiHandle, &trailer, 1, HAL_MAX_DELAY) != HAL_OK) {
+        goto finish;
+    }
+
+
+finish:
+    chip_select(false);
+}
+
+status_t display_get_info(struct display_info *info)
+{
+    LTRACEF("display_info %p\n", info);
+
+    info->framebuffer = (void*)framebuffer;
+    info->format = MLCD_GFX_FORMAT;
+    info->width = MLCD_WIDTH;
+    info->height = MLCD_HEIGHT;
+    info->stride = MLCD_WIDTH;
+    info->flush = mlcd_flush;
+
+    return NO_ERROR;
+}
diff --git a/src/bsp/lk/target/dartuinoP0/rules.mk b/src/bsp/lk/target/dartuinoP0/rules.mk
new file mode 100644
index 0000000..5271f9e
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/rules.mk
@@ -0,0 +1,61 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+STM32_CHIP := stm32f756
+
+PLATFORM := stm32f7xx
+
+SDRAM_SIZE := 0x00800000
+SDRAM_BASE := 0xc0000000
+
+DISPLAY_PANEL_TYPE ?= LS013B7DH06
+
+GLOBAL_DEFINES += \
+    ENABLE_UART3=1 \
+    ENABLE_SDRAM=1 \
+    USE_HSE_XTAL=1 \
+    SDRAM_BASE=$(SDRAM_BASE) \
+    SDRAM_SIZE=$(SDRAM_SIZE) \
+    PLL_M_VALUE=8 \
+    PLL_N_VALUE=336 \
+    PLL_P_VALUE=2 \
+\
+    PKTBUF_POOL_SIZE=16 \
+\
+    TARGET_HAS_DEBUG_LED=1
+
+MODULE_DEPS += \
+    app/accelerometer \
+
+GLOBAL_INCLUDES += $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/init.c \
+    $(LOCAL_DIR)/sensor_bus.c \
+    $(LOCAL_DIR)/usb.c \
+
+ifneq ($(DISPLAY_PANEL_TYPE),)
+MODULE_DEPS += \
+    lib/gfx
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/memory_lcd.c
+endif
+
+ifeq ($(DISPLAY_PANEL_TYPE),LS013B7DH06)
+GLOBAL_DEFINES += \
+    LCD_LS013B7DH06=1
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/display/LS013B7DH06.c
+else ifeq ($(DISPLAY_PANEL_TYPE),LS027B7DH01)
+GLOBAL_DEFINES += \
+    LCD_LS027B7DH01=1
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/display/LS027B7DH01.c
+endif
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/dartuinoP0/sensor_bus.c b/src/bsp/lk/target/dartuinoP0/sensor_bus.c
new file mode 100644
index 0000000..82f608a
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/sensor_bus.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2015 Eric Holland
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <kernel/mutex.h>
+#include <platform/gpio.h>
+#include <target/gpioconfig.h>
+#include <target/bmi055.h>
+#include <target/sensor_bus.h>
+#include <dev/accelerometer.h>
+
+static mutex_t sensorbus_mutex;
+static SPI_HandleTypeDef spi_handle;
+
+static uint8_t tx_buff[16];
+static uint8_t rx_buff[16];
+
+status_t acc_read_xyz(position_vector_t * pos_vector_p)
+{
+    tx_buff[0] = BMI055_ADDRESS_READ( BMI055_ACC_ACCD_X_LSB );
+    if ( acc_flush(tx_buff, rx_buff, 7) == NO_ERROR )
+    {
+            pos_vector_p->x = 0.001*(((int8_t)rx_buff[2] << 4) | ( (rx_buff[1] >> 4) & 0x0F));
+            pos_vector_p->y = 0.001*(((int8_t)rx_buff[4] << 4) | ( (rx_buff[3] >> 4) & 0x0F));
+            pos_vector_p->z = 0.001*(((int8_t)rx_buff[6] << 4) | ( (rx_buff[5] >> 4) & 0x0F));
+            return NO_ERROR;
+    }
+    else {
+            return ERR_GENERIC;
+    }
+}
+
+status_t acc_flush(uint8_t * tbuff, uint8_t * rbuff, uint8_t numbytes)
+{
+    status_t ret_status;
+
+    mutex_acquire(&sensorbus_mutex);
+
+    gpio_set(GPIO_ACC_nCS,GPIO_PIN_RESET);
+
+    ret_status = HAL_SPI_TransmitReceive(&spi_handle, tbuff, rbuff, numbytes, 5000);
+
+    gpio_set(GPIO_ACC_nCS,GPIO_PIN_SET);
+
+    mutex_release(&sensorbus_mutex);
+
+    return ret_status;
+}
+
+/**
+ * @brief Initiale SPI5 module and IO for control of spi bus linking nrf51, accelerometer, and gyroscope.
+ *
+ */
+status_t sensor_bus_init_early(void)
+{
+    __HAL_SENSOR_BUS_GPIO_CLK_ENABLE();
+    __HAL_RCC_SPI5_CLK_ENABLE();
+
+    gpio_config(GPIO_SPI5_SCK,  GPIO_STM32_AF | GPIO_STM32_AFn(GPIO_AF5_SPI5) | GPIO_PULLUP);
+    gpio_config(GPIO_SPI5_MISO, GPIO_STM32_AF | GPIO_STM32_AFn(GPIO_AF5_SPI5) | GPIO_PULLUP);
+    gpio_config(GPIO_SPI5_MOSI, GPIO_STM32_AF | GPIO_STM32_AFn(GPIO_AF5_SPI5) | GPIO_PULLUP);
+
+    gpio_config(GPIO_NRF_CS,    GPIO_OUTPUT );
+    gpio_config(GPIO_NRF_INT,   GPIO_INPUT   | GPIO_PULLUP);
+
+    gpio_config(GPIO_GYRO_nCS,  GPIO_OUTPUT );
+    gpio_config(GPIO_GYRO_INT,  GPIO_INPUT   | GPIO_PULLUP);
+
+    gpio_config(GPIO_ACC_nCS,   GPIO_OUTPUT );
+    gpio_config(GPIO_ACC_INT,   GPIO_INPUT   | GPIO_PULLUP);
+
+    gpio_set(GPIO_NRF_CS, GPIO_PIN_RESET);
+    gpio_set(GPIO_GYRO_nCS, GPIO_PIN_SET);
+    gpio_set(GPIO_ACC_nCS, GPIO_PIN_SET);
+
+	spi_handle.Instance               = SPI5;
+	spi_handle.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_128;
+	spi_handle.Init.Direction         = SPI_DIRECTION_2LINES;
+	spi_handle.Init.CLKPhase          = SPI_PHASE_1EDGE;
+	spi_handle.Init.CLKPolarity       = SPI_POLARITY_LOW;
+	spi_handle.Init.DataSize          = SPI_DATASIZE_8BIT;
+	spi_handle.Init.FirstBit          = SPI_FIRSTBIT_MSB;
+	spi_handle.Init.TIMode            = SPI_TIMODE_DISABLE;
+	spi_handle.Init.CRCCalculation    = SPI_CRCCALCULATION_DISABLE;
+	spi_handle.Init.CRCPolynomial     = 7;
+	spi_handle.Init.NSS               = SPI_NSS_SOFT;
+	spi_handle.Init.Mode              = SPI_MODE_MASTER;
+
+	if (HAL_SPI_Init(&spi_handle) != HAL_OK) {
+		return ERR_GENERIC;
+	}
+    return NO_ERROR;
+}
+
+
+
+void sensor_bus_init(void)
+{
+    mutex_init(&sensorbus_mutex);
+}
+
+
diff --git a/src/bsp/lk/target/dartuinoP0/usb.c b/src/bsp/lk/target/dartuinoP0/usb.c
new file mode 100644
index 0000000..2689b44
--- /dev/null
+++ b/src/bsp/lk/target/dartuinoP0/usb.c
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2013-2015 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <stdio.h>
+#include <trace.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/usb.h>
+#include <dev/usbc.h>
+#include <hw/usb.h>
+#include <lk/init.h>
+
+#define LOCAL_TRACE 0
+
+#define W(w) (w & 0xff), (w >> 8)
+#define W3(w) (w & 0xff), ((w >> 8) & 0xff), ((w >> 16) & 0xff)
+
+/* top level device descriptor */
+static const uint8_t dev_descr[] = {
+    0x12,           /* descriptor length */
+    DEVICE,         /* Device Descriptor type */
+    W(0x0200),      /* USB Version */
+    0xff,           /* class */
+    0xff,           /* subclass */
+    0xff,           /* protocol */
+    64,             /* max packet size, ept0 */
+    W(0x9999),      /* vendor */
+    W(0x9999),      /* product */
+    W(0x9999),      /* release */
+    0x2,            /* manufacturer string */
+    0x1,            /* product string */
+    0x0,            /* serialno string */
+    0x1,            /* num configs */
+};
+
+/* high/low speed device qualifier */
+static const uint8_t devqual_descr[] = {
+    0x0a,           /* len */
+    DEVICE_QUALIFIER, /* Device Qualifier type */
+    W(0x0200),      /* USB version */
+    0x00,           /* class */
+    0x00,           /* subclass */
+    0x00,           /* protocol */
+    64,             /* max packet size, ept0 */
+    0x01,           /* num configs */
+    0x00            /* reserved */
+};
+
+static const uint8_t cfg_descr[] = {
+    0x09,           /* Length of Cfg Descr */
+    CONFIGURATION,  /* Type of Cfg Descr */
+    W(0x09),        /* Total Length (incl ifc, ept) */
+    0x00,           /* # Interfaces */
+    0x01,           /* Cfg Value */
+    0x00,           /* Cfg String */
+    0xc0,           /* Attributes -- self powered */
+    250,            /* Power Consumption - 500mA */
+};
+
+static const uchar langid[] = { 0x04, 0x03, 0x09, 0x04 };
+
+static const uint8_t if_descriptor_lowspeed[] = {
+    0x09,           /* length */
+    INTERFACE,      /* type */
+    0x01,           /* interface num */
+    0x00,           /* alternates */
+    0x02,           /* endpoint count */
+    0xff,           /* interface class */
+    0xff,           /* interface subclass */
+    0x00,           /* interface protocol */
+    0x00,           /* string index */
+
+    /* endpoint 1 IN */
+    0x07,           /* length */
+    ENDPOINT,       /* type */
+    0x81,           /* address: 1 IN */
+    0x02,           /* type: bulk */
+    W(64),          /* max packet size: 64 */
+    00,             /* interval */
+
+    /* endpoint 1 OUT */
+    0x07,           /* length */
+    ENDPOINT,       /* type */
+    0x01,           /* address: 1 OUT */
+    0x02,           /* type: bulk */
+    W(64),          /* max packet size: 64 */
+    00,             /* interval */
+};
+
+usb_config config = {
+    .lowspeed = {
+        .device = USB_DESC_STATIC(dev_descr),
+        .device_qual = USB_DESC_STATIC(devqual_descr),
+        .config = USB_DESC_STATIC(cfg_descr),
+    },
+    .highspeed = {
+        .device = USB_DESC_STATIC(dev_descr),
+        .device_qual = USB_DESC_STATIC(devqual_descr),
+        .config = USB_DESC_STATIC(cfg_descr),
+    },
+
+    .langid = USB_DESC_STATIC(langid),
+};
+
+static status_t ep_cb_rx(ep_t endpoint, usbc_transfer_t *t);
+static status_t ep_cb_tx(ep_t endpoint, usbc_transfer_t *t);
+
+static void queue_rx(void)
+{
+    static usbc_transfer_t transfer;
+    static uint8_t buf[512];
+
+    transfer.callback = &ep_cb_rx;
+    transfer.result = 0;
+    transfer.buf = &buf;
+    transfer.buflen = sizeof(buf);
+    transfer.bufpos = 0;
+    transfer.extra = 0;
+
+    usbc_queue_rx(1, &transfer);
+}
+
+static void queue_tx(void)
+{
+    static usbc_transfer_t transfer;
+    static uint8_t buf[512];
+
+    for (uint i = 0; i < sizeof(buf); i++) {
+        buf[i] = ~i;
+    }
+
+    transfer.callback = &ep_cb_tx;
+    transfer.result = 0;
+    transfer.buf = &buf;
+    transfer.buflen = sizeof(buf);
+    transfer.bufpos = 0;
+    transfer.extra = 0;
+
+    usbc_queue_tx(1, &transfer);
+}
+
+static status_t ep_cb_rx(ep_t endpoint, usbc_transfer_t *t)
+{
+#if LOCAL_TRACE
+    LTRACEF("ep %u transfer %p\n", endpoint, t);
+    usbc_dump_transfer(t);
+
+    if (t->result >= 0) {
+        hexdump8(t->buf, t->bufpos);
+    }
+#endif
+
+    if (t->result >= 0)
+        queue_rx();
+
+    return NO_ERROR;
+}
+
+static status_t ep_cb_tx(ep_t endpoint, usbc_transfer_t *t)
+{
+#if LOCAL_TRACE
+    LTRACEF("ep %u transfer %p\n", endpoint, t);
+    usbc_dump_transfer(t);
+#endif
+
+    if (t->result >= 0)
+        queue_tx();
+
+    return NO_ERROR;
+}
+
+static status_t usb_cb(void *cookie, usb_callback_op_t op, const union usb_callback_args *args)
+{
+    LTRACEF("cookie %p, op %u, args %p\n", cookie, op, args);
+
+    if (op == USB_CB_ONLINE) {
+        usbc_setup_endpoint(1, USB_IN, 0x40);
+        usbc_setup_endpoint(1, USB_OUT, 0x40);
+
+        queue_rx();
+        queue_tx();
+    }
+    return NO_ERROR;
+}
+
+void target_usb_setup(void)
+{
+    usb_setup(&config);
+    printf("appending interfaces\n");
+    usb_append_interface_lowspeed(if_descriptor_lowspeed, sizeof(if_descriptor_lowspeed));
+    usb_append_interface_highspeed(if_descriptor_lowspeed, sizeof(if_descriptor_lowspeed));
+
+    usb_add_string("LK", 1);
+    usb_add_string("LK Industries", 2);
+
+    usb_register_callback(&usb_cb, NULL);
+    usb_start();
+}
diff --git a/src/bsp/lk/target/fpga8168-rtos/include/target/cust_usb.h b/src/bsp/lk/target/fpga8168-rtos/include/target/cust_usb.h
new file mode 100644
index 0000000..c84152c
--- /dev/null
+++ b/src/bsp/lk/target/fpga8168-rtos/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0BB4)
+#define USB_PRODUCTID       (0x0C01)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/fpga8168-rtos/rules.mk b/src/bsp/lk/target/fpga8168-rtos/rules.mk
new file mode 100644
index 0000000..7b35a23
--- /dev/null
+++ b/src/bsp/lk/target/fpga8168-rtos/rules.mk
@@ -0,0 +1,41 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+SRC_CLOCK := 10000000
+
+PLATFORM := mediatek
+MTK_PLATFORM := mt8133
+DRAM_TYPE := LPDDR4
+
+TZ_PART_NAME := tee_a
+RECOVERY_TZ_PART_NAME = tee_a
+DTBO_PART_NAME := dtbo
+BOOT_PART_NAME := boot
+RECOVERY_BOOT_PART_NAME = recovery
+BL33_PART_NAME := bl33
+RECOVERY_BL33_PART_NAME := bl33
+USB_PHY := fpga
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+                  -DSPM_PART_NAME=\"$(SPM_PART_NAME)\" \
+                  -DBL33_PART_NAME=\"$(BL33_PART_NAME)\" \
+                  -DROOTFS_PART_NAME=\"$(ROOTFS_PART_NAME)\" \
+                  -DRECOVERY_BL33_PART_NAME=\"$(RECOVERY_BL33_PART_NAME)\" \
+                  -DDRAM_TYPE=\"$(DRAM_TYPE)\" \
+                  -DSRC_CLOCK=$(SRC_CLOCK) \
+		  -DMACH_FPGA=1
+
+MODULE_DEPS += \
+    platform/${PLATFORM}/${MTK_PLATFORM}/drivers/mmc
+
+include make/module.mk
diff --git a/src/bsp/lk/target/fpga8168-rtos/target.c b/src/bsp/lk/target/fpga8168-rtos/target.c
new file mode 100644
index 0000000..24920b3
--- /dev/null
+++ b/src/bsp/lk/target/fpga8168-rtos/target.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2019 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <sys/types.h>
+#include <platform/mmc_core.h>
+#include <platform/platform_blx.h>
+
+struct mmc_card *card;
+bool retry_opcond;
+
+void target_early_init(void)
+{
+    card = emmc_init_stage1(&retry_opcond);
+
+    /* init memory */
+    platform_memory_init();
+}
+
+void target_init(void)
+{
+    if (card) {
+        emmc_init_stage2(card, retry_opcond);
+    }
+}
diff --git a/src/bsp/lk/target/helio/include/target/debugconfig.h b/src/bsp/lk/target/helio/include/target/debugconfig.h
new file mode 100644
index 0000000..b3ff586
--- /dev/null
+++ b/src/bsp/lk/target/helio/include/target/debugconfig.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
diff --git a/src/bsp/lk/target/helio/rules.mk b/src/bsp/lk/target/helio/rules.mk
new file mode 100644
index 0000000..c603c62
--- /dev/null
+++ b/src/bsp/lk/target/helio/rules.mk
@@ -0,0 +1,18 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+#MODULE := $(LOCAL_DIR)
+
+GLOBAL_INCLUDES += \
+	$(LOCAL_DIR)/include
+
+PLATFORM := alterasoc
+
+MODULES += \
+
+GLOBAL_DEFINES += \
+	TIMER_CLOCK_FREQ=200000000
+
+MEMSIZE := 0x40000000 # 1GB
+
+#include make/module.mk
+
diff --git a/src/bsp/lk/target/init.c b/src/bsp/lk/target/init.c
new file mode 100644
index 0000000..80470b6
--- /dev/null
+++ b/src/bsp/lk/target/init.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2008 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <target.h>
+#include <compiler.h>
+
+/*
+ * default implementations of these routines, if the target code
+ * chooses not to implement.
+ */
+
+__WEAK void target_early_init(void)
+{
+}
+
+__WEAK void target_init(void)
+{
+}
+
+__WEAK void target_set_led(unsigned int led, bool on)
+{
+}
+
+__WEAK void target_quiesce(void)
+{
+}
+
diff --git a/src/bsp/lk/target/lpcexpresso1549/include/target/debugconfig.h b/src/bsp/lk/target/lpcexpresso1549/include/target/debugconfig.h
new file mode 100644
index 0000000..fa58126
--- /dev/null
+++ b/src/bsp/lk/target/lpcexpresso1549/include/target/debugconfig.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#include <platform/lpc.h>
+
+#define DEBUG_UART LPC_USART0
diff --git a/src/bsp/lk/target/lpcexpresso1549/init.c b/src/bsp/lk/target/lpcexpresso1549/init.c
new file mode 100644
index 0000000..606e4ab
--- /dev/null
+++ b/src/bsp/lk/target/lpcexpresso1549/init.c
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/gpio.h>
+#include <platform/gpio.h>
+
+#include <platform/lpc.h>
+
+/* needs to be defined for the lpcopen drivers */
+const uint32_t OscRateIn = 12000000;
+const uint32_t RTCOscRateIn = 32768;
+
+/* The System initialization code is called prior to the application and
+   initializes the board for run-time operation. Board initialization
+   includes clock setup and default pin muxing configuration. */
+
+/*****************************************************************************
+ * Private types/enumerations/variables
+ ****************************************************************************/
+
+/* IOCON setup table, only items that need changing from their default pin
+   state are in this table. */
+STATIC const PINMUX_GRP_T ioconSetup[] = {
+    /* LEDs */
+    {0, 25,  (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO0_25-BREAK_CTRL-RED (low enable) */
+    {0, 3,   (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO0_3-SCT1_OUT4-GRN */
+    {1, 1,   (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO1_1-BREAK_STS1-BLUE */
+
+    /* QEI, motor controler, I2C, CAN */
+    {0, 2,   (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO0_2-QEI-SCT0_IN */
+    {0, 30,  (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO0_30-QEI-SCT0_IN */
+    {0, 17,  (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO0_17-QEI-SCT0_IN */
+    {0, 25,  (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO0_25-BREAK_CTRL-RED */
+    {1, 1,   (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO1_1-BREAK_STS1-BLUE */
+    {0, 23,  (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO0_23-I2C_SDA */
+    {0, 22,  (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO0_22-I2C_SCL */
+    {0, 11,  (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO0_11-CAN_RD */
+    {0, 31,  (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO0_31-CAN_TD */
+
+    /* ADC */
+    {1, 3,   (IOCON_MODE_INACT)},                           /* PIO1_3-ADC1_5 */
+    {0, 4,   (IOCON_MODE_INACT)},                           /* PIO0_4-ADC0_4 */
+    {0, 5,   (IOCON_MODE_INACT)},                           /* PIO0_5-ADC0_3 */
+    {0, 7,   (IOCON_MODE_INACT)},                           /* PIO0_7-ADC0_1 */
+    {0, 8,   (IOCON_MODE_INACT)},                           /* PIO0_8-ADC0_0 */
+    {0, 9,   (IOCON_MODE_INACT)},                           /* PIO0_9-ADC1_1 */
+    {0, 10,  (IOCON_MODE_INACT)},                           /* PIO0_10-ADC1_2 */
+
+    /* Joystick */
+    {1, 4,   (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO1_4-JOY_U */
+    {1, 5,   (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO1_5-JOY_C */
+    {1, 6,   (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO1_6-JOY_D */
+    {1, 7,   (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO1_7-JOY_R */
+    {1, 8,   (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO1_8-JOY_L */
+
+    /* UART */
+    {0, 13,  (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO0_13-ISP_RX */
+    {0, 18,  (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},        /* PIO0_18-ISP_TX */
+    {0, 11,  (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},
+    {0, 31,  (IOCON_MODE_INACT | IOCON_DIGMODE_EN)},
+
+    /* USB related */
+    {1, 11,  (IOCON_MODE_PULLDOWN | IOCON_DIGMODE_EN)}, /* PIO1_11-ISP_1 (VBUS) */
+};
+
+/* SWIM pin assignment definitions for pin assignment/muxing */
+typedef struct {
+    uint16_t assignedpin : 9;       /* Function and mode */
+    uint16_t port : 2;              /* Pin port */
+    uint16_t pin : 5;               /* Pin number */
+} SWM_GRP_T;
+
+/* Pin muxing table, only items that need changing from their default pin
+   state are in this table. */
+STATIC const SWM_GRP_T swmSetup[] = {
+    /* USB related */
+    {(uint16_t) SWM_USB_VBUS_I, 1, 11},     /* PIO1_11-ISP_1-AIN_CTRL */
+
+    /* UART */
+    {(uint16_t) SWM_UART0_RXD_I, 0, 13},        /* PIO0_13-ISP_RX */
+    {(uint16_t) SWM_UART0_TXD_O, 0, 18},        /* PIO0_18-ISP_TX */
+};
+
+/* Setup fixed pin functions (GPIOs are fixed) */
+/* No fixed pins except GPIOs */
+#define PINENABLE0_VAL 0xFFFFFFFF
+
+/* No fixed pins except GPIOs */
+#define PINENABLE1_VAL 0x00FFFFFF
+
+/* Sets up system pin muxing */
+void Board_SetupMuxing(void)
+{
+    /* Enable SWM and IOCON clocks */
+    Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
+    Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
+    Chip_SYSCTL_PeriphReset(RESET_IOCON);
+
+    /* IOCON setup */
+    Chip_IOCON_SetPinMuxing(LPC_IOCON, ioconSetup, sizeof(ioconSetup) / sizeof(PINMUX_GRP_T));
+
+    /* SWM assignable pin setup */
+    for (uint i = 0; i < (sizeof(swmSetup) / sizeof(SWM_GRP_T)); i++) {
+        Chip_SWM_MovablePortPinAssign((CHIP_SWM_PIN_MOVABLE_T) swmSetup[i].assignedpin,
+                                      swmSetup[i].port, swmSetup[i].pin);
+    }
+
+    /* SWM fixed pin setup */
+    //  LPC_SWM->PINENABLE[0] = PINENABLE0_VAL;
+    //  LPC_SWM->PINENABLE[1] = PINENABLE1_VAL;
+
+    /* Note SWM and IOCON clocks are left on */
+}
+
+/* Initialize debug output via UART for board */
+void Board_Debug_Init(void)
+{
+    /* Disables pullups/pulldowns and enable digitial mode */
+    Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 13, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+    Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 18, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
+
+    /* UART signal muxing via SWM */
+    Chip_SWM_MovablePortPinAssign(SWM_UART0_RXD_I, 0, 13);
+    Chip_SWM_MovablePortPinAssign(SWM_UART0_TXD_O, 0, 18);
+}
+
+#define MAXLEDS 3
+static const uint8_t ledpins[MAXLEDS] = {25, 3, 1};
+static const uint8_t ledports[MAXLEDS] = {0, 0, 1};
+
+/* Initializes board LED(s) */
+static void Board_LED_Init(void)
+{
+    int idx;
+
+    Chip_GPIO_Init(LPC_GPIO);
+
+    for (idx = 0; idx < MAXLEDS; idx++) {
+        /* Set the GPIO as output with initial state off (high) */
+        Chip_GPIO_SetPinDIROutput(LPC_GPIO, ledports[idx], ledpins[idx]);
+        Chip_GPIO_SetPinState(LPC_GPIO, ledports[idx], ledpins[idx], true);
+    }
+}
+
+/* Sets the state of a board LED to on or off */
+void Board_LED_Set(uint8_t LEDNumber, bool On)
+{
+    if (LEDNumber < MAXLEDS) {
+        /* Toggle state, low is on, high is off */
+        Chip_GPIO_SetPinState(LPC_GPIO, ledports[LEDNumber], ledpins[LEDNumber], !On);
+    }
+}
+
+/* Returns the current state of a board LED */
+bool Board_LED_Test(uint8_t LEDNumber)
+{
+    bool state = false;
+
+    if (LEDNumber < MAXLEDS) {
+        state = !Chip_GPIO_GetPinState(LPC_GPIO, ledports[LEDNumber], ledpins[LEDNumber]);
+    }
+
+    return state;
+}
+
+/* Toggles the current state of a board LED */
+void Board_LED_Toggle(uint8_t LEDNumber)
+{
+    Chip_GPIO_SetPinToggle(LPC_GPIO, ledports[LEDNumber], ledpins[LEDNumber]);
+}
+
+
+void target_early_init(void)
+{
+    Board_SetupMuxing();
+
+    Board_Debug_Init();
+    Board_LED_Init();
+}
+
+void target_init(void)
+{
+}
+
+void target_set_debug_led(unsigned int led, bool on)
+{
+    if (led < 3)
+        Board_LED_Set(led, on);
+}
+
+// vim: set ts=4 sw=4 expandtab:
diff --git a/src/bsp/lk/target/lpcexpresso1549/rules.mk b/src/bsp/lk/target/lpcexpresso1549/rules.mk
new file mode 100644
index 0000000..1dc5128
--- /dev/null
+++ b/src/bsp/lk/target/lpcexpresso1549/rules.mk
@@ -0,0 +1,14 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+PLATFORM := lpc15xx
+LPC_CHIP := LPC1549
+
+GLOBAL_DEFINES += \
+	TARGET_HAS_DEBUG_LED=1
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/lpclink2/init.c b/src/bsp/lk/target/lpclink2/init.c
new file mode 100644
index 0000000..f83bc4c
--- /dev/null
+++ b/src/bsp/lk/target/lpclink2/init.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015 Brian Swetland
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <reg.h>
+#include <debug.h>
+#include <printf.h>
+#include <kernel/thread.h>
+
+#include <platform/lpc43xx-gpio.h>
+
+void target_early_init(void)
+{
+	// UART2 on P2.10 (TX) and P2.11 (RX)
+	pin_config(PIN(2,10), PIN_MODE(2) | PIN_PLAIN);
+	pin_config(PIN(2,11), PIN_MODE(2) | PIN_PLAIN | PIN_INPUT);
+
+	// SPIFI
+	pin_config(PIN(3,3), PIN_MODE(3) | PIN_PLAIN); // SPIFI_SCK
+	pin_config(PIN(3,4), PIN_MODE(3) | PIN_PLAIN | PIN_INPUT); // SPIFI_SIO3
+	pin_config(PIN(3,5), PIN_MODE(3) | PIN_PLAIN | PIN_INPUT); // SPIFI_SIO2
+	pin_config(PIN(3,6), PIN_MODE(3) | PIN_PLAIN | PIN_INPUT); // SPIFI_MISO
+	pin_config(PIN(3,7), PIN_MODE(3) | PIN_PLAIN | PIN_INPUT); // SPIFI_MOSI
+	pin_config(PIN(3,8), PIN_MODE(3) | PIN_PLAIN); // SPIFI_CS
+}
+
+void target_init(void)
+{
+}
+
diff --git a/src/bsp/lk/target/lpclink2/rules.mk b/src/bsp/lk/target/lpclink2/rules.mk
new file mode 100644
index 0000000..3072234
--- /dev/null
+++ b/src/bsp/lk/target/lpclink2/rules.mk
@@ -0,0 +1,15 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+PLATFORM := lpc43xx
+
+GLOBAL_DEFINES += \
+	CRYSTAL_FREQ=12000000 \
+	TARGET_DEBUG_UART=3 \
+	TARGET_DEBUG_BAUDRATE=3000000
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c
+
+include make/module.mk
diff --git a/src/bsp/lk/target/lpcxpresso4337/init.c b/src/bsp/lk/target/lpcxpresso4337/init.c
new file mode 100644
index 0000000..a6f0037
--- /dev/null
+++ b/src/bsp/lk/target/lpcxpresso4337/init.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015 Brian Swetland
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <reg.h>
+#include <debug.h>
+
+#include <platform/lpc43xx-gpio.h>
+
+void target_early_init(void)
+{
+	// UART1 on P6.4 (TX) and P2.1 (RX)
+	// LpcXpresso4337 P4 FTDI header
+	pin_config(PIN(6,4), PIN_MODE(2) | PIN_PLAIN);
+	pin_config(PIN(2,1), PIN_MODE(1) | PIN_PLAIN | PIN_INPUT);
+}
+
+void target_init(void)
+{
+}
+
diff --git a/src/bsp/lk/target/lpcxpresso4337/rules.mk b/src/bsp/lk/target/lpcxpresso4337/rules.mk
new file mode 100644
index 0000000..1e77f4a
--- /dev/null
+++ b/src/bsp/lk/target/lpcxpresso4337/rules.mk
@@ -0,0 +1,15 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+PLATFORM := lpc43xx
+
+GLOBAL_DEFINES += \
+	CRYSTAL_FREQ=12000000 \
+	TARGET_DEBUG_UART=1 \
+	TARGET_DEBUG_BAUDRATE=3000000
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c
+
+include make/module.mk
diff --git a/src/bsp/lk/target/nrf-pca10000/include/target/debugconfig.h b/src/bsp/lk/target/nrf-pca10000/include/target/debugconfig.h
new file mode 100644
index 0000000..88ffe5f
--- /dev/null
+++ b/src/bsp/lk/target/nrf-pca10000/include/target/debugconfig.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+#define DEBUG_UART 1
+
+#endif
diff --git a/src/bsp/lk/target/nrf-pca10000/include/target/gpioconfig.h b/src/bsp/lk/target/nrf-pca10000/include/target/gpioconfig.h
new file mode 100644
index 0000000..c7b3a40
--- /dev/null
+++ b/src/bsp/lk/target/nrf-pca10000/include/target/gpioconfig.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_GPIOCONFIG_H
+#define __TARGET_GPIOCONFIG_H
+
+#include <platform/gpio.h>
+
+#define GPIO_LED1   21
+#define GPIO_LED2   22
+#define GPIO_LED3   23
+
+#define UART0_RTS_PIN   8
+#define UART0_TX_PIN    9
+#define UART0_RX_PIN    11
+
+
+
+#endif
diff --git a/src/bsp/lk/target/nrf-pca10000/init.c b/src/bsp/lk/target/nrf-pca10000/init.c
new file mode 100644
index 0000000..4b62ea7
--- /dev/null
+++ b/src/bsp/lk/target/nrf-pca10000/init.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/gpio.h>
+#include <kernel/timer.h>
+#include <platform/gpio.h>
+#include <platform/nrf51.h>
+#include <target/gpioconfig.h>
+
+
+static timer_t  blinktimer;
+static bool heartbeat = false;
+
+void target_early_init(void)
+{
+    NRF_CLOCK->XTALFREQ = CLOCK_XTALFREQ_XTALFREQ_16MHz;
+
+	/* configure the usart1 pins */
+	gpio_config(GPIO_LED1, GPIO_OUTPUT);
+    gpio_config(GPIO_LED2, GPIO_OUTPUT);
+    gpio_config(GPIO_LED3, GPIO_OUTPUT);
+
+	gpio_set(GPIO_LED1,1);
+	gpio_set(GPIO_LED2,1);
+	gpio_set(GPIO_LED3,1);
+
+    gpio_config(UART0_RTS_PIN, GPIO_OUTPUT);
+    gpio_set(UART0_RTS_PIN,0);              //placate flow control requirements of pca10000
+
+	nrf51_debug_early_init();
+}
+
+static enum handler_return blinker(timer_t * timer, lk_time_t now, void * args){
+
+    if (heartbeat) {
+        heartbeat = false;
+        gpio_set(GPIO_LED1,1); //turn off led
+        timer_set_oneshot(timer,950, blinker, NULL);
+    } else {
+        heartbeat = true;
+        gpio_set(GPIO_LED1,0);
+        timer_set_oneshot(timer,50, blinker, NULL);
+    }
+    return INT_RESCHEDULE;
+}
+
+
+
+
+void target_init(void)
+{
+	nrf51_debug_init();
+    dprintf(SPEW,"Target: PCA10000 DK...\n");
+    timer_initialize(&blinktimer);
+    timer_set_oneshot(&blinktimer, 1000, blinker, NULL);
+}
diff --git a/src/bsp/lk/target/nrf-pca10000/rules.mk b/src/bsp/lk/target/nrf-pca10000/rules.mk
new file mode 100644
index 0000000..60af85a
--- /dev/null
+++ b/src/bsp/lk/target/nrf-pca10000/rules.mk
@@ -0,0 +1,17 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+NRF51_CHIP := nrf51822-qfaa
+
+PLATFORM := nrf51xxx
+
+GLOBAL_DEFINES += \
+	ENABLE_UART0=1 \
+	
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/nrf-pca10028/include/target/debugconfig.h b/src/bsp/lk/target/nrf-pca10028/include/target/debugconfig.h
new file mode 100644
index 0000000..88ffe5f
--- /dev/null
+++ b/src/bsp/lk/target/nrf-pca10028/include/target/debugconfig.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+#define DEBUG_UART 1
+
+#endif
diff --git a/src/bsp/lk/target/nrf-pca10028/include/target/gpioconfig.h b/src/bsp/lk/target/nrf-pca10028/include/target/gpioconfig.h
new file mode 100644
index 0000000..208a043
--- /dev/null
+++ b/src/bsp/lk/target/nrf-pca10028/include/target/gpioconfig.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_GPIOCONFIG_H
+#define __TARGET_GPIOCONFIG_H
+
+#include <platform/gpio.h>
+
+#define GPIO_LED1   21
+#define GPIO_LED2   22
+#define GPIO_LED3   23
+#define GPIO_LED4   24
+
+#define UART0_TX_PIN    9
+#define UART0_RX_PIN    11
+
+
+
+#endif
diff --git a/src/bsp/lk/target/nrf-pca10028/init.c b/src/bsp/lk/target/nrf-pca10028/init.c
new file mode 100644
index 0000000..6435e77
--- /dev/null
+++ b/src/bsp/lk/target/nrf-pca10028/init.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/gpio.h>
+#include <platform/gpio.h>
+#include <platform/nrf51.h>
+#include <target/gpioconfig.h>
+
+void target_early_init(void)
+{
+	/* configure the usart1 pins */
+	gpio_config(GPIO_LED1, GPIO_OUTPUT);
+    gpio_config(GPIO_LED2, GPIO_OUTPUT);
+    gpio_config(GPIO_LED3, GPIO_OUTPUT);
+    gpio_config(GPIO_LED4, GPIO_OUTPUT);
+
+	gpio_set(GPIO_LED1,1);
+	gpio_set(GPIO_LED2,1);
+	gpio_set(GPIO_LED3,0);
+	gpio_set(GPIO_LED4,0);
+
+	nrf51_debug_early_init();
+}
+
+
+void target_init(void)
+{
+	nrf51_debug_init();
+    dprintf(SPEW,"Target: PCA10028 DK...\n");
+}
diff --git a/src/bsp/lk/target/nrf-pca10028/rules.mk b/src/bsp/lk/target/nrf-pca10028/rules.mk
new file mode 100644
index 0000000..4008dbb
--- /dev/null
+++ b/src/bsp/lk/target/nrf-pca10028/rules.mk
@@ -0,0 +1,17 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+NRF51_CHIP := nrf51822-qfac
+
+PLATFORM := nrf51xxx
+
+GLOBAL_DEFINES += \
+	ENABLE_UART0=1 \
+	
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/or1ksim/include/target/debugconfig.h b/src/bsp/lk/target/or1ksim/include/target/debugconfig.h
new file mode 100644
index 0000000..554bdc1
--- /dev/null
+++ b/src/bsp/lk/target/or1ksim/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/or1ksim/rules.mk b/src/bsp/lk/target/or1ksim/rules.mk
new file mode 100644
index 0000000..079955f
--- /dev/null
+++ b/src/bsp/lk/target/or1ksim/rules.mk
@@ -0,0 +1,11 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+GLOBAL_INCLUDES += \
+	$(LOCAL_DIR)/include
+
+PLATFORM := or1ksim
+
+MEMBASE ?= 0x00000000
+MEMSIZE ?= 0x02000000
+
+#include make/module.mk
diff --git a/src/bsp/lk/target/pc-x86/config.c b/src/bsp/lk/target/pc-x86/config.c
new file mode 100644
index 0000000..b91020e
--- /dev/null
+++ b/src/bsp/lk/target/pc-x86/config.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2012 Corey Tabaka
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <dev/driver.h>
+#include <dev/class/block.h>
+#include <dev/class/netif.h>
+#include <platform/uart.h>
+#include <platform/ide.h>
+#include <platform/pcnet.h>
+#include <platform.h>
+#include <malloc.h>
+#include <string.h>
+#include <debug.h>
+
+#ifndef ARCH_X86_64
+#include <ffs.h>
+#endif
+
+#define LOCAL_TRACE 1
+
+static const struct platform_uart_config uart0_config = {
+	.io_port = 0x3f8,
+	.irq = 0x24,
+	.baud_rate = 115200,
+	.rx_buf_len = 1024,
+	.tx_buf_len = 1024,
+};
+
+DEVICE_INSTANCE(uart, uart0, &uart0_config);
+
+#ifndef ARCH_X86_64
+static const struct platform_ide_config ide0_config = {
+};
+
+DEVICE_INSTANCE(ide, ide0, &ide0_config);
+
+#endif
+
+void target_init(void) {
+	//device_init_all();
+#ifndef ARCH_X86_64
+
+	device_init(device_get_by_name(ide, ide0));
+	ffs_mount(0, device_get_by_name(ide, ide0));
+#endif
+}
+
diff --git a/src/bsp/lk/target/pc-x86/rules.mk b/src/bsp/lk/target/pc-x86/rules.mk
new file mode 100644
index 0000000..3b38fd7
--- /dev/null
+++ b/src/bsp/lk/target/pc-x86/rules.mk
@@ -0,0 +1,17 @@
+# mostly null target configuration for pc-x86
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+PLATFORM := pc
+ifneq ($(ARCH), x86-64)
+MODULE_DEPS := \
+	lib/ffs \
+
+endif
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/config.c \
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/qemu-m4/include/target/debugconfig.h b/src/bsp/lk/target/qemu-m4/include/target/debugconfig.h
new file mode 100644
index 0000000..4a2b79d
--- /dev/null
+++ b/src/bsp/lk/target/qemu-m4/include/target/debugconfig.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+// UART 3 is the console
+#define DEBUG_UART 3
+
+#endif
diff --git a/src/bsp/lk/target/qemu-m4/include/target/m4display.h b/src/bsp/lk/target/qemu-m4/include/target/m4display.h
new file mode 100644
index 0000000..e51fd28
--- /dev/null
+++ b/src/bsp/lk/target/qemu-m4/include/target/m4display.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015 Gurjant Kalsi <me@gurjantkalsi.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+void init_display(void);
diff --git a/src/bsp/lk/target/qemu-m4/init.c b/src/bsp/lk/target/qemu-m4/init.c
new file mode 100644
index 0000000..c0bb36f
--- /dev/null
+++ b/src/bsp/lk/target/qemu-m4/init.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <trace.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/gpio.h>
+#include <stm32f4xx_usart.h>
+#include <stm32f4xx_rcc.h>
+#include <stm32f4xx_gpio.h>
+#include <platform/stm32.h>
+#include <platform/gpio.h>
+#include <target/debugconfig.h>
+#include <target/m4display.h>
+
+void target_early_init(void)
+{
+    stm32_debug_early_init();
+}
+
+void target_init(void)
+{
+    TRACE_ENTRY;
+
+    stm32_debug_init();
+
+    init_display();
+
+    TRACE_EXIT;
+}
\ No newline at end of file
diff --git a/src/bsp/lk/target/qemu-m4/m4display.c b/src/bsp/lk/target/qemu-m4/m4display.c
new file mode 100644
index 0000000..c038dfe
--- /dev/null
+++ b/src/bsp/lk/target/qemu-m4/m4display.c
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2015 Gurjant Kalsi <me@gurjantkalsi.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <target/m4display.h>
+
+#include <stdio.h>
+#include <trace.h>
+#include <err.h>
+
+#include <stm32f4xx.h>
+#include <stm32f4xx_spi.h>
+#include <stm32f4xx_gpio.h>
+#include <stm32f4xx_rcc.h>
+
+#include <dev/display.h>
+#include <dev/gpio.h>
+#include <lib/gfx.h>
+#include <platform/gpio.h>
+
+#define LOCAL_TRACE 0
+
+#define CMD_DISPLAY_NULL        0x00
+#define CMD_DISPLAY_SET_PARAM   0x01
+#define CMD_DISPLAY_OFF         0x02
+#define CMD_DISPLAY_ON          0x03
+#define CMD_DISPLAY_DRAW_SCENE  0x04
+#define CMD_DISPLAY_FRAME_BEGIN 0x05
+
+#define SCENE_BLACK  0x00
+#define SCENE_SPLASH 0x01
+#define SCENE_UPDATE 0x02
+#define SCENE_ERROR  0x03
+
+#define M4DISPLAY_WIDTH  180
+#define M4DISPLAY_HEIGHT 180
+
+static uint8_t framebuffer[M4DISPLAY_HEIGHT][M4DISPLAY_WIDTH];
+
+static const char programming_header[] = "  Lattice\0iCEcube2 2014.08.26723\0Part: iCE40LP1K-CM36\0Date: Jan 30 2015 15:11:";
+
+static void chip_select(bool val)
+{
+    if (val) {
+        gpio_set(GPIO(GPIO_PORT_G, 8), true);
+    } else {
+        gpio_set(GPIO(GPIO_PORT_G, 8), false);
+    }
+}
+
+static void reset(bool val)
+{
+    if (val) {
+        gpio_set(GPIO(GPIO_PORT_G, 15), true);
+    } else {
+        gpio_set(GPIO(GPIO_PORT_G, 15), false);
+    }
+}
+
+static void setup_pins(void)
+{
+
+    GPIO_InitTypeDef GPIO_InitStruct;
+
+    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);
+
+    GPIO_InitStruct.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_6 | GPIO_Pin_5;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF;
+    GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
+    GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
+    GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
+    GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+    // connect SPI6 pins to SPI alternate function
+    GPIO_PinAFConfig(GPIOA, GPIO_PinSource5, GPIO_AF_SPI6);
+    GPIO_PinAFConfig(GPIOA, GPIO_PinSource6, GPIO_AF_SPI6);
+    GPIO_PinAFConfig(GPIOA, GPIO_PinSource7, GPIO_AF_SPI6);
+
+    // enable clock for used IO pins
+    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);
+
+    /* Configure the chip select pin
+       in this case we will use PE7 */
+    GPIO_InitStruct.GPIO_Pin = GPIO_Pin_8;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
+    GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
+    GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
+    GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;
+    GPIO_Init(GPIOG, &GPIO_InitStruct);
+
+    GPIOE->BSRRL |= GPIO_Pin_7; // set PE7 high
+
+    // Setup display CS Pin
+    gpio_config(GPIO(GPIO_PORT_G, 8), GPIO_OUTPUT);
+
+    // Setup display reset pin
+    gpio_config(GPIO(GPIO_PORT_G, 15), GPIO_OUTPUT);
+
+    // enable peripheral clock
+    RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI6, ENABLE);
+}
+
+void init_display(void)
+{
+    // Setting up pins.
+    setup_pins();
+
+    SPI_InitTypeDef init_struct;
+
+    init_struct.SPI_Direction           = SPI_Direction_1Line_Tx;
+    init_struct.SPI_Mode                = SPI_Mode_Master;
+    init_struct.SPI_DataSize            = SPI_DataSize_8b;
+    init_struct.SPI_CPOL                = SPI_CPOL_Low;
+    init_struct.SPI_CPHA                = SPI_CPHA_1Edge;
+    init_struct.SPI_NSS                 = SPI_NSS_Hard;
+    init_struct.SPI_BaudRatePrescaler   = SPI_BaudRatePrescaler_8;
+    init_struct.SPI_FirstBit            = SPI_FirstBit_MSB;
+
+    SPI_Init(SPI6, &init_struct);
+
+    SPI_Cmd(SPI6, ENABLE); // enable SPI6
+
+    chip_select(true);
+    reset(true);
+    chip_select(false);
+
+    const uint8_t draw_splash_cmds[] = { 0x04, 0x01 };
+
+    for (size_t i = 0; i < countof(draw_splash_cmds); i++) {
+        SPI_I2S_SendData(SPI6, draw_splash_cmds[i]);
+    }
+
+    chip_select(true);
+    chip_select(false);
+
+    uint8_t enable_display_cmds[] = { 0x03 };
+
+    for (size_t i = 0; i < countof(enable_display_cmds); i++) {
+        SPI_I2S_SendData(SPI6, enable_display_cmds[i]);
+    }
+
+    chip_select(true);
+    reset(false);
+    chip_select(false);
+    reset(true);
+
+
+    for (size_t i = 0; i < countof(programming_header); i++) {
+        SPI_I2S_SendData(SPI6, programming_header[i]);
+    }
+
+    chip_select(true);
+}
+
+static void s4lcd_flush(uint starty, uint endy)
+{
+
+    chip_select(false);
+
+    uint8_t frame_begin_cmd[] = { 0x05 };
+
+    for (size_t i = 0; i < countof(frame_begin_cmd); i++) {
+        SPI_I2S_SendData(SPI6, frame_begin_cmd[i]);
+    }
+
+    size_t msb_idx = M4DISPLAY_WIDTH / 2;
+
+    uint8_t scramble_buf[M4DISPLAY_WIDTH];
+    for (int i = 0; i < M4DISPLAY_HEIGHT; i++) {
+        uint8_t *lsb = scramble_buf;
+        uint8_t *msb = &(scramble_buf[msb_idx]);
+        for (int j = 0; j < M4DISPLAY_WIDTH; j += 2) {
+
+            *msb++ = ((framebuffer[i][j] & 0b01010100) | ((framebuffer[i][j+1] & 0b01010100) << 1)) >> 2;
+            *lsb++ = ((framebuffer[i][j] & 0b10101000) | ((framebuffer[i][j+1] & 0b10101000) >> 1)) >> 2;
+        }
+
+        for (int j = 0; j < M4DISPLAY_WIDTH; j++) {
+            SPI_I2S_SendData(SPI6, scramble_buf[j]);
+        }
+    }
+
+    chip_select(true);
+}
+
+status_t display_get_info(struct display_info *info)
+{
+    LTRACEF("display_info %p\n", info);
+
+    info->framebuffer = (void *)framebuffer;
+    info->format = GFX_FORMAT_RGB_2220;
+    info->width = M4DISPLAY_WIDTH;
+    info->height = M4DISPLAY_HEIGHT;
+    info->stride = M4DISPLAY_WIDTH;
+    info->flush = s4lcd_flush;
+
+    return NO_ERROR;
+}
diff --git a/src/bsp/lk/target/qemu-m4/rules.mk b/src/bsp/lk/target/qemu-m4/rules.mk
new file mode 100644
index 0000000..253c56d
--- /dev/null
+++ b/src/bsp/lk/target/qemu-m4/rules.mk
@@ -0,0 +1,26 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+STM32_CHIP := stm32f407
+
+PLATFORM := stm32f4xx
+
+GLOBAL_DEFINES += \
+	ENABLE_UART2=1 \
+	ENABLE_UART3=1 \
+	HSE_VALUE=8000000 \
+	PLL_M_VALUE=8 \
+	PLL_N_VALUE=336 \
+	PLL_P_VALUE=2 \
+    PKTBUF_POOL_SIZE=16
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c \
+	$(LOCAL_DIR)/m4display.c
+
+MODULE_DEPS += \
+    lib/gfx
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/qemu-microblaze/include/target/debugconfig.h b/src/bsp/lk/target/qemu-microblaze/include/target/debugconfig.h
new file mode 100644
index 0000000..554bdc1
--- /dev/null
+++ b/src/bsp/lk/target/qemu-microblaze/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/qemu-microblaze/include/target/microblaze-config.h b/src/bsp/lk/target/qemu-microblaze/include/target/microblaze-config.h
new file mode 100644
index 0000000..653dd31
--- /dev/null
+++ b/src/bsp/lk/target/qemu-microblaze/include/target/microblaze-config.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+/* qemu emulates a petalogix s3adsp1800 */
+#define LMB_BRAM_SIZE       (128 * 1024)
+#define FLASH_SIZE          (16 * 1024 * 1024)
+
+#define ETHLITE_BASEADDR    0x81000000
+#define INTC_BASEADDR       0x81800000
+#define TIMER_BASEADDR      0x83c00000
+#define UARTLITE_BASEADDR   0x84000000
+#define MEMORY_BASEADDR     0x90000000
+#define FLASH_BASEADDR      0xa0000000
+
+#define TIMER_IRQ           0
+#define ETHLITE_IRQ         1
+#define UARTLITE_IRQ        3
+#define MAX_INT             4
+
+#define TIMER_RATE (62*1000000)
+
diff --git a/src/bsp/lk/target/qemu-microblaze/rules.mk b/src/bsp/lk/target/qemu-microblaze/rules.mk
new file mode 100644
index 0000000..191ee1c
--- /dev/null
+++ b/src/bsp/lk/target/qemu-microblaze/rules.mk
@@ -0,0 +1,12 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+GLOBAL_INCLUDES += \
+	$(LOCAL_DIR)/include
+
+PLATFORM := microblaze
+
+MEMBASE ?= 0x90000000
+MEMSIZE ?= 0x08000000
+
+#include make/module.mk
+
diff --git a/src/bsp/lk/target/qemu-mips/include/target/debugconfig.h b/src/bsp/lk/target/qemu-mips/include/target/debugconfig.h
new file mode 100644
index 0000000..554bdc1
--- /dev/null
+++ b/src/bsp/lk/target/qemu-mips/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/qemu-mips/rules.mk b/src/bsp/lk/target/qemu-mips/rules.mk
new file mode 100644
index 0000000..365388c
--- /dev/null
+++ b/src/bsp/lk/target/qemu-mips/rules.mk
@@ -0,0 +1,9 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+GLOBAL_INCLUDES += \
+	$(LOCAL_DIR)/include
+
+PLATFORM := qemu-mips
+
+#include make/module.mk
+
diff --git a/src/bsp/lk/target/qemu-virt/include/target/debugconfig.h b/src/bsp/lk/target/qemu-virt/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/qemu-virt/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/qemu-virt/rules.mk b/src/bsp/lk/target/qemu-virt/rules.mk
new file mode 100644
index 0000000..a8d0af1
--- /dev/null
+++ b/src/bsp/lk/target/qemu-virt/rules.mk
@@ -0,0 +1,9 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+PLATFORM := qemu-virt
+
+#include make/module.mk
+
diff --git a/src/bsp/lk/target/rpi2/rules.mk b/src/bsp/lk/target/rpi2/rules.mk
new file mode 100644
index 0000000..fe10d50
--- /dev/null
+++ b/src/bsp/lk/target/rpi2/rules.mk
@@ -0,0 +1,9 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+GLOBAL_INCLUDES += \
+	$(LOCAL_DIR)/include
+
+PLATFORM := bcm28xx
+
+#include make/module.mk
+
diff --git a/src/bsp/lk/target/rpi3/rules.mk b/src/bsp/lk/target/rpi3/rules.mk
new file mode 100644
index 0000000..fe10d50
--- /dev/null
+++ b/src/bsp/lk/target/rpi3/rules.mk
@@ -0,0 +1,9 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+GLOBAL_INCLUDES += \
+	$(LOCAL_DIR)/include
+
+PLATFORM := bcm28xx
+
+#include make/module.mk
+
diff --git a/src/bsp/lk/target/rules.mk b/src/bsp/lk/target/rules.mk
new file mode 100644
index 0000000..0905d1b
--- /dev/null
+++ b/src/bsp/lk/target/rules.mk
@@ -0,0 +1,9 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/sam3x-ek/include/target/debugconfig.h b/src/bsp/lk/target/sam3x-ek/include/target/debugconfig.h
new file mode 100644
index 0000000..374ebbb
--- /dev/null
+++ b/src/bsp/lk/target/sam3x-ek/include/target/debugconfig.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+//#include <stm32f10x_usart.h>
+
+//#define DEBUG_UART USART3
+//#define DEBUG_UART_IRQ USART3_IRQn
+
+#endif
diff --git a/src/bsp/lk/target/sam3x-ek/init.c b/src/bsp/lk/target/sam3x-ek/init.c
new file mode 100644
index 0000000..9ffc24d
--- /dev/null
+++ b/src/bsp/lk/target/sam3x-ek/init.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <trace.h>
+#include <target.h>
+#include <compiler.h>
+
+void target_early_init(void)
+{
+#if 0
+	/* configure the usart3 pins */
+	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);
+	RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
+
+	GPIO_PinRemapConfig(GPIO_FullRemap_USART3, ENABLE);
+
+	GPIO_InitTypeDef init;
+	init.GPIO_Pin = GPIO_Pin_8;
+	init.GPIO_Speed = GPIO_Speed_50MHz;
+	init.GPIO_Mode = GPIO_Mode_AF_PP;
+	GPIO_Init(GPIOD, &init);
+
+	init.GPIO_Pin = GPIO_Pin_9;
+	init.GPIO_Speed = GPIO_Speed_50MHz;
+	init.GPIO_Mode = GPIO_Mode_IN_FLOATING;
+	GPIO_Init(GPIOD, &init);
+
+	stm32_debug_early_init();
+#endif
+}
+
+void target_init(void)
+{
+	TRACE_ENTRY;
+
+#if 0
+	stm32_debug_init();
+#endif
+
+	TRACE_EXIT;
+}
+
diff --git a/src/bsp/lk/target/sam3x-ek/rules.mk b/src/bsp/lk/target/sam3x-ek/rules.mk
new file mode 100644
index 0000000..d57459a
--- /dev/null
+++ b/src/bsp/lk/target/sam3x-ek/rules.mk
@@ -0,0 +1,12 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+SAM_CHIP := sam3x8h
+PLATFORM := sam3
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/stellaris-launchpad/include/target/debugconfig.h b/src/bsp/lk/target/stellaris-launchpad/include/target/debugconfig.h
new file mode 100644
index 0000000..374ebbb
--- /dev/null
+++ b/src/bsp/lk/target/stellaris-launchpad/include/target/debugconfig.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+//#include <stm32f10x_usart.h>
+
+//#define DEBUG_UART USART3
+//#define DEBUG_UART_IRQ USART3_IRQn
+
+#endif
diff --git a/src/bsp/lk/target/stellaris-launchpad/init.c b/src/bsp/lk/target/stellaris-launchpad/init.c
new file mode 100644
index 0000000..a1ac9d2
--- /dev/null
+++ b/src/bsp/lk/target/stellaris-launchpad/init.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2012 Ian McKellar
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/gpio.h>
+#include <platform/gpio.h>
+
+#include "ti_driverlib.h"
+
+extern void target_usb_setup(void);
+
+void target_early_init(void)
+{
+	GPIOPinWrite(GPIO_PORTF_AHB_BASE, GPIO_PIN_1, 0);
+	GPIOPinWrite(GPIO_PORTF_AHB_BASE, GPIO_PIN_2, 0);
+	GPIOPinWrite(GPIO_PORTF_AHB_BASE, GPIO_PIN_3, 0);
+
+	GPIOPadConfigSet(GPIO_PORTF_AHB_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
+	GPIOPadConfigSet(GPIO_PORTF_AHB_BASE, GPIO_PIN_2, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
+	GPIOPadConfigSet(GPIO_PORTF_AHB_BASE, GPIO_PIN_3, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
+	GPIODirModeSet(GPIO_PORTF_AHB_BASE, GPIO_PIN_1, GPIO_DIR_MODE_OUT);
+	GPIODirModeSet(GPIO_PORTF_AHB_BASE, GPIO_PIN_2, GPIO_DIR_MODE_OUT);
+	GPIODirModeSet(GPIO_PORTF_AHB_BASE, GPIO_PIN_3, GPIO_DIR_MODE_OUT);
+}
+
+void target_init(void)
+{
+	target_usb_setup();
+}
+
+void target_set_debug_led(unsigned int led, bool on)
+{
+	switch (led) {
+		case 0: gpio_set(GPIO(GPIO_PORT_F, 1), on); break;
+		case 1: gpio_set(GPIO(GPIO_PORT_F, 2), on); break;
+		case 2: gpio_set(GPIO(GPIO_PORT_F, 3), on); break;
+	}
+}
+
+// vim: set ts=4 sw=4 noexpandtab:
diff --git a/src/bsp/lk/target/stellaris-launchpad/rules.mk b/src/bsp/lk/target/stellaris-launchpad/rules.mk
new file mode 100644
index 0000000..3d24fa6
--- /dev/null
+++ b/src/bsp/lk/target/stellaris-launchpad/rules.mk
@@ -0,0 +1,15 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+STELLARIS_CHIP := LM4F120H5QR
+PLATFORM := stellaris
+
+GLOBAL_DEFINES += \
+	TARGET_HAS_DEBUG_LED=1
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c \
+	$(LOCAL_DIR)/usb.c \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/stellaris-launchpad/usb.c b/src/bsp/lk/target/stellaris-launchpad/usb.c
new file mode 100644
index 0000000..cce349b
--- /dev/null
+++ b/src/bsp/lk/target/stellaris-launchpad/usb.c
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2013 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <stdio.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/usb.h>
+#include <hw/usb.h>
+#include <lk/init.h>
+
+#define W(w) (w & 0xff), (w >> 8)
+#define W3(w) (w & 0xff), ((w >> 8) & 0xff), ((w >> 16) & 0xff)
+
+/* top level device descriptor */
+static const uint8_t dev_descr[] = {
+    0x12,           /* descriptor length */
+    DEVICE,         /* Device Descriptor type */
+    W(0x0200),      /* USB Version */
+    0xff,           /* class */
+    0xff,           /* subclass */
+    0xff,           /* protocol */
+    64,             /* max packet size, ept0 */
+    W(0x9999),      /* vendor */
+    W(0x9999),      /* product */
+    W(0x9999),      /* release */
+    0x0,            /* manufacturer string */
+    0x0,            /* product string */
+    0x0,            /* serialno string */
+    0x1,            /* num configs */
+};
+
+/* high/low speed device qualifier */
+static const uint8_t devqual_descr[] = {
+    0x0a,           /* len */
+    DEVICE_QUALIFIER, /* Device Qualifier type */
+    W(0x0200),      /* USB version */
+    0x00,           /* class */
+    0x00,           /* subclass */
+    0x00,           /* protocol */
+    64,             /* max packet size, ept0 */
+    0x01,           /* num configs */
+    0x00            /* reserved */
+};
+
+static const uint8_t cfg_descr[] = {
+    0x09,           /* Length of Cfg Descr */
+    CONFIGURATION,  /* Type of Cfg Descr */
+    W(0x09),        /* Total Length (incl ifc, ept) */
+    0x00,           /* # Interfaces */
+    0x01,           /* Cfg Value */
+    0x00,           /* Cfg String */
+    0xc0,           /* Attributes -- self powered */
+    250,            /* Power Consumption - 500mA */
+};
+
+static const uchar langid[] = { 0x04, 0x03, 0x09, 0x04 };
+
+static const uint8_t if_descriptor_lowspeed[] = {
+    0x09,           /* length */
+    INTERFACE,      /* type */
+    0x01,           /* interface num */
+    0x00,           /* alternates */
+    0x02,           /* endpoint count */
+    0xff,           /* interface class */
+    0xff,           /* interface subclass */
+    0x00,           /* interface protocol */
+    0x00,           /* string index */
+
+    /* endpoint 1 IN */
+    0x07,           /* length */
+    ENDPOINT,       /* type */
+    0x81,           /* address: 1 IN */
+    0x02,           /* type: bulk */
+    W(64),          /* max packet size: 64 */
+    00,             /* interval */
+
+    /* endpoint 1 OUT */
+    0x07,           /* length */
+    ENDPOINT,       /* type */
+    0x01,           /* address: 1 OUT */
+    0x02,           /* type: bulk */
+    W(64),          /* max packet size: 64 */
+    00,             /* interval */
+};
+
+usb_config config = {
+    .lowspeed = {
+        .device = USB_DESC_STATIC(dev_descr),
+        .device_qual = USB_DESC_STATIC(devqual_descr),
+        .config = USB_DESC_STATIC(cfg_descr),
+    },
+    .highspeed = {
+        .device = USB_DESC_STATIC(dev_descr),
+        .device_qual = USB_DESC_STATIC(devqual_descr),
+        .config = USB_DESC_STATIC(cfg_descr),
+    },
+
+    .langid = USB_DESC_STATIC(langid),
+};
+
+void target_usb_setup(void)
+{
+    usb_setup(&config);
+    printf("appending interfaces\n");
+    usb_append_interface_lowspeed(if_descriptor_lowspeed, sizeof(if_descriptor_lowspeed));
+    usb_append_interface_highspeed(if_descriptor_lowspeed, sizeof(if_descriptor_lowspeed));
+
+    usb_start();
+}
+
+// vim: set ts=4 sw=4 expandtab:
diff --git a/src/bsp/lk/target/stm32-h103/include/target/debugconfig.h b/src/bsp/lk/target/stm32-h103/include/target/debugconfig.h
new file mode 100644
index 0000000..88ffe5f
--- /dev/null
+++ b/src/bsp/lk/target/stm32-h103/include/target/debugconfig.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+#define DEBUG_UART 1
+
+#endif
diff --git a/src/bsp/lk/target/stm32-h103/include/target/gpioconfig.h b/src/bsp/lk/target/stm32-h103/include/target/gpioconfig.h
new file mode 100644
index 0000000..abaa77d
--- /dev/null
+++ b/src/bsp/lk/target/stm32-h103/include/target/gpioconfig.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_GPIOCONFIG_H
+#define __TARGET_GPIOCONFIG_H
+
+#include <platform/gpio.h>
+
+#define GPIO_LED0 GPIO(GPIO_PORT_C, 12)
+
+#endif
diff --git a/src/bsp/lk/target/stm32-h103/init.c b/src/bsp/lk/target/stm32-h103/init.c
new file mode 100644
index 0000000..db2a551
--- /dev/null
+++ b/src/bsp/lk/target/stm32-h103/init.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/gpio.h>
+#include <platform/gpio.h>
+#include <stm32f10x_usart.h>
+#include <stm32f10x_rcc.h>
+#include <stm32f10x_gpio.h>
+#include <stm32f10x_flash.h>
+#include <stm32f10x_dbgmcu.h>
+#include <platform/stm32.h>
+#include <target/gpioconfig.h>
+
+void target_early_init(void)
+{
+	/* configure the usart1 pins */
+	gpio_config(GPIO(GPIO_PORT_A, 9), GPIO_STM32_AF);
+	gpio_config(GPIO(GPIO_PORT_A, 10), GPIO_INPUT);
+
+	stm32_debug_early_init();
+
+	/* configure some status leds */
+	gpio_set(GPIO_LED0, 1);
+
+	gpio_config(GPIO_LED0, GPIO_OUTPUT);
+}
+
+void target_init(void)
+{
+	stm32_debug_init();
+}
+
+void target_set_debug_led(unsigned int led, bool on)
+{
+	switch (led) {
+		case 0:
+			gpio_set(GPIO_LED0, !on);
+			break;
+	}
+}
+
diff --git a/src/bsp/lk/target/stm32-h103/rules.mk b/src/bsp/lk/target/stm32-h103/rules.mk
new file mode 100644
index 0000000..2baf4cd
--- /dev/null
+++ b/src/bsp/lk/target/stm32-h103/rules.mk
@@ -0,0 +1,17 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+STM32_CHIP := stm32f103_md
+
+PLATFORM := stm32f1xx
+
+GLOBAL_DEFINES += \
+	ENABLE_UART1=1 \
+	TARGET_HAS_DEBUG_LED=1
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/stm32-p107/include/target/debugconfig.h b/src/bsp/lk/target/stm32-p107/include/target/debugconfig.h
new file mode 100644
index 0000000..af7c27a
--- /dev/null
+++ b/src/bsp/lk/target/stm32-p107/include/target/debugconfig.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+#define DEBUG_UART 3
+
+#endif
diff --git a/src/bsp/lk/target/stm32-p107/include/target/gpioconfig.h b/src/bsp/lk/target/stm32-p107/include/target/gpioconfig.h
new file mode 100644
index 0000000..29430a9
--- /dev/null
+++ b/src/bsp/lk/target/stm32-p107/include/target/gpioconfig.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_GPIOCONFIG_H
+#define __TARGET_GPIOCONFIG_H
+
+#include <platform/gpio.h>
+
+#define GPIO_LED0 GPIO(GPIO_PORT_C, 6)
+#define GPIO_LED1 GPIO(GPIO_PORT_C, 7)
+
+#endif
diff --git a/src/bsp/lk/target/stm32-p107/init.c b/src/bsp/lk/target/stm32-p107/init.c
new file mode 100644
index 0000000..3b5807b
--- /dev/null
+++ b/src/bsp/lk/target/stm32-p107/init.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <trace.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/gpio.h>
+#include <stm32f10x_usart.h>
+#include <stm32f10x_rcc.h>
+#include <stm32f10x_gpio.h>
+#include <stm32f10x_flash.h>
+#include <stm32f10x_dbgmcu.h>
+#include <platform/stm32.h>
+#include <platform/gpio.h>
+#include <target/gpioconfig.h>
+
+void target_early_init(void)
+{
+	/* configure the usart3 pins */
+	GPIO_PinRemapConfig(GPIO_FullRemap_USART3, ENABLE);
+
+	gpio_config(GPIO(GPIO_PORT_D, 8), GPIO_STM32_AF);
+	gpio_config(GPIO(GPIO_PORT_D, 9), GPIO_INPUT);
+
+	stm32_debug_early_init();
+
+	/* configure some status leds */
+	gpio_set(GPIO_LED0, 0);
+	gpio_set(GPIO_LED1, 0);
+
+	gpio_config(GPIO_LED0, GPIO_OUTPUT);
+	gpio_config(GPIO_LED1, GPIO_OUTPUT);
+}
+
+void target_init(void)
+{
+	TRACE_ENTRY;
+
+	stm32_debug_init();
+
+	TRACE_EXIT;
+}
+
+void target_set_debug_led(unsigned int led, bool on)
+{
+	switch (led) {
+		case 0:
+			gpio_set(GPIO_LED0, on);
+			break;
+		case 1:
+			gpio_set(GPIO_LED1, on);
+			break;
+	}
+}
+
diff --git a/src/bsp/lk/target/stm32-p107/rules.mk b/src/bsp/lk/target/stm32-p107/rules.mk
new file mode 100644
index 0000000..a14fc06
--- /dev/null
+++ b/src/bsp/lk/target/stm32-p107/rules.mk
@@ -0,0 +1,17 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+STM32_CHIP := stm32f107
+
+PLATFORM := stm32f1xx
+
+GLOBAL_DEFINES += \
+	ENABLE_UART3=1 \
+	TARGET_HAS_DEBUG_LED=1
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/stm32-p407/include/target/debugconfig.h b/src/bsp/lk/target/stm32-p407/include/target/debugconfig.h
new file mode 100644
index 0000000..af7c27a
--- /dev/null
+++ b/src/bsp/lk/target/stm32-p407/include/target/debugconfig.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+#define DEBUG_UART 3
+
+#endif
diff --git a/src/bsp/lk/target/stm32-p407/include/target/gpioconfig.h b/src/bsp/lk/target/stm32-p407/include/target/gpioconfig.h
new file mode 100644
index 0000000..c75880c
--- /dev/null
+++ b/src/bsp/lk/target/stm32-p407/include/target/gpioconfig.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_GPIOCONFIG_H
+#define __TARGET_GPIOCONFIG_H
+
+#include <platform/gpio.h>
+
+#define GPIO_USART3_TX GPIO(GPIO_PORT_D, 8)
+#define GPIO_USART3_RX GPIO(GPIO_PORT_D, 9)
+
+#define GPIO_LED0 GPIO(GPIO_PORT_F, 6)
+#define GPIO_LED1 GPIO(GPIO_PORT_F, 7)
+#define GPIO_LED2 GPIO(GPIO_PORT_F, 8)
+#define GPIO_LED3 GPIO(GPIO_PORT_F, 9)
+
+#endif
diff --git a/src/bsp/lk/target/stm32-p407/init.c b/src/bsp/lk/target/stm32-p407/init.c
new file mode 100644
index 0000000..e3db745
--- /dev/null
+++ b/src/bsp/lk/target/stm32-p407/init.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <trace.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/gpio.h>
+#include <stm32f2xx_usart.h>
+#include <stm32f2xx_rcc.h>
+#include <stm32f2xx_gpio.h>
+#include <platform/stm32.h>
+#include <platform/gpio.h>
+#include <target/gpioconfig.h>
+
+void target_early_init(void)
+{
+	/* configure the usart3 pins */
+	gpio_config(GPIO_USART3_TX, GPIO_STM32_AF | GPIO_STM32_AFn(GPIO_AF_USART3) | GPIO_PULLUP);
+	gpio_config(GPIO_USART3_RX, GPIO_STM32_AF | GPIO_STM32_AFn(GPIO_AF_USART3) | GPIO_PULLUP);
+
+	stm32_debug_early_init();
+
+	/* configure some status leds */
+	gpio_config(GPIO_LED0, GPIO_OUTPUT);
+	gpio_config(GPIO_LED1, GPIO_OUTPUT);
+	gpio_config(GPIO_LED2, GPIO_OUTPUT);
+	gpio_config(GPIO_LED3, GPIO_OUTPUT);
+}
+
+void target_init(void)
+{
+	TRACE_ENTRY;
+
+	stm32_debug_init();
+
+	TRACE_EXIT;
+}
+
+void target_set_debug_led(unsigned int led, bool on)
+{
+	switch (led) {
+		case 0:
+			gpio_set(GPIO_LED0, on);
+			break;
+		case 1:
+			gpio_set(GPIO_LED1, on);
+			break;
+		case 2:
+			gpio_set(GPIO_LED2, on);
+			break;
+		case 3:
+			gpio_set(GPIO_LED3, on);
+			break;
+	}
+}
+
diff --git a/src/bsp/lk/target/stm32-p407/rules.mk b/src/bsp/lk/target/stm32-p407/rules.mk
new file mode 100644
index 0000000..e04ed2e
--- /dev/null
+++ b/src/bsp/lk/target/stm32-p407/rules.mk
@@ -0,0 +1,17 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+STM32_CHIP := stm32f407
+
+PLATFORM := stm32f2xx
+
+GLOBAL_DEFINES += \
+	ENABLE_UART3=1 \
+	TARGET_HAS_DEBUG_LED=1
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/stm3220g/include/target/debugconfig.h b/src/bsp/lk/target/stm3220g/include/target/debugconfig.h
new file mode 100644
index 0000000..af7c27a
--- /dev/null
+++ b/src/bsp/lk/target/stm3220g/include/target/debugconfig.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+#define DEBUG_UART 3
+
+#endif
diff --git a/src/bsp/lk/target/stm3220g/include/target/gpioconfig.h b/src/bsp/lk/target/stm3220g/include/target/gpioconfig.h
new file mode 100644
index 0000000..3978295
--- /dev/null
+++ b/src/bsp/lk/target/stm3220g/include/target/gpioconfig.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_GPIOCONFIG_H
+#define __TARGET_GPIOCONFIG_H
+
+#include <platform/gpio.h>
+
+#define GPIO_USART3_TX GPIO(GPIO_PORT_C, 10)
+#define GPIO_USART3_RX GPIO(GPIO_PORT_C, 11)
+
+#define GPIO_LED0 GPIO(GPIO_PORT_G, 6)
+#define GPIO_LED1 GPIO(GPIO_PORT_G, 8)
+#define GPIO_LED2 GPIO(GPIO_PORT_I, 9)
+#define GPIO_LED3 GPIO(GPIO_PORT_C, 7)
+
+void stm3220g_set_led_bits(unsigned int nr);
+
+#endif
diff --git a/src/bsp/lk/target/stm3220g/init.c b/src/bsp/lk/target/stm3220g/init.c
new file mode 100644
index 0000000..f1377fe
--- /dev/null
+++ b/src/bsp/lk/target/stm3220g/init.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <trace.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/gpio.h>
+#include <stm32f2xx_usart.h>
+#include <stm32f2xx_rcc.h>
+#include <stm32f2xx_gpio.h>
+//#include <stm32f10x_flash.h>
+//#include <stm32f10x_dbgmcu.h>
+#include <platform/stm32.h>
+#include <platform/gpio.h>
+#include <target/gpioconfig.h>
+
+void target_early_init(void)
+{
+	/* configure the usart3 pins */
+	gpio_config(GPIO_USART3_TX, GPIO_STM32_AF | GPIO_STM32_AFn(GPIO_AF_USART3) | GPIO_PULLUP);
+	gpio_config(GPIO_USART3_RX, GPIO_STM32_AF | GPIO_STM32_AFn(GPIO_AF_USART3) | GPIO_PULLUP);
+
+	stm32_debug_early_init();
+
+	/* configure some status leds */
+	gpio_config(GPIO_LED0, GPIO_OUTPUT);
+	gpio_config(GPIO_LED1, GPIO_OUTPUT);
+	gpio_config(GPIO_LED2, GPIO_OUTPUT);
+	gpio_config(GPIO_LED3, GPIO_OUTPUT);
+
+	stm3220g_set_led_bits(1);
+}
+
+void target_init(void)
+{
+	TRACE_ENTRY;
+
+	stm32_debug_init();
+
+	TRACE_EXIT;
+}
+
+void target_set_debug_led(unsigned int led, bool on)
+{
+	switch (led) {
+		case 0:
+			gpio_set(GPIO_LED0, on);
+			break;
+		case 1:
+			gpio_set(GPIO_LED1, on);
+			break;
+		case 2:
+			gpio_set(GPIO_LED2, on);
+			break;
+		case 3:
+			gpio_set(GPIO_LED3, on);
+			break;
+	}
+}
+
+void stm3220g_set_led_bits(unsigned int nr)
+{
+	gpio_set(GPIO_LED0, nr & 1);
+	gpio_set(GPIO_LED1, nr & 2);
+	gpio_set(GPIO_LED2, nr & 4);
+	gpio_set(GPIO_LED3, nr & 8);
+}
diff --git a/src/bsp/lk/target/stm3220g/rules.mk b/src/bsp/lk/target/stm3220g/rules.mk
new file mode 100644
index 0000000..281898e
--- /dev/null
+++ b/src/bsp/lk/target/stm3220g/rules.mk
@@ -0,0 +1,17 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+STM32_CHIP := stm32f207
+
+PLATFORM := stm32f2xx
+
+GLOBAL_DEFINES += \
+	ENABLE_UART3=1 \
+	TARGET_HAS_DEBUG_LED=1
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/stm32746g-eval2/include/target/debugconfig.h b/src/bsp/lk/target/stm32746g-eval2/include/target/debugconfig.h
new file mode 100644
index 0000000..88ffe5f
--- /dev/null
+++ b/src/bsp/lk/target/stm32746g-eval2/include/target/debugconfig.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+#define DEBUG_UART 1
+
+#endif
diff --git a/src/bsp/lk/target/stm32746g-eval2/include/target/gpioconfig.h b/src/bsp/lk/target/stm32746g-eval2/include/target/gpioconfig.h
new file mode 100644
index 0000000..96b34a6
--- /dev/null
+++ b/src/bsp/lk/target/stm32746g-eval2/include/target/gpioconfig.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_GPIOCONFIG_H
+#define __TARGET_GPIOCONFIG_H
+
+#include <platform/gpio.h>
+
+#define GPIO_USART1_TX GPIO(GPIO_PORT_A, 9)
+#define GPIO_USART1_RX GPIO(GPIO_PORT_A, 10)
+
+#endif
diff --git a/src/bsp/lk/target/stm32746g-eval2/init.c b/src/bsp/lk/target/stm32746g-eval2/init.c
new file mode 100644
index 0000000..8c34e85
--- /dev/null
+++ b/src/bsp/lk/target/stm32746g-eval2/init.c
@@ -0,0 +1,334 @@
+/*
+ * Copyright (c) 2015 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <stdlib.h>
+#include <debug.h>
+#include <trace.h>
+#include <target.h>
+#include <compiler.h>
+#include <lib/gfx.h>
+#include <dev/gpio.h>
+#include <platform/stm32.h>
+#include <platform/sdram.h>
+#include <platform/gpio.h>
+#include <platform/eth.h>
+#include <platform/qspi.h>
+#include <platform/n25q512a.h>
+#include <target/debugconfig.h>
+#include <target/gpioconfig.h>
+#include <reg.h>
+
+#if WITH_LIB_MINIP
+#include <lib/minip.h>
+#endif
+
+extern uint8_t BSP_LCD_Init(void);
+extern uint8_t BSP_SRAM_Init(void);
+
+const sdram_config_t target_sdram_config = {
+    .bus_width = SDRAM_BUS_WIDTH_32,
+    .cas_latency = SDRAM_CAS_LATENCY_3,
+    .col_bits_num = SDRAM_COLUMN_BITS_8
+};
+
+void target_early_init(void)
+{
+#if DEBUG_UART == 1
+    /* configure usart 1 pins */
+    gpio_config(GPIO_USART1_TX, GPIO_STM32_AF | GPIO_STM32_AFn(GPIO_AF7_USART1) | GPIO_PULLUP);
+    gpio_config(GPIO_USART1_RX, GPIO_STM32_AF | GPIO_STM32_AFn(GPIO_AF7_USART1) | GPIO_PULLUP);
+#else
+#error need to configure gpio pins for debug uart
+#endif
+
+    /* now that the uart gpios are configured, enable the debug uart */
+    stm32_debug_early_init();
+
+    /* initialize external sram */
+    BSP_SRAM_Init();
+
+    /* initialize the lcd panel */
+    BSP_LCD_Init();
+}
+
+void target_init(void)
+{
+    TRACE_ENTRY;
+    stm32_debug_init();
+
+    qspi_flash_init(N25Q512A_FLASH_SIZE);
+
+#if WITH_LIB_MINIP
+    uint8_t mac_addr[6];
+    gen_random_mac_address(mac_addr);
+    eth_init(mac_addr, PHY_DP83848);
+
+    /* start minip */
+    minip_set_macaddr(mac_addr);
+
+    uint32_t ip_addr = IPV4(192, 168, 0, 99);
+    uint32_t ip_mask = IPV4(255, 255, 255, 0);
+    uint32_t ip_gateway = IPV4_NONE;
+
+    minip_init(stm32_eth_send_minip_pkt, NULL, ip_addr, ip_mask, ip_gateway);
+#endif
+
+    TRACE_EXIT;
+}
+
+#if 0
+void target_set_debug_led(unsigned int led, bool on)
+{
+    switch (led) {
+        case 0:
+            gpio_set(GPIO_LED0, on);
+            break;
+        case 1:
+            gpio_set(GPIO_LED1, on);
+            break;
+        case 2:
+            gpio_set(GPIO_LED2, on);
+            break;
+        case 3:
+            gpio_set(GPIO_LED3, on);
+            break;
+    }
+}
+#endif
+
+/**
+  * @brief  Initializes the ETH MSP.
+  * @param  heth: ETH handle
+  * @retval None
+  */
+/* called back from the HAL_ETH_Init routine */
+void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
+{
+    GPIO_InitTypeDef GPIO_InitStructure;
+
+    /* Enable GPIOs clocks */
+    __HAL_RCC_GPIOA_CLK_ENABLE();
+    __HAL_RCC_GPIOB_CLK_ENABLE();
+    __HAL_RCC_GPIOC_CLK_ENABLE();
+    __HAL_RCC_GPIOE_CLK_ENABLE();
+    __HAL_RCC_GPIOF_CLK_ENABLE();
+    __HAL_RCC_GPIOG_CLK_ENABLE();
+    __HAL_RCC_GPIOH_CLK_ENABLE();
+    __HAL_RCC_GPIOI_CLK_ENABLE();
+
+    /* Ethernet pins configuration ************************************************/
+    /*
+          ETH_MDIO -------------------------> PA2
+          ETH_MDC --------------------------> PC1
+          ETH_PPS_OUT ----------------------> PB5
+          ETH_MII_RXD2 ---------------------> PH6
+          ETH_MII_RXD3 ---------------------> PH7
+          ETH_MII_TX_CLK -------------------> PC3
+          ETH_MII_TXD2 ---------------------> PC2
+          ETH_MII_TXD3 ---------------------> PE2
+          ETH_MII_RX_CLK -------------------> PA1
+          ETH_MII_RX_DV --------------------> PA7
+          ETH_MII_RXD0 ---------------------> PC4
+          ETH_MII_RXD1 ---------------------> PC5
+          ETH_MII_TX_EN --------------------> PG11
+          ETH_MII_TXD0 ---------------------> PG13
+          ETH_MII_TXD1 ---------------------> PG14
+          ETH_MII_RX_ER --------------------> PI10 (not configured)
+          ETH_MII_CRS ----------------------> PA0  (not configured)
+          ETH_MII_COL ----------------------> PH3  (not configured)
+    */
+
+    /* Configure PA1, PA2 and PA7 */
+    GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
+    GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
+    GPIO_InitStructure.Pull = GPIO_NOPULL;
+    GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
+    GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
+    HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
+
+    /* Note : ETH_MDIO is connected to PA2 which is shared with other signals like SAI2_SCKB.
+       By default on STM32756G-EVAL board, PA2 is connected to SAI2_SCKB, so to connect PA2 to ETH_MDIO :
+      - unsolder bridge SB24 (SAI2_CKB)
+      - solder bridge SB5 (ETH_MDIO) */
+
+    /* Configure PB5 */
+    GPIO_InitStructure.Pin = GPIO_PIN_5;
+    HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
+
+    /* Configure PE2 */
+    GPIO_InitStructure.Pin = GPIO_PIN_2;
+    HAL_GPIO_Init(GPIOE, &GPIO_InitStructure);
+
+    /* Configure PC1, PC2, PC3, PC4 and PC5 */
+    GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5;
+    HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
+
+    /* Note : ETH_MDC is connected to PC1 which is shared with other signals like SAI1_SDA.
+       By default on STM32756G-EVAL board, PC1 is connected to SAI1_SDA, so to connect PC1 to ETH_MDC :
+      - unsolder bridge SB22 (SAI1_SDA)
+      - solder bridge SB33 (ETH_MDC) */
+
+    /* Configure PG11, PG14 and PG13 */
+    GPIO_InitStructure.Pin =  GPIO_PIN_11 | GPIO_PIN_13 | GPIO_PIN_14;
+    HAL_GPIO_Init(GPIOG, &GPIO_InitStructure);
+
+    /* Configure PH6, PH7 */
+    GPIO_InitStructure.Pin =  GPIO_PIN_6 | GPIO_PIN_7;
+    HAL_GPIO_Init(GPIOH, &GPIO_InitStructure);
+
+    /* Configure PA0
+    GPIO_InitStructure.Pin =  GPIO_PIN_0;
+    HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
+
+    Note: Ethernet Full duplex mode works properly in the default setting
+    (which MII_CRS is not connected to PA0 of STM32F756NGH6) because PA0 is shared
+    with MC_ENA.
+    If Half duplex mode is needed, uncomment PA0 configuration code source (above
+    the note) and close the SB36 solder bridge of the STM32756G-EVAL board .
+    */
+
+    /* Configure PH3
+    GPIO_InitStructure.Pin =  GPIO_PIN_3;
+    HAL_GPIO_Init(GPIOH, &GPIO_InitStructure);
+
+    Note: Ethernet Full duplex mode works properly in the default setting
+    (which MII_COL is not connected to PH3 of STM32F756NGH6) because PH3 is shared
+    with SDRAM chip select SDNE0.
+    If Half duplex mode is needed, uncomment PH3 configuration code source (above
+    the note) and close SB47 solder bridge of the STM32756G-EVAL board.
+    */
+
+    /* Configure PI10
+    GPIO_InitStructure.Pin = GPIO_PIN_10;
+    HAL_GPIO_Init(GPIOI, &GPIO_InitStructure);
+
+    Note: Ethernet works properly in the default setting (which RX_ER is not
+    connected to PI10 of STM32F756NGH6) because PI10 is shared with data signal
+    of SDRAM.
+    If RX_ER signal is needed, uncomment PI10 configuration code source (above
+    the note) then remove R248 and solder SB9 of the STM32756G-EVAL board.
+    */
+}
+
+/**
+  * @brief  Initializes SDRAM GPIO.
+  * @retval None
+  */
+/* called back from BSP_SDRAM_Init */
+void stm_sdram_GPIO_init(void)
+{
+    GPIO_InitTypeDef gpio_init_structure;
+
+    /* Enable GPIOs clock */
+    __HAL_RCC_GPIOD_CLK_ENABLE();
+    __HAL_RCC_GPIOE_CLK_ENABLE();
+    __HAL_RCC_GPIOF_CLK_ENABLE();
+    __HAL_RCC_GPIOG_CLK_ENABLE();
+    __HAL_RCC_GPIOH_CLK_ENABLE();
+    __HAL_RCC_GPIOI_CLK_ENABLE();
+
+    /* Common GPIO configuration */
+    gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+    gpio_init_structure.Pull      = GPIO_PULLUP;
+    gpio_init_structure.Speed     = GPIO_SPEED_FAST;
+    gpio_init_structure.Alternate = GPIO_AF12_FMC;
+
+    /* GPIOD configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_8| GPIO_PIN_9 | GPIO_PIN_10 |\
+                                GPIO_PIN_14 | GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOD, &gpio_init_structure);
+
+    /* GPIOE configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_7| GPIO_PIN_8 | GPIO_PIN_9 |\
+                                GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 |\
+                                GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOE, &gpio_init_structure);
+
+    /* GPIOF configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2| GPIO_PIN_3 | GPIO_PIN_4 |\
+                                GPIO_PIN_5 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 |\
+                                GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOF, &gpio_init_structure);
+
+    /* GPIOG configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4| GPIO_PIN_5 | GPIO_PIN_8 |\
+                                GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOG, &gpio_init_structure);
+
+    /* GPIOH configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5 | GPIO_PIN_8 | GPIO_PIN_9 |\
+                                GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 |\
+                                GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOH, &gpio_init_structure);
+
+    /* GPIOI configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 |\
+                                GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_9 | GPIO_PIN_10;
+    HAL_GPIO_Init(GPIOI, &gpio_init_structure);
+}
+
+void HAL_QSPI_MspInit(QSPI_HandleTypeDef *hqspi)
+{
+    GPIO_InitTypeDef GPIO_InitStruct;
+
+    /*##-1- Enable peripherals and GPIO Clocks #################################*/
+    /* Enable GPIO clocks */
+    __HAL_RCC_GPIOB_CLK_ENABLE();
+    __HAL_RCC_GPIOF_CLK_ENABLE();
+
+    /*##-2- Configure peripheral GPIO ##########################################*/
+    /* QSPI CS GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_6;
+    GPIO_InitStruct.Mode      = GPIO_MODE_AF_PP;
+    GPIO_InitStruct.Pull      = GPIO_PULLUP;
+    GPIO_InitStruct.Speed     = GPIO_SPEED_HIGH;
+    GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;
+    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+    /* QSPI CLK GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_2;
+    GPIO_InitStruct.Pull      = GPIO_NOPULL;
+    GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
+    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+    /* QSPI D0 GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_8;
+    GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;
+    HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
+
+    /* QSPI D1 GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_9;
+    GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;
+    HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
+
+    /* QSPI D2 GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_7;
+    GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
+    HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
+
+    /* QSPI D3 GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_6;
+    GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
+    HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
+}
+
diff --git a/src/bsp/lk/target/stm32746g-eval2/lcd.c b/src/bsp/lk/target/stm32746g-eval2/lcd.c
new file mode 100644
index 0000000..41e08af
--- /dev/null
+++ b/src/bsp/lk/target/stm32746g-eval2/lcd.c
@@ -0,0 +1,412 @@
+/*
+ * Copyright (c) 2015 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+/*
+ * COPYRIGHT(c) 2015 STMicroelectronics
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+#include <err.h>
+#include <debug.h>
+#include <trace.h>
+#include <target.h>
+#include <compiler.h>
+#include <string.h>
+#include <lib/gfx.h>
+#include <dev/gpio.h>
+#include <dev/display.h>
+#include <arch/ops.h>
+#include <platform/stm32.h>
+
+/*
+ * lcd initialization sequence, taken from
+ * STM32Cube_FW_F7_V1.1.0/Drivers/BSP/STM32756G_EVAL/stm32756g_eval_lcd.[ch]
+ */
+
+/**
+  * @brief  AMPIRE640480 Size
+  */
+#define  AMPIRE640480_WIDTH    ((uint16_t)640)             /* LCD PIXEL WIDTH            */
+#define  AMPIRE640480_HEIGHT   ((uint16_t)480)             /* LCD PIXEL HEIGHT           */
+
+/**
+  * @brief  AMPIRE640480 Timing
+  */
+#define  AMPIRE640480_HSYNC            ((uint16_t)30)      /* Horizontal synchronization */
+#define  AMPIRE640480_HBP              ((uint16_t)114)     /* Horizontal back porch      */
+#define  AMPIRE640480_HFP              ((uint16_t)16)      /* Horizontal front porch     */
+#define  AMPIRE640480_VSYNC            ((uint16_t)3)       /* Vertical synchronization   */
+#define  AMPIRE640480_VBP              ((uint16_t)32)      /* Vertical back porch        */
+#define  AMPIRE640480_VFP              ((uint16_t)10)      /* Vertical front porch       */
+
+/**
+  * @brief  AMPIRE640480 frequency divider
+  */
+#define  AMPIRE640480_FREQUENCY_DIVIDER     3              /* LCD Frequency divider      */
+
+/** @defgroup STM32756G_EVAL_LCD_Exported_Constants
+  * @{
+  */
+#define MAX_LAYER_NUMBER       ((uint32_t)2)
+
+#define LCD_LayerCfgTypeDef    LTDC_LayerCfgTypeDef
+
+#define LTDC_ACTIVE_LAYER        ((uint32_t)1) /* Layer 1 */
+/**
+  * @brief  LCD status structure definition
+  */
+#define LCD_OK                 ((uint8_t)0x00)
+#define LCD_ERROR              ((uint8_t)0x01)
+#define LCD_TIMEOUT            ((uint8_t)0x02)
+
+/**
+  * @brief  LCD FB_StartAddress
+  */
+#define LCD_FB_START_ADDRESS       ((uint32_t)SDRAM_BASE)
+//#define LCD_FB_START_ADDRESS       ((uint32_t)EXT_SRAM_BASE)
+
+//#define LCD_PIXEL_FORMAT LTDC_PIXEL_FORMAT_ARGB888
+#define LCD_PIXEL_FORMAT LTDC_PIXEL_FORMAT_RGB565
+
+static LTDC_HandleTypeDef  hLtdcEval;
+
+/* Default LCD configuration with LCD Layer 1 */
+static uint32_t            ActiveLayer = 0;
+
+/**
+  * @brief  Gets the LCD X size.
+  * @retval Used LCD X size
+  */
+uint32_t BSP_LCD_GetXSize(void)
+{
+    return hLtdcEval.LayerCfg[ActiveLayer].ImageWidth;
+}
+
+/**
+  * @brief  Gets the LCD Y size.
+  * @retval Used LCD Y size
+  */
+uint32_t BSP_LCD_GetYSize(void)
+{
+    return hLtdcEval.LayerCfg[ActiveLayer].ImageHeight;
+}
+
+/**
+  * @brief  Set the LCD X size.
+  * @param  imageWidthPixels : image width in pixels unit
+  * @retval None
+  */
+void BSP_LCD_SetXSize(uint32_t imageWidthPixels)
+{
+    hLtdcEval.LayerCfg[ActiveLayer].ImageWidth = imageWidthPixels;
+}
+
+/**
+  * @brief  Set the LCD Y size.
+  * @param  imageHeightPixels : image height in lines unit
+  * @retval None
+  */
+void BSP_LCD_SetYSize(uint32_t imageHeightPixels)
+{
+    hLtdcEval.LayerCfg[ActiveLayer].ImageHeight = imageHeightPixels;
+}
+
+static size_t BSP_LCD_PixelSize(void)
+{
+    return (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB8888) ? 4 : 2;
+}
+
+/**
+  * @brief  Initializes the LCD layers.
+  * @param  LayerIndex: Layer foreground or background
+  * @param  FB_Address: Layer frame buffer
+  * @retval None
+  */
+void BSP_LCD_LayerDefaultInit(uint16_t LayerIndex, uint32_t FB_Address)
+{
+    LCD_LayerCfgTypeDef  layer_cfg;
+
+    /* Layer Init */
+    layer_cfg.WindowX0 = 0;
+    layer_cfg.WindowX1 = BSP_LCD_GetXSize();
+    layer_cfg.WindowY0 = 0;
+    layer_cfg.WindowY1 = BSP_LCD_GetYSize();
+    layer_cfg.PixelFormat = LCD_PIXEL_FORMAT;
+    layer_cfg.FBStartAdress = FB_Address;
+    layer_cfg.Alpha = 255;
+    layer_cfg.Alpha0 = 0;
+    layer_cfg.Backcolor.Blue = 0;
+    layer_cfg.Backcolor.Green = 0;
+    layer_cfg.Backcolor.Red = 0;
+    layer_cfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA;
+    layer_cfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA;
+    layer_cfg.ImageWidth = BSP_LCD_GetXSize();
+    layer_cfg.ImageHeight = BSP_LCD_GetYSize();
+
+    HAL_LTDC_ConfigLayer(&hLtdcEval, &layer_cfg, LayerIndex);
+}
+
+
+/**
+  * @brief  Selects the LCD Layer.
+  * @param  LayerIndex: Layer foreground or background
+  * @retval None
+  */
+void BSP_LCD_SelectLayer(uint32_t LayerIndex)
+{
+    ActiveLayer = LayerIndex;
+}
+
+/**
+  * @brief  Sets an LCD Layer visible
+  * @param  LayerIndex: Visible Layer
+  * @param  State: New state of the specified layer
+  *          This parameter can be one of the following values:
+  *            @arg  ENABLE
+  *            @arg  DISABLE
+  * @retval None
+  */
+void BSP_LCD_SetLayerVisible(uint32_t LayerIndex, FunctionalState State)
+{
+    if (State == ENABLE) {
+        __HAL_LTDC_LAYER_ENABLE(&hLtdcEval, LayerIndex);
+    } else {
+        __HAL_LTDC_LAYER_DISABLE(&hLtdcEval, LayerIndex);
+    }
+    __HAL_LTDC_RELOAD_CONFIG(&hLtdcEval);
+}
+
+/**
+  * @brief  Configures the transparency.
+  * @param  LayerIndex: Layer foreground or background.
+  * @param  Transparency: Transparency
+  *           This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF
+  * @retval None
+  */
+void BSP_LCD_SetTransparency(uint32_t LayerIndex, uint8_t Transparency)
+{
+    HAL_LTDC_SetAlpha(&hLtdcEval, Transparency, LayerIndex);
+}
+
+/**
+  * @brief  Sets an LCD layer frame buffer address.
+  * @param  LayerIndex: Layer foreground or background
+  * @param  Address: New LCD frame buffer value
+  * @retval None
+  */
+void BSP_LCD_SetLayerAddress(uint32_t LayerIndex, uint32_t Address)
+{
+    HAL_LTDC_SetAddress(&hLtdcEval, Address, LayerIndex);
+}
+
+/**
+  * @brief  Enables the display.
+  * @retval None
+  */
+void BSP_LCD_DisplayOn(void)
+{
+    /* Display On */
+    __HAL_LTDC_ENABLE(&hLtdcEval);
+}
+
+/**
+  * @brief  Disables the display.
+  * @retval None
+  */
+void BSP_LCD_DisplayOff(void)
+{
+    /* Display Off */
+    __HAL_LTDC_DISABLE(&hLtdcEval);
+}
+
+/**
+  * @brief  Initializes the LTDC MSP.
+  * @param  hltdc: LTDC handle
+  * @retval None
+  */
+static void BSP_LCD_MspInit(LTDC_HandleTypeDef *hltdc, void *Params)
+{
+    GPIO_InitTypeDef gpio_init_structure;
+
+    /* Enable the LTDC and DMA2D clocks */
+    __HAL_RCC_LTDC_CLK_ENABLE();
+    __HAL_RCC_DMA2D_CLK_ENABLE();
+
+    /* Enable GPIOs clock */
+    __HAL_RCC_GPIOI_CLK_ENABLE();
+    __HAL_RCC_GPIOJ_CLK_ENABLE();
+    __HAL_RCC_GPIOK_CLK_ENABLE();
+
+    /*** LTDC Pins configuration ***/
+    /* GPIOI configuration */
+    gpio_init_structure.Pin       = GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
+    gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+    gpio_init_structure.Pull      = GPIO_NOPULL;
+    gpio_init_structure.Speed     = GPIO_SPEED_FAST;
+    gpio_init_structure.Alternate = GPIO_AF14_LTDC;
+    HAL_GPIO_Init(GPIOI, &gpio_init_structure);
+
+    /* GPIOJ configuration */
+    gpio_init_structure.Pin       = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | \
+                                    GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | \
+                                    GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | \
+                                    GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
+    gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+    gpio_init_structure.Pull      = GPIO_NOPULL;
+    gpio_init_structure.Speed     = GPIO_SPEED_FAST;
+    gpio_init_structure.Alternate = GPIO_AF14_LTDC;
+    HAL_GPIO_Init(GPIOJ, &gpio_init_structure);
+
+    /* GPIOK configuration */
+    gpio_init_structure.Pin       = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | \
+                                    GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7;
+    gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+    gpio_init_structure.Pull      = GPIO_NOPULL;
+    gpio_init_structure.Speed     = GPIO_SPEED_FAST;
+    gpio_init_structure.Alternate = GPIO_AF14_LTDC;
+    HAL_GPIO_Init(GPIOK, &gpio_init_structure);
+}
+
+/**
+  * @brief  Clock Config.
+  * @param  hltdc: LTDC handle
+  * @note   This API is called by BSP_LCD_Init()
+  *         Being __weak it can be overwritten by the application
+  * @retval None
+  */
+static void BSP_LCD_ClockConfig(LTDC_HandleTypeDef *hltdc, void *Params)
+{
+    static RCC_PeriphCLKInitTypeDef  periph_clk_init_struct;
+
+    /* AMPIRE640480 LCD clock configuration */
+    /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
+    /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 151 Mhz */
+    /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 151/3 = 50.3 Mhz */
+    /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_2 = 50.3/2 = 25.1 Mhz */
+    periph_clk_init_struct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
+    periph_clk_init_struct.PLLSAI.PLLSAIN = 151;
+    periph_clk_init_struct.PLLSAI.PLLSAIR = AMPIRE640480_FREQUENCY_DIVIDER;
+    periph_clk_init_struct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
+    HAL_RCCEx_PeriphCLKConfig(&periph_clk_init_struct);
+}
+
+/**
+  * @brief  Initializes the LCD.
+  * @retval LCD state
+  */
+uint8_t BSP_LCD_Init(void)
+{
+    /* Select the used LCD */
+    /* The LCD AMPIRE 640x480 is selected */
+    /* Timing configuration */
+    hLtdcEval.Init.HorizontalSync = (AMPIRE640480_HSYNC - 1);
+    hLtdcEval.Init.VerticalSync = (AMPIRE640480_VSYNC - 1);
+    hLtdcEval.Init.AccumulatedHBP = (AMPIRE640480_HSYNC + AMPIRE640480_HBP - 1);
+    hLtdcEval.Init.AccumulatedVBP = (AMPIRE640480_VSYNC + AMPIRE640480_VBP - 1);
+    hLtdcEval.Init.AccumulatedActiveH = (AMPIRE640480_HEIGHT + AMPIRE640480_VSYNC + AMPIRE640480_VBP - 1);
+    hLtdcEval.Init.AccumulatedActiveW = (AMPIRE640480_WIDTH + AMPIRE640480_HSYNC + AMPIRE640480_HBP - 1);
+    hLtdcEval.Init.TotalHeigh = (AMPIRE640480_HEIGHT + AMPIRE640480_VSYNC + AMPIRE640480_VBP + AMPIRE640480_VFP - 1);
+    hLtdcEval.Init.TotalWidth = (AMPIRE640480_WIDTH + AMPIRE640480_HSYNC + AMPIRE640480_HBP + AMPIRE640480_HFP - 1);
+
+    /* LCD clock configuration */
+    BSP_LCD_ClockConfig(&hLtdcEval, NULL);
+
+    /* Initialize the LCD pixel width and pixel height */
+    hLtdcEval.LayerCfg->ImageWidth  = AMPIRE640480_WIDTH;
+    hLtdcEval.LayerCfg->ImageHeight = AMPIRE640480_HEIGHT;
+
+    /* Background value */
+    hLtdcEval.Init.Backcolor.Blue = 0;
+    hLtdcEval.Init.Backcolor.Green = 0;
+    hLtdcEval.Init.Backcolor.Red = 0;
+
+    /* Polarity */
+    hLtdcEval.Init.HSPolarity = LTDC_HSPOLARITY_AL;
+    hLtdcEval.Init.VSPolarity = LTDC_VSPOLARITY_AL;
+    hLtdcEval.Init.DEPolarity = LTDC_DEPOLARITY_AL;
+    hLtdcEval.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
+    hLtdcEval.Instance = LTDC;
+
+    if (HAL_LTDC_GetState(&hLtdcEval) == HAL_LTDC_STATE_RESET) {
+        /* Initialize the LCD Msp: this __weak function can be rewritten by the application */
+        BSP_LCD_MspInit(&hLtdcEval, NULL);
+    }
+    HAL_LTDC_Init(&hLtdcEval);
+
+    /* set a default layer to the base of sdram */
+    BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);
+    BSP_LCD_SelectLayer(0);
+
+    /* clear it out */
+    memset((void *)hLtdcEval.LayerCfg[ActiveLayer].FBStartAdress, 0, BSP_LCD_GetXSize() * BSP_LCD_GetYSize() * BSP_LCD_PixelSize());
+
+    /* turn the display on */
+    BSP_LCD_DisplayOn();
+
+    return LCD_OK;
+}
+
+/* LK display api here */
+status_t display_get_info(struct display_info *info)
+{
+    info->framebuffer = (void *)hLtdcEval.LayerCfg[ActiveLayer].FBStartAdress;
+
+    if (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB8888) {
+        info->format = GFX_FORMAT_ARGB_8888;
+    } else if (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_RGB565) {
+        info->format = GFX_FORMAT_RGB_565;
+    } else {
+        panic("unhandled pixel format\n");
+        return ERR_NOT_FOUND;
+    }
+
+    info->width = BSP_LCD_GetXSize();
+    info->height = BSP_LCD_GetYSize();
+    info->stride = BSP_LCD_GetXSize();
+    info->flush = NULL;
+
+    return NO_ERROR;
+}
+
diff --git a/src/bsp/lk/target/stm32746g-eval2/rules.mk b/src/bsp/lk/target/stm32746g-eval2/rules.mk
new file mode 100644
index 0000000..2e7360e
--- /dev/null
+++ b/src/bsp/lk/target/stm32746g-eval2/rules.mk
@@ -0,0 +1,42 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+STM32_CHIP := stm32f746
+
+PLATFORM := stm32f7xx
+
+SDRAM_SIZE := 0x02000000
+SDRAM_BASE := 0xc0000000
+EXT_SRAM_BASE := 0x68000000
+EXT_SRAM_SIZE := 0x00200000
+
+GLOBAL_DEFINES += \
+    ENABLE_UART1=1 \
+    ENABLE_SDRAM=1 \
+    SDRAM_BASE=$(SDRAM_BASE) \
+    SDRAM_SIZE=$(SDRAM_SIZE) \
+    EXT_SRAM_BASE=$(EXT_SRAM_BASE) \
+    EXT_SRAM_SIZE=$(EXT_SRAM_SIZE) \
+    ENABLE_EXT_SRAM=1 \
+\
+    PKTBUF_POOL_SIZE=16
+
+# XXX todo, drive pll config from here
+#HSE_VALUE=8000000 \
+    PLL_M_VALUE=8 \
+    PLL_N_VALUE=336 \
+    PLL_P_VALUE=2
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/init.c \
+    $(LOCAL_DIR)/lcd.c \
+    $(LOCAL_DIR)/sram.c
+
+MODULE_DEPS += \
+    lib/gfx \
+
+#    lib/gfxconsole
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/stm32746g-eval2/sram.c b/src/bsp/lk/target/stm32746g-eval2/sram.c
new file mode 100644
index 0000000..fb52cfd
--- /dev/null
+++ b/src/bsp/lk/target/stm32746g-eval2/sram.c
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2015 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+/*
+ * COPYRIGHT(c) 2015 STMicroelectronics
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+#include <err.h>
+#include <debug.h>
+#include <trace.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/gpio.h>
+#include <platform/stm32.h>
+
+#define   SRAM_OK         ((uint8_t)0x00)
+#define   SRAM_ERROR      ((uint8_t)0x01)
+
+/* #define SRAM_MEMORY_WIDTH    FMC_NORSRAM_MEM_BUS_WIDTH_8*/
+#define SRAM_MEMORY_WIDTH    FMC_NORSRAM_MEM_BUS_WIDTH_16
+
+#define SRAM_BURSTACCESS     FMC_BURST_ACCESS_MODE_DISABLE
+//#define SRAM_BURSTACCESS     FMC_BURST_ACCESS_MODE_ENABLE
+
+#define SRAM_WRITEBURST      FMC_WRITE_BURST_DISABLE
+//#define SRAM_WRITEBURST     FMC_WRITE_BURST_ENABLE
+
+#define CONTINUOUSCLOCK_FEATURE    FMC_CONTINUOUS_CLOCK_SYNC_ONLY
+//#define CONTINUOUSCLOCK_FEATURE     FMC_CONTINUOUS_CLOCK_SYNC_ASYNC
+
+/* DMA definitions for SRAM DMA transfer */
+#define __SRAM_DMAx_CLK_ENABLE            __HAL_RCC_DMA2_CLK_ENABLE
+#define __SRAM_DMAx_CLK_DISABLE           __HAL_RCC_DMA2_CLK_DISABLE
+#define SRAM_DMAx_CHANNEL                 DMA_CHANNEL_0
+#define SRAM_DMAx_STREAM                  DMA2_Stream4
+#define SRAM_DMAx_IRQn                    DMA2_Stream4_IRQn
+#define SRAM_DMAx_IRQHandler              DMA2_Stream4_IRQHandler
+
+static SRAM_HandleTypeDef sramHandle;
+static FMC_NORSRAM_TimingTypeDef Timing;
+
+/**
+  * @brief  Initializes SRAM MSP.
+  * @param  hsram: SRAM handle
+  * @retval None
+  */
+static void BSP_SRAM_MspInit(SRAM_HandleTypeDef  *hsram, void *Params)
+{
+    static DMA_HandleTypeDef dma_handle;
+    GPIO_InitTypeDef gpio_init_structure;
+
+    /* Enable FMC clock */
+    __HAL_RCC_FMC_CLK_ENABLE();
+
+    /* Enable chosen DMAx clock */
+    __SRAM_DMAx_CLK_ENABLE();
+
+    /* Enable GPIOs clock */
+    __HAL_RCC_GPIOD_CLK_ENABLE();
+    __HAL_RCC_GPIOE_CLK_ENABLE();
+    __HAL_RCC_GPIOF_CLK_ENABLE();
+    __HAL_RCC_GPIOG_CLK_ENABLE();
+
+    /* Common GPIO configuration */
+    gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+    gpio_init_structure.Pull      = GPIO_PULLUP;
+    gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
+    gpio_init_structure.Alternate = GPIO_AF12_FMC;
+
+    /* GPIOD configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_8     |\
+                                GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 |\
+                                GPIO_PIN_14 | GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOD, &gpio_init_structure);
+
+    /* GPIOE configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_3| GPIO_PIN_4 | GPIO_PIN_7     |\
+                                GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 |\
+                                GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOE, &gpio_init_structure);
+
+    /* GPIOF configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2| GPIO_PIN_3 | GPIO_PIN_4     |\
+                                GPIO_PIN_5 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOF, &gpio_init_structure);
+
+    /* GPIOG configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2| GPIO_PIN_3 | GPIO_PIN_4     |\
+                                GPIO_PIN_5 | GPIO_PIN_10;
+    HAL_GPIO_Init(GPIOG, &gpio_init_structure);
+
+    /* Configure common DMA parameters */
+    dma_handle.Init.Channel             = SRAM_DMAx_CHANNEL;
+    dma_handle.Init.Direction           = DMA_MEMORY_TO_MEMORY;
+    dma_handle.Init.PeriphInc           = DMA_PINC_ENABLE;
+    dma_handle.Init.MemInc              = DMA_MINC_ENABLE;
+    dma_handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
+    dma_handle.Init.MemDataAlignment    = DMA_MDATAALIGN_HALFWORD;
+    dma_handle.Init.Mode                = DMA_NORMAL;
+    dma_handle.Init.Priority            = DMA_PRIORITY_HIGH;
+    dma_handle.Init.FIFOMode            = DMA_FIFOMODE_DISABLE;
+    dma_handle.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
+    dma_handle.Init.MemBurst            = DMA_MBURST_SINGLE;
+    dma_handle.Init.PeriphBurst         = DMA_PBURST_SINGLE;
+
+    dma_handle.Instance = SRAM_DMAx_STREAM;
+
+    /* Associate the DMA handle */
+    __HAL_LINKDMA(hsram, hdma, dma_handle);
+
+    /* Deinitialize the Stream for new transfer */
+    HAL_DMA_DeInit(&dma_handle);
+
+    /* Configure the DMA Stream */
+    HAL_DMA_Init(&dma_handle);
+
+    /* NVIC configuration for DMA transfer complete interrupt */
+    HAL_NVIC_SetPriority(SRAM_DMAx_IRQn, 5, 0);
+    HAL_NVIC_EnableIRQ(SRAM_DMAx_IRQn);
+}
+
+/**
+  * @brief  Initializes the SRAM device.
+  * @retval SRAM status
+  */
+uint8_t BSP_SRAM_Init(void)
+{
+    static uint8_t sram_status = SRAM_ERROR;
+    /* SRAM device configuration */
+    sramHandle.Instance = FMC_NORSRAM_DEVICE;
+    sramHandle.Extended = FMC_NORSRAM_EXTENDED_DEVICE;
+
+    /* SRAM device configuration */
+    /* Timing configuration derived from system clock (up to 216Mhz)
+       for 108Mhz as SRAM clock frequency */
+    Timing.AddressSetupTime      = 2;
+    Timing.AddressHoldTime       = 1;
+    Timing.DataSetupTime         = 2;
+    Timing.BusTurnAroundDuration = 1;
+    Timing.CLKDivision           = 2;
+    Timing.DataLatency           = 2;
+    Timing.AccessMode            = FMC_ACCESS_MODE_A;
+
+    sramHandle.Init.NSBank             = FMC_NORSRAM_BANK3;
+    sramHandle.Init.DataAddressMux     = FMC_DATA_ADDRESS_MUX_DISABLE;
+    sramHandle.Init.MemoryType         = FMC_MEMORY_TYPE_SRAM;
+    sramHandle.Init.MemoryDataWidth    = SRAM_MEMORY_WIDTH;
+    sramHandle.Init.BurstAccessMode    = SRAM_BURSTACCESS;
+    sramHandle.Init.WaitSignalPolarity = FMC_WAIT_SIGNAL_POLARITY_LOW;
+    sramHandle.Init.WaitSignalActive   = FMC_WAIT_TIMING_BEFORE_WS;
+    sramHandle.Init.WriteOperation     = FMC_WRITE_OPERATION_ENABLE;
+    sramHandle.Init.WaitSignal         = FMC_WAIT_SIGNAL_DISABLE;
+    sramHandle.Init.ExtendedMode       = FMC_EXTENDED_MODE_DISABLE;
+    sramHandle.Init.AsynchronousWait   = FMC_ASYNCHRONOUS_WAIT_DISABLE;
+    sramHandle.Init.WriteBurst         = SRAM_WRITEBURST;
+    sramHandle.Init.ContinuousClock    = CONTINUOUSCLOCK_FEATURE;
+
+    /* SRAM controller initialization */
+    BSP_SRAM_MspInit(&sramHandle, NULL); /* __weak function can be rewritten by the application */
+    if (HAL_SRAM_Init(&sramHandle, &Timing, &Timing) != HAL_OK) {
+        sram_status = SRAM_ERROR;
+    } else {
+        sram_status = SRAM_OK;
+    }
+    return sram_status;
+}
+
+
+
+
diff --git a/src/bsp/lk/target/stm32f4-discovery/README b/src/bsp/lk/target/stm32f4-discovery/README
new file mode 100644
index 0000000..956e946
--- /dev/null
+++ b/src/bsp/lk/target/stm32f4-discovery/README
@@ -0,0 +1,24 @@
+
+Notes on the STM32F4 Discovery Board
+------------------------------------
+
+http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF252419
+http://www.digikey.com/product-detail/en/STM32F4DISCOVERY/497-11455-ND/2711743
+
+
+LK Debug/Console UART
+---------------------
+- USART2 is used
+- TX is A2
+- RX is A3
+- both are on the P1 header near the top
+
+
+Using external SWD debug
+------------------------
+- Remove jumpers from CN3 4-pin header (near mini-usb connector)
+- CN3 pin2 is SWCLK
+- CN2 pin4 is SWDIO
+- GND is available on P2, nearby
+
+
diff --git a/src/bsp/lk/target/stm32f4-discovery/include/target/debugconfig.h b/src/bsp/lk/target/stm32f4-discovery/include/target/debugconfig.h
new file mode 100644
index 0000000..f195f93
--- /dev/null
+++ b/src/bsp/lk/target/stm32f4-discovery/include/target/debugconfig.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+#define DEBUG_UART 2
+
+#endif
diff --git a/src/bsp/lk/target/stm32f4-discovery/include/target/gpioconfig.h b/src/bsp/lk/target/stm32f4-discovery/include/target/gpioconfig.h
new file mode 100644
index 0000000..cc12927
--- /dev/null
+++ b/src/bsp/lk/target/stm32f4-discovery/include/target/gpioconfig.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_GPIOCONFIG_H
+#define __TARGET_GPIOCONFIG_H
+
+#include <platform/gpio.h>
+
+#define GPIO_USART2_TX GPIO(GPIO_PORT_A, 2)
+#define GPIO_USART2_RX GPIO(GPIO_PORT_A, 3)
+
+#define GPIO_LED0 GPIO(GPIO_PORT_D, 13) // LD3 - Orange
+#define GPIO_LED1 GPIO(GPIO_PORT_D, 12) // LD4 - Green
+#define GPIO_LED2 GPIO(GPIO_PORT_D, 14) // LD5 - Red
+#define GPIO_LED3 GPIO(GPIO_PORT_D, 15) // LD6 - Blue
+
+#endif
diff --git a/src/bsp/lk/target/stm32f4-discovery/init.c b/src/bsp/lk/target/stm32f4-discovery/init.c
new file mode 100644
index 0000000..e923578
--- /dev/null
+++ b/src/bsp/lk/target/stm32f4-discovery/init.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <trace.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/gpio.h>
+#include <stm32f4xx_usart.h>
+#include <stm32f4xx_rcc.h>
+#include <stm32f4xx_gpio.h>
+#include <platform/stm32.h>
+#include <platform/gpio.h>
+#include <target/debugconfig.h>
+#include <target/gpioconfig.h>
+
+void target_early_init(void)
+{
+#ifdef DEBUG_UART
+#if DEBUG_UART == 2
+	gpio_config(GPIO_USART2_TX, GPIO_STM32_AF |
+		GPIO_STM32_AFn(GPIO_AF_USART2) | GPIO_PULLUP);
+	gpio_config(GPIO_USART2_RX, GPIO_STM32_AF |
+		GPIO_STM32_AFn(GPIO_AF_USART2) | GPIO_PULLUP);
+#endif // DEBUG_UART == 2
+#else
+#warn DEBUG_UART only supports USART2!!!
+#endif // defined DEBUG_UART
+
+	stm32_debug_early_init();
+
+	/* configure some status leds */
+	gpio_config(GPIO_LED0, GPIO_OUTPUT);
+	gpio_config(GPIO_LED1, GPIO_OUTPUT);
+	gpio_config(GPIO_LED2, GPIO_OUTPUT);
+	gpio_config(GPIO_LED3, GPIO_OUTPUT);
+}
+
+void target_init(void)
+{
+	TRACE_ENTRY;
+
+	stm32_debug_init();
+
+	TRACE_EXIT;
+}
+
+void target_set_debug_led(unsigned int led, bool on)
+{
+	switch (led) {
+	case 0:
+		gpio_set(GPIO_LED0, on);
+		break;
+	case 1:
+		gpio_set(GPIO_LED1, on);
+		break;
+	case 2:
+		gpio_set(GPIO_LED2, on);
+		break;
+	case 3:
+		gpio_set(GPIO_LED3, on);
+		break;
+	}
+}
diff --git a/src/bsp/lk/target/stm32f4-discovery/rules.mk b/src/bsp/lk/target/stm32f4-discovery/rules.mk
new file mode 100644
index 0000000..5168e0d
--- /dev/null
+++ b/src/bsp/lk/target/stm32f4-discovery/rules.mk
@@ -0,0 +1,21 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+STM32_CHIP := stm32f407
+
+PLATFORM := stm32f4xx
+
+GLOBAL_DEFINES += \
+	ENABLE_UART2=1 \
+	TARGET_HAS_DEBUG_LED=1 \
+	HSE_VALUE=8000000 \
+	PLL_M_VALUE=8 \
+	PLL_N_VALUE=336 \
+	PLL_P_VALUE=2
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/init.c
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/stm32f746g-disco/include/target/debugconfig.h b/src/bsp/lk/target/stm32f746g-disco/include/target/debugconfig.h
new file mode 100644
index 0000000..88ffe5f
--- /dev/null
+++ b/src/bsp/lk/target/stm32f746g-disco/include/target/debugconfig.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_DEBUGCONFIG_H
+#define __TARGET_DEBUGCONFIG_H
+
+#define DEBUG_UART 1
+
+#endif
diff --git a/src/bsp/lk/target/stm32f746g-disco/include/target/gpioconfig.h b/src/bsp/lk/target/stm32f746g-disco/include/target/gpioconfig.h
new file mode 100644
index 0000000..c5d3d81
--- /dev/null
+++ b/src/bsp/lk/target/stm32f746g-disco/include/target/gpioconfig.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef __TARGET_GPIOCONFIG_H
+#define __TARGET_GPIOCONFIG_H
+
+#include <platform/gpio.h>
+
+#define GPIO_USART1_TX GPIO(GPIO_PORT_A, 9)
+#define GPIO_USART1_RX GPIO(GPIO_PORT_B, 7)
+
+#endif
diff --git a/src/bsp/lk/target/stm32f746g-disco/init.c b/src/bsp/lk/target/stm32f746g-disco/init.c
new file mode 100644
index 0000000..f311a26
--- /dev/null
+++ b/src/bsp/lk/target/stm32f746g-disco/init.c
@@ -0,0 +1,348 @@
+/*
+ * Copyright (c) 2015 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <stdlib.h>
+#include <debug.h>
+#include <trace.h>
+#include <target.h>
+#include <compiler.h>
+#include <reg.h>
+#include <dev/gpio.h>
+#include <dev/usb.h>
+#include <platform/stm32.h>
+#include <platform/sdram.h>
+#include <platform/gpio.h>
+#include <platform/eth.h>
+#include <platform/qspi.h>
+#include <platform/n25q128a.h>
+#include <target/debugconfig.h>
+#include <target/gpioconfig.h>
+#include <kernel/novm.h>
+
+#if WITH_LIB_MINIP
+#include <lib/minip.h>
+#endif
+
+extern uint8_t BSP_LCD_Init(void);
+extern void target_usb_setup(void);
+
+const sdram_config_t target_sdram_config = {
+    .bus_width = SDRAM_BUS_WIDTH_16,
+    .cas_latency = SDRAM_CAS_LATENCY_2,
+    .col_bits_num = SDRAM_COLUMN_BITS_8
+};
+
+void target_early_init(void)
+{
+#if DEBUG_UART == 1
+    /* configure usart 1 pins */
+    gpio_config(GPIO_USART1_TX, GPIO_STM32_AF | GPIO_STM32_AFn(GPIO_AF7_USART1) | GPIO_PULLUP);
+    gpio_config(GPIO_USART1_RX, GPIO_STM32_AF | GPIO_STM32_AFn(GPIO_AF7_USART1) | GPIO_PULLUP);
+#else
+#error need to configure gpio pins for debug uart
+#endif
+
+    /* now that the uart gpios are configured, enable the debug uart */
+    stm32_debug_early_init();
+
+    /* start the lcd */
+    BSP_LCD_Init();
+}
+
+void target_init(void)
+{
+    stm32_debug_init();
+
+    qspi_flash_init(N25Q128A_FLASH_SIZE);
+
+#if WITH_LIB_MINIP
+    uint8_t mac_addr[6];
+    gen_random_mac_address(mac_addr);
+    eth_init(mac_addr, PHY_LAN8742A);
+
+    /* start minip */
+    minip_set_macaddr(mac_addr);
+
+    uint32_t ip_addr = IPV4(192, 168, 0, 98);
+    uint32_t ip_mask = IPV4(255, 255, 255, 0);
+    uint32_t ip_gateway = IPV4_NONE;
+
+    minip_init(stm32_eth_send_minip_pkt, NULL, ip_addr, ip_mask, ip_gateway);
+#endif
+
+    // start usb
+    target_usb_setup();
+}
+
+/**
+  * @brief  Initializes SDRAM GPIO.
+  * called back from stm32_sdram_init
+  */
+void stm_sdram_GPIO_init(void)
+{
+    GPIO_InitTypeDef gpio_init_structure;
+
+    /* Enable GPIOs clock */
+    __HAL_RCC_GPIOC_CLK_ENABLE();
+    __HAL_RCC_GPIOD_CLK_ENABLE();
+    __HAL_RCC_GPIOE_CLK_ENABLE();
+    __HAL_RCC_GPIOF_CLK_ENABLE();
+    __HAL_RCC_GPIOG_CLK_ENABLE();
+    __HAL_RCC_GPIOH_CLK_ENABLE();
+
+    /* Common GPIO configuration */
+    gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+    gpio_init_structure.Pull      = GPIO_PULLUP;
+    gpio_init_structure.Speed     = GPIO_SPEED_FAST;
+    gpio_init_structure.Alternate = GPIO_AF12_FMC;
+
+    /* GPIOC configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_3;
+    HAL_GPIO_Init(GPIOC, &gpio_init_structure);
+
+    /* GPIOD configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_3 | GPIO_PIN_8| GPIO_PIN_9 | GPIO_PIN_10 |\
+                                GPIO_PIN_14 | GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOD, &gpio_init_structure);
+
+    /* GPIOE configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_7| GPIO_PIN_8 | GPIO_PIN_9 |\
+                                GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 |\
+                                GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOE, &gpio_init_structure);
+
+    /* GPIOF configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2| GPIO_PIN_3 | GPIO_PIN_4 |\
+                                GPIO_PIN_5 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 |\
+                                GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOF, &gpio_init_structure);
+
+    /* GPIOG configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4| GPIO_PIN_5 | GPIO_PIN_8 |\
+                                GPIO_PIN_15;
+    HAL_GPIO_Init(GPIOG, &gpio_init_structure);
+
+    /* GPIOH configuration */
+    gpio_init_structure.Pin   = GPIO_PIN_3 | GPIO_PIN_5;
+    HAL_GPIO_Init(GPIOH, &gpio_init_structure);
+}
+
+
+/**
+  * @brief  Initializes the ETH MSP.
+  * @param  heth: ETH handle
+  * @retval None
+  */
+/* called back from the HAL_ETH_Init routine */
+void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
+{
+    GPIO_InitTypeDef GPIO_InitStructure;
+
+    /* Enable GPIOs clocks */
+    __HAL_RCC_GPIOA_CLK_ENABLE();
+    __HAL_RCC_GPIOC_CLK_ENABLE();
+    __HAL_RCC_GPIOG_CLK_ENABLE();
+
+    /* Ethernet pins configuration ************************************************/
+    /*
+        RMII_REF_CLK ----------------------> PA1
+        RMII_MDIO -------------------------> PA2
+        RMII_MDC --------------------------> PC1
+        RMII_MII_CRS_DV -------------------> PA7
+        RMII_MII_RXD0 ---------------------> PC4
+        RMII_MII_RXD1 ---------------------> PC5
+        RMII_MII_TX_EN --------------------> PG11
+        RMII_MII_TXD0 ---------------------> PG13
+        RMII_MII_TXD1 ---------------------> PG14
+    */
+
+    /* Configure PA1, PA2 and PA7 */
+    GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
+    GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
+    GPIO_InitStructure.Pull = GPIO_NOPULL;
+    GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
+    GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7;
+    HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
+
+    /* Configure PC1, PC4 and PC5 */
+    GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5;
+    HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
+
+    /* Configure PG2, PG11, PG13 and PG14 */
+    GPIO_InitStructure.Pin =  GPIO_PIN_2 | GPIO_PIN_11 | GPIO_PIN_13 | GPIO_PIN_14;
+    HAL_GPIO_Init(GPIOG, &GPIO_InitStructure);
+}
+
+void HAL_QSPI_MspInit(QSPI_HandleTypeDef *hqspi)
+{
+    GPIO_InitTypeDef GPIO_InitStruct;
+
+    /*##-1- Enable peripherals and GPIO Clocks #################################*/
+    /* Enable GPIO clocks */
+    __HAL_RCC_GPIOB_CLK_ENABLE();
+    __HAL_RCC_GPIOD_CLK_ENABLE();
+    __HAL_RCC_GPIOE_CLK_ENABLE();
+
+    /*##-2- Configure peripheral GPIO ##########################################*/
+    /* QSPI CS GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_6;
+    GPIO_InitStruct.Mode      = GPIO_MODE_AF_PP;
+    GPIO_InitStruct.Pull      = GPIO_PULLUP;
+    GPIO_InitStruct.Speed     = GPIO_SPEED_HIGH;
+    GPIO_InitStruct.Alternate = GPIO_AF10_QUADSPI;
+    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+    /* QSPI CLK GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_2;
+    GPIO_InitStruct.Pull      = GPIO_NOPULL;
+    GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
+    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+    /* QSPI D0 GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_11;
+    GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
+    HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
+
+    /* QSPI D1 GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_12;
+    GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
+    HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
+
+    /* QSPI D2 GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_2;
+    GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
+    HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
+
+    /* QSPI D3 GPIO pin configuration  */
+    GPIO_InitStruct.Pin       = GPIO_PIN_13;
+    GPIO_InitStruct.Alternate = GPIO_AF9_QUADSPI;
+    HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
+}
+
+/**
+  * @brief  Initializes the PCD MSP.
+  * @param  hpcd: PCD handle
+  * @retval None
+  */
+void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
+{
+    GPIO_InitTypeDef  GPIO_InitStruct;
+
+    if (hpcd->Instance == USB_OTG_FS) {
+        /* Configure USB FS GPIOs */
+        __HAL_RCC_GPIOA_CLK_ENABLE();
+
+        /* Configure DM DP Pins */
+        GPIO_InitStruct.Pin = (GPIO_PIN_11 | GPIO_PIN_12);
+        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull = GPIO_NOPULL;
+        GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+        GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
+        HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+        /* Enable USB FS Clock */
+        __HAL_RCC_USB_OTG_FS_CLK_ENABLE();
+
+        /* Set USBFS Interrupt priority */
+        HAL_NVIC_SetPriority(OTG_FS_IRQn, 5, 0);
+
+        /* Enable USBFS Interrupt */
+        HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
+
+        if (hpcd->Init.low_power_enable == 1) {
+            /* Enable EXTI Line 18 for USB wakeup*/
+            __HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG();
+            __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_EDGE();
+            __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_IT();
+
+            /* Set EXTI Wakeup Interrupt priority*/
+            HAL_NVIC_SetPriority(OTG_FS_WKUP_IRQn, 0, 0);
+
+            /* Enable EXTI Interrupt */
+            HAL_NVIC_EnableIRQ(OTG_FS_WKUP_IRQn);
+        }
+    } else if (hpcd->Instance == USB_OTG_HS) {
+        /* Configure USB FS GPIOs */
+        __HAL_RCC_GPIOA_CLK_ENABLE();
+        __HAL_RCC_GPIOB_CLK_ENABLE();
+        __HAL_RCC_GPIOC_CLK_ENABLE();
+        __HAL_RCC_GPIOH_CLK_ENABLE();
+
+        /* CLK */
+        GPIO_InitStruct.Pin = GPIO_PIN_5;
+        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull = GPIO_NOPULL;
+        GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+        GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
+        HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+        /* D0 */
+        GPIO_InitStruct.Pin = GPIO_PIN_3;
+        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull = GPIO_NOPULL;
+        GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+        GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
+        HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+        /* D1 D2 D3 D4 D5 D6 D7 */
+        GPIO_InitStruct.Pin = GPIO_PIN_0  | GPIO_PIN_1  | GPIO_PIN_5 |\
+                              GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13;
+        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull = GPIO_NOPULL;
+        GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
+        HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+        /* STP */
+        GPIO_InitStruct.Pin = GPIO_PIN_0;
+        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull = GPIO_NOPULL;
+        GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
+        HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
+
+        /* NXT */
+        GPIO_InitStruct.Pin = GPIO_PIN_4;
+        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull = GPIO_NOPULL;
+        GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
+        HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
+
+        /* DIR */
+        GPIO_InitStruct.Pin = GPIO_PIN_2;
+        GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+        GPIO_InitStruct.Pull = GPIO_NOPULL;
+        GPIO_InitStruct.Alternate = GPIO_AF10_OTG_HS;
+        HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
+
+        __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE();
+
+        /* Enable USB HS Clocks */
+        __HAL_RCC_USB_OTG_HS_CLK_ENABLE();
+
+        /* Set USBHS Interrupt to the lowest priority */
+        HAL_NVIC_SetPriority(OTG_HS_IRQn, 5, 0);
+
+        /* Enable USBHS Interrupt */
+        HAL_NVIC_EnableIRQ(OTG_HS_IRQn);
+    }
+}
+
diff --git a/src/bsp/lk/target/stm32f746g-disco/lcd.c b/src/bsp/lk/target/stm32f746g-disco/lcd.c
new file mode 100644
index 0000000..25b26b8
--- /dev/null
+++ b/src/bsp/lk/target/stm32f746g-disco/lcd.c
@@ -0,0 +1,425 @@
+/*
+ * Copyright (c) 2015 Carlos Pizano-Uribe <cpu@chromium.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+/*
+ * COPYRIGHT(c) 2015 STMicroelectronics
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *   1. Redistributions of source code must retain the above copyright notice,
+ *      this list of conditions and the following disclaimer.
+ *   2. Redistributions in binary form must reproduce the above copyright notice,
+ *      this list of conditions and the following disclaimer in the documentation
+ *      and/or other materials provided with the distribution.
+ *   3. Neither the name of STMicroelectronics nor the names of its contributors
+ *      may be used to endorse or promote products derived from this software
+ *      without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+#include <err.h>
+#include <debug.h>
+#include <trace.h>
+#include <target.h>
+#include <compiler.h>
+#include <string.h>
+#include <lib/gfx.h>
+#include <dev/gpio.h>
+#include <dev/display.h>
+#include <kernel/novm.h>
+#include <platform/stm32.h>
+
+/*
+ * lcd initialization sequence, taken from
+ * STM32Cube_FW_F7_V1.1.0/Drivers/BSP/STM32746G_Disco/stm32746g_discovery_lcd.[ch]
+ *
+ * This code only applies to The RK043FN48H LCD 480x272.
+ */
+
+/** 
+  * @brief  RK043FN48H Size  
+  */     
+#define  RK043FN48H_WIDTH    ((uint16_t)480)    /* LCD PIXEL WIDTH            */
+#define  RK043FN48H_HEIGHT   ((uint16_t)272)    /* LCD PIXEL HEIGHT           */
+
+/** 
+  * @brief  RK043FN48H Timing  
+  */     
+#define  RK043FN48H_HSYNC      ((uint16_t)41)   /* Horizontal synchronization */
+#define  RK043FN48H_HBP        ((uint16_t)13)   /* Horizontal back porch      */
+#define  RK043FN48H_HFP        ((uint16_t)32)   /* Horizontal front porch     */
+#define  RK043FN48H_VSYNC      ((uint16_t)10)   /* Vertical synchronization   */
+#define  RK043FN48H_VBP        ((uint16_t)2)    /* Vertical back porch        */
+#define  RK043FN48H_VFP        ((uint16_t)2)    /* Vertical front porch       */
+
+
+/**
+  * @brief LCD special pins
+  */
+/* Display enable pin */
+#define LCD_DISP_PIN            GPIO_PIN_12
+#define LCD_DISP_GPIO_PORT      GPIOI
+/* Backlight control pin */
+#define LCD_BL_CTRL_PIN         GPIO_PIN_3
+#define LCD_BL_CTRL_GPIO_PORT   GPIOK
+
+#define LCD_DISP_GPIO_CLK_ENABLE()      __HAL_RCC_GPIOI_CLK_ENABLE()
+#define LCD_DISP_GPIO_CLK_DISABLE()     __HAL_RCC_GPIOI_CLK_DISABLE()
+#define LCD_BL_CTRL_GPIO_CLK_ENABLE()    __HAL_RCC_GPIOK_CLK_ENABLE()
+#define LCD_BL_CTRL_GPIO_CLK_DISABLE()   __HAL_RCC_GPIOK_CLK_DISABLE()
+
+/** 
+  * @brief  RK043FN48H frequency divider  
+  */    
+#define  RK043FN48H_FREQUENCY_DIVIDER    5      /* LCD Frequency divider      */
+
+/** @defgroup STM32746G_DISCOVERY_LCD_Exported_Constants
+  * @{
+  */ 
+#define MAX_LAYER_NUMBER       ((uint32_t)2)
+
+#define LCD_LayerCfgTypeDef    LTDC_LayerCfgTypeDef
+
+#define LTDC_ACTIVE_LAYER	     ((uint32_t)1)   /* Layer 1 */
+/** 
+  * @brief  LCD status structure definition  
+  */     
+#define LCD_OK                 ((uint8_t)0x00)
+#define LCD_ERROR              ((uint8_t)0x01)
+#define LCD_TIMEOUT            ((uint8_t)0x02)
+
+
+static LTDC_HandleTypeDef  ltdc_handle;
+
+/* Default LCD configuration with LCD Layer 1 */
+static uint32_t active_layer = 0;
+
+/**
+  * @brief  Gets the LCD X size.
+  * @retval Used LCD X size
+  */
+static uint32_t BSP_LCD_GetXSize(void)
+{
+    return ltdc_handle.LayerCfg[active_layer].ImageWidth;
+}
+
+/**
+  * @brief  Gets the LCD Y size.
+  * @retval Used LCD Y size
+  */
+static uint32_t BSP_LCD_GetYSize(void)
+{
+    return ltdc_handle.LayerCfg[active_layer].ImageHeight;
+}
+
+static size_t BSP_LCD_PixelSize(void)
+{
+    return (ltdc_handle.LayerCfg[active_layer].PixelFormat ==
+            LTDC_PIXEL_FORMAT_ARGB8888) ? 4 : 2;
+}
+
+/**
+  * @brief  Initializes the LCD layer in ARGB8888 format (32 bits per pixel).
+  * @param  LayerIndex: Layer foreground or background
+  * @param  FB_Address: Layer frame buffer
+  * @retval None
+  */
+static void BSP_LCD_LayerDefaultInit(uint16_t LayerIndex, uint32_t FB_Address)
+{     
+    LCD_LayerCfgTypeDef  layer_cfg;
+
+    /* Layer Init */
+    layer_cfg.WindowX0 = 0;
+    layer_cfg.WindowX1 = BSP_LCD_GetXSize();
+    layer_cfg.WindowY0 = 0;
+    layer_cfg.WindowY1 = BSP_LCD_GetYSize(); 
+    layer_cfg.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888;
+    layer_cfg.FBStartAdress = FB_Address;
+    layer_cfg.Alpha = 255;
+    layer_cfg.Alpha0 = 0;
+    layer_cfg.Backcolor.Blue = 0;
+    layer_cfg.Backcolor.Green = 0;
+    layer_cfg.Backcolor.Red = 0;
+    layer_cfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA;
+    layer_cfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA;
+    layer_cfg.ImageWidth = BSP_LCD_GetXSize();
+    layer_cfg.ImageHeight = BSP_LCD_GetYSize();
+    
+    HAL_LTDC_ConfigLayer(&ltdc_handle, &layer_cfg, LayerIndex); 
+}
+
+/**
+  * @brief  Selects the LCD Layer.
+  * @param  LayerIndex: Layer foreground or background
+  * @retval None
+  */
+void BSP_LCD_SelectLayer(uint32_t LayerIndex)
+{
+    active_layer = LayerIndex;
+} 
+
+/**
+  * @brief  Sets an LCD Layer visible
+  * @param  LayerIndex: Visible Layer
+  * @param  State: New state of the specified layer
+  *          This parameter can be one of the following values:
+  *            @arg  ENABLE
+  *            @arg  DISABLE 
+  * @retval None
+  */
+void BSP_LCD_SetLayerVisible(uint32_t LayerIndex, FunctionalState State)
+{
+    if(State == ENABLE) {
+        __HAL_LTDC_LAYER_ENABLE(&ltdc_handle, LayerIndex);
+    } else {
+        __HAL_LTDC_LAYER_DISABLE(&ltdc_handle, LayerIndex);
+    }
+    __HAL_LTDC_RELOAD_CONFIG(&ltdc_handle);
+} 
+
+/**
+  * @brief  Sets an LCD layer frame buffer address.
+  * @param  LayerIndex: Layer foreground or background
+  * @param  Address: New LCD frame buffer value      
+  * @retval None
+  */
+void BSP_LCD_SetLayerAddress(uint32_t LayerIndex, uint32_t Address)
+{
+    HAL_LTDC_SetAddress(&ltdc_handle, Address, LayerIndex);
+}
+
+/**
+  * @brief  Enables the display.
+  * @retval None
+  */
+void BSP_LCD_DisplayOn(void)
+{
+    /* Display On */
+    __HAL_LTDC_ENABLE(&ltdc_handle);
+    HAL_GPIO_WritePin(LCD_DISP_GPIO_PORT, LCD_DISP_PIN, GPIO_PIN_SET); 
+    HAL_GPIO_WritePin(LCD_BL_CTRL_GPIO_PORT, LCD_BL_CTRL_PIN, GPIO_PIN_SET);
+}
+
+/**
+  * @brief  Disables the display.
+  * @retval None
+  */
+void BSP_LCD_DisplayOff(void)
+{
+    /* Display Off */
+    __HAL_LTDC_DISABLE(&ltdc_handle);
+    HAL_GPIO_WritePin(LCD_DISP_GPIO_PORT, LCD_DISP_PIN, GPIO_PIN_RESET);
+    HAL_GPIO_WritePin(LCD_BL_CTRL_GPIO_PORT, LCD_BL_CTRL_PIN, GPIO_PIN_RESET);
+}
+
+/**
+  * @brief  Initializes the LTDC MSP.
+  * @param  hltdc: LTDC handle
+  * @param  Params
+  * @retval None
+  */
+static void BSP_LCD_MspInit(LTDC_HandleTypeDef *hltdc, void *Params)
+{
+    GPIO_InitTypeDef gpio_init_structure;
+    
+    /* Enable the LTDC and DMA2D clocks */
+    __HAL_RCC_LTDC_CLK_ENABLE();
+    __HAL_RCC_DMA2D_CLK_ENABLE();
+    
+    /* Enable GPIOs clock */
+    __HAL_RCC_GPIOE_CLK_ENABLE();
+    __HAL_RCC_GPIOG_CLK_ENABLE();
+    __HAL_RCC_GPIOI_CLK_ENABLE();
+    __HAL_RCC_GPIOJ_CLK_ENABLE();
+    __HAL_RCC_GPIOK_CLK_ENABLE();
+    LCD_DISP_GPIO_CLK_ENABLE();
+    LCD_BL_CTRL_GPIO_CLK_ENABLE();
+
+    /*** LTDC Pins configuration ***/
+    /* GPIOE configuration */
+    gpio_init_structure.Pin       = GPIO_PIN_4;
+    gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+    gpio_init_structure.Pull      = GPIO_NOPULL;
+    gpio_init_structure.Speed     = GPIO_SPEED_FAST;
+    gpio_init_structure.Alternate = GPIO_AF14_LTDC;  
+    HAL_GPIO_Init(GPIOE, &gpio_init_structure);
+
+    /* GPIOG configuration */
+    gpio_init_structure.Pin       = GPIO_PIN_12;
+    gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+    gpio_init_structure.Alternate = GPIO_AF9_LTDC;
+    HAL_GPIO_Init(GPIOG, &gpio_init_structure);
+
+    /* GPIOI LTDC alternate configuration */
+    gpio_init_structure.Pin       = GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | \
+                                    GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
+    gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+    gpio_init_structure.Alternate = GPIO_AF14_LTDC;
+    HAL_GPIO_Init(GPIOI, &gpio_init_structure);
+
+    /* GPIOJ configuration */  
+    gpio_init_structure.Pin       = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | \
+                                    GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | \
+                                    GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | \
+                                    GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
+    gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+    gpio_init_structure.Alternate = GPIO_AF14_LTDC;
+    HAL_GPIO_Init(GPIOJ, &gpio_init_structure);  
+
+    /* GPIOK configuration */  
+    gpio_init_structure.Pin       = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_4 | \
+                                    GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7;
+    gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+    gpio_init_structure.Alternate = GPIO_AF14_LTDC;
+    HAL_GPIO_Init(GPIOK, &gpio_init_structure);
+
+    /* LCD_DISP GPIO configuration 
+       Note that LCD_DISP pin has to be manually controlled.
+     */
+    gpio_init_structure.Pin       = LCD_DISP_PIN;
+    gpio_init_structure.Mode      = GPIO_MODE_OUTPUT_PP;
+    HAL_GPIO_Init(LCD_DISP_GPIO_PORT, &gpio_init_structure);
+
+    /* LCD_BL_CTRL GPIO configuration 
+       Note that LCD_BL_CTRL pin has to be manually controlled.
+     */
+    gpio_init_structure.Pin       = LCD_BL_CTRL_PIN;
+    gpio_init_structure.Mode      = GPIO_MODE_OUTPUT_PP;
+    HAL_GPIO_Init(LCD_BL_CTRL_GPIO_PORT, &gpio_init_structure);
+}
+
+/**
+  * @brief  Clock Config.
+  * @param  hltdc: LTDC handle
+  * @param  Params
+  * @note   This API is called by BSP_LCD_Init()
+  * @retval None
+  */
+static void BSP_LCD_ClockConfig(LTDC_HandleTypeDef *hltdc, void *Params)
+{
+    static RCC_PeriphCLKInitTypeDef  periph_clk_init_struct;
+
+    /* RK043FN48H LCD clock configuration */
+    /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
+    /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 192 Mhz */
+    /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAIR = 192/5 = 38.4 Mhz */
+    /* LTDC clock frequency = PLLLCDCLK / LTDC_PLLSAI_DIVR_4 = 38.4/4 = 9.6Mhz */
+    periph_clk_init_struct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
+    periph_clk_init_struct.PLLSAI.PLLSAIN = 192;
+    periph_clk_init_struct.PLLSAI.PLLSAIR = RK043FN48H_FREQUENCY_DIVIDER;
+    periph_clk_init_struct.PLLSAIDivR = RCC_PLLSAIDIVR_4;
+    HAL_RCCEx_PeriphCLKConfig(&periph_clk_init_struct);
+}
+
+/**
+  * @brief  Initializes the LCD.
+  * @retval LCD state
+  */
+uint8_t BSP_LCD_Init(void)
+{    
+    /* Timing Configuration */
+    ltdc_handle.Init.HorizontalSync = (RK043FN48H_HSYNC - 1);
+    ltdc_handle.Init.VerticalSync = (RK043FN48H_VSYNC - 1);
+    ltdc_handle.Init.AccumulatedHBP = (RK043FN48H_HSYNC + RK043FN48H_HBP - 1);
+    ltdc_handle.Init.AccumulatedVBP = (RK043FN48H_VSYNC + RK043FN48H_VBP - 1);
+    ltdc_handle.Init.AccumulatedActiveH = (RK043FN48H_HEIGHT + RK043FN48H_VSYNC + RK043FN48H_VBP - 1);
+    ltdc_handle.Init.AccumulatedActiveW = (RK043FN48H_WIDTH + RK043FN48H_HSYNC + RK043FN48H_HBP - 1);
+    ltdc_handle.Init.TotalHeigh = (RK043FN48H_HEIGHT + RK043FN48H_VSYNC + RK043FN48H_VBP + RK043FN48H_VFP - 1);
+    ltdc_handle.Init.TotalWidth = (RK043FN48H_WIDTH + RK043FN48H_HSYNC + RK043FN48H_HBP + RK043FN48H_HFP - 1);
+    
+    /* LCD clock configuration */
+    BSP_LCD_ClockConfig(&ltdc_handle, NULL);
+
+    /* Initialize the LCD pixel width and pixel height */
+    ltdc_handle.LayerCfg->ImageWidth  = RK043FN48H_WIDTH;
+    ltdc_handle.LayerCfg->ImageHeight = RK043FN48H_HEIGHT;
+
+    /* Background value */
+    ltdc_handle.Init.Backcolor.Blue = 0;
+    ltdc_handle.Init.Backcolor.Green = 0;
+    ltdc_handle.Init.Backcolor.Red = 0;
+    
+    /* Polarity */
+    ltdc_handle.Init.HSPolarity = LTDC_HSPOLARITY_AL;
+    ltdc_handle.Init.VSPolarity = LTDC_VSPOLARITY_AL; 
+    ltdc_handle.Init.DEPolarity = LTDC_DEPOLARITY_AL;  
+    ltdc_handle.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
+    ltdc_handle.Instance = LTDC;
+
+    if (HAL_LTDC_GetState(&ltdc_handle) == HAL_LTDC_STATE_RESET) {
+        BSP_LCD_MspInit(&ltdc_handle, NULL);
+    }
+
+    HAL_LTDC_Init(&ltdc_handle);
+
+    /* allocate the framebuffer */
+    size_t fb_size_pages = PAGE_ALIGN(RK043FN48H_WIDTH * RK043FN48H_HEIGHT * 4) / PAGE_SIZE;
+    void *fb_address = novm_alloc_pages(fb_size_pages, NOVM_ARENA_SECONDARY);
+    if (!fb_address)
+        panic("failed to allocate framebuffer for LCD\n");
+
+    BSP_LCD_LayerDefaultInit(0, (uint32_t)fb_address);
+    BSP_LCD_SelectLayer(0);
+
+    /* clear framebuffer */
+    memset((void *)ltdc_handle.LayerCfg[active_layer].FBStartAdress, 0,
+           BSP_LCD_GetXSize() * BSP_LCD_GetYSize() * BSP_LCD_PixelSize());
+
+    /* turn the display on */
+    BSP_LCD_DisplayOn();
+    return LCD_OK;
+}
+
+/* LK display (lib/gfx.h) calls this function */
+status_t display_get_info(struct display_info *info)
+{
+    info->framebuffer = (void *)ltdc_handle.LayerCfg[active_layer].FBStartAdress;
+
+    if (ltdc_handle.LayerCfg[active_layer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB8888) {
+        info->format = GFX_FORMAT_ARGB_8888;
+    } else if (ltdc_handle.LayerCfg[active_layer].PixelFormat == LTDC_PIXEL_FORMAT_RGB565) {
+        info->format = GFX_FORMAT_RGB_565;
+    } else {
+        panic("unhandled pixel format\n");
+        return ERR_NOT_FOUND;
+    }
+
+    info->width = BSP_LCD_GetXSize();
+    info->height = BSP_LCD_GetYSize();
+    info->stride = BSP_LCD_GetXSize();
+    info->flush = NULL;
+
+    return NO_ERROR;
+}
+
diff --git a/src/bsp/lk/target/stm32f746g-disco/rules.mk b/src/bsp/lk/target/stm32f746g-disco/rules.mk
new file mode 100644
index 0000000..577be12
--- /dev/null
+++ b/src/bsp/lk/target/stm32f746g-disco/rules.mk
@@ -0,0 +1,34 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+STM32_CHIP := stm32f746
+
+PLATFORM := stm32f7xx
+
+SDRAM_SIZE := 0x00800000
+SDRAM_BASE := 0xc0000000
+
+GLOBAL_DEFINES += \
+    ENABLE_UART1=1 \
+    ENABLE_SDRAM=1 \
+    USE_HSE_XTAL=1 \
+    SDRAM_BASE=$(SDRAM_BASE) \
+    SDRAM_SIZE=$(SDRAM_SIZE) \
+    PLL_M_VALUE=8 \
+    PLL_N_VALUE=336 \
+    PLL_P_VALUE=2 \
+\
+    PKTBUF_POOL_SIZE=16
+
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/init.c \
+    $(LOCAL_DIR)/lcd.c \
+    $(LOCAL_DIR)/usb.c
+
+MODULE_DEPS += \
+    lib/gfx
+
+include make/module.mk
+
diff --git a/src/bsp/lk/target/stm32f746g-disco/usb.c b/src/bsp/lk/target/stm32f746g-disco/usb.c
new file mode 100644
index 0000000..2689b44
--- /dev/null
+++ b/src/bsp/lk/target/stm32f746g-disco/usb.c
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2013-2015 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <err.h>
+#include <debug.h>
+#include <stdio.h>
+#include <trace.h>
+#include <target.h>
+#include <compiler.h>
+#include <dev/usb.h>
+#include <dev/usbc.h>
+#include <hw/usb.h>
+#include <lk/init.h>
+
+#define LOCAL_TRACE 0
+
+#define W(w) (w & 0xff), (w >> 8)
+#define W3(w) (w & 0xff), ((w >> 8) & 0xff), ((w >> 16) & 0xff)
+
+/* top level device descriptor */
+static const uint8_t dev_descr[] = {
+    0x12,           /* descriptor length */
+    DEVICE,         /* Device Descriptor type */
+    W(0x0200),      /* USB Version */
+    0xff,           /* class */
+    0xff,           /* subclass */
+    0xff,           /* protocol */
+    64,             /* max packet size, ept0 */
+    W(0x9999),      /* vendor */
+    W(0x9999),      /* product */
+    W(0x9999),      /* release */
+    0x2,            /* manufacturer string */
+    0x1,            /* product string */
+    0x0,            /* serialno string */
+    0x1,            /* num configs */
+};
+
+/* high/low speed device qualifier */
+static const uint8_t devqual_descr[] = {
+    0x0a,           /* len */
+    DEVICE_QUALIFIER, /* Device Qualifier type */
+    W(0x0200),      /* USB version */
+    0x00,           /* class */
+    0x00,           /* subclass */
+    0x00,           /* protocol */
+    64,             /* max packet size, ept0 */
+    0x01,           /* num configs */
+    0x00            /* reserved */
+};
+
+static const uint8_t cfg_descr[] = {
+    0x09,           /* Length of Cfg Descr */
+    CONFIGURATION,  /* Type of Cfg Descr */
+    W(0x09),        /* Total Length (incl ifc, ept) */
+    0x00,           /* # Interfaces */
+    0x01,           /* Cfg Value */
+    0x00,           /* Cfg String */
+    0xc0,           /* Attributes -- self powered */
+    250,            /* Power Consumption - 500mA */
+};
+
+static const uchar langid[] = { 0x04, 0x03, 0x09, 0x04 };
+
+static const uint8_t if_descriptor_lowspeed[] = {
+    0x09,           /* length */
+    INTERFACE,      /* type */
+    0x01,           /* interface num */
+    0x00,           /* alternates */
+    0x02,           /* endpoint count */
+    0xff,           /* interface class */
+    0xff,           /* interface subclass */
+    0x00,           /* interface protocol */
+    0x00,           /* string index */
+
+    /* endpoint 1 IN */
+    0x07,           /* length */
+    ENDPOINT,       /* type */
+    0x81,           /* address: 1 IN */
+    0x02,           /* type: bulk */
+    W(64),          /* max packet size: 64 */
+    00,             /* interval */
+
+    /* endpoint 1 OUT */
+    0x07,           /* length */
+    ENDPOINT,       /* type */
+    0x01,           /* address: 1 OUT */
+    0x02,           /* type: bulk */
+    W(64),          /* max packet size: 64 */
+    00,             /* interval */
+};
+
+usb_config config = {
+    .lowspeed = {
+        .device = USB_DESC_STATIC(dev_descr),
+        .device_qual = USB_DESC_STATIC(devqual_descr),
+        .config = USB_DESC_STATIC(cfg_descr),
+    },
+    .highspeed = {
+        .device = USB_DESC_STATIC(dev_descr),
+        .device_qual = USB_DESC_STATIC(devqual_descr),
+        .config = USB_DESC_STATIC(cfg_descr),
+    },
+
+    .langid = USB_DESC_STATIC(langid),
+};
+
+static status_t ep_cb_rx(ep_t endpoint, usbc_transfer_t *t);
+static status_t ep_cb_tx(ep_t endpoint, usbc_transfer_t *t);
+
+static void queue_rx(void)
+{
+    static usbc_transfer_t transfer;
+    static uint8_t buf[512];
+
+    transfer.callback = &ep_cb_rx;
+    transfer.result = 0;
+    transfer.buf = &buf;
+    transfer.buflen = sizeof(buf);
+    transfer.bufpos = 0;
+    transfer.extra = 0;
+
+    usbc_queue_rx(1, &transfer);
+}
+
+static void queue_tx(void)
+{
+    static usbc_transfer_t transfer;
+    static uint8_t buf[512];
+
+    for (uint i = 0; i < sizeof(buf); i++) {
+        buf[i] = ~i;
+    }
+
+    transfer.callback = &ep_cb_tx;
+    transfer.result = 0;
+    transfer.buf = &buf;
+    transfer.buflen = sizeof(buf);
+    transfer.bufpos = 0;
+    transfer.extra = 0;
+
+    usbc_queue_tx(1, &transfer);
+}
+
+static status_t ep_cb_rx(ep_t endpoint, usbc_transfer_t *t)
+{
+#if LOCAL_TRACE
+    LTRACEF("ep %u transfer %p\n", endpoint, t);
+    usbc_dump_transfer(t);
+
+    if (t->result >= 0) {
+        hexdump8(t->buf, t->bufpos);
+    }
+#endif
+
+    if (t->result >= 0)
+        queue_rx();
+
+    return NO_ERROR;
+}
+
+static status_t ep_cb_tx(ep_t endpoint, usbc_transfer_t *t)
+{
+#if LOCAL_TRACE
+    LTRACEF("ep %u transfer %p\n", endpoint, t);
+    usbc_dump_transfer(t);
+#endif
+
+    if (t->result >= 0)
+        queue_tx();
+
+    return NO_ERROR;
+}
+
+static status_t usb_cb(void *cookie, usb_callback_op_t op, const union usb_callback_args *args)
+{
+    LTRACEF("cookie %p, op %u, args %p\n", cookie, op, args);
+
+    if (op == USB_CB_ONLINE) {
+        usbc_setup_endpoint(1, USB_IN, 0x40);
+        usbc_setup_endpoint(1, USB_OUT, 0x40);
+
+        queue_rx();
+        queue_tx();
+    }
+    return NO_ERROR;
+}
+
+void target_usb_setup(void)
+{
+    usb_setup(&config);
+    printf("appending interfaces\n");
+    usb_append_interface_lowspeed(if_descriptor_lowspeed, sizeof(if_descriptor_lowspeed));
+    usb_append_interface_highspeed(if_descriptor_lowspeed, sizeof(if_descriptor_lowspeed));
+
+    usb_add_string("LK", 1);
+    usb_add_string("LK Industries", 2);
+
+    usb_register_callback(&usb_cb, NULL);
+    usb_start();
+}
diff --git a/src/bsp/lk/target/uzed/include/target/debugconfig.h b/src/bsp/lk/target/uzed/include/target/debugconfig.h
new file mode 100644
index 0000000..3c74bc5
--- /dev/null
+++ b/src/bsp/lk/target/uzed/include/target/debugconfig.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 1
diff --git a/src/bsp/lk/target/uzed/include/target/gpioconfig.h b/src/bsp/lk/target/uzed/include/target/gpioconfig.h
new file mode 100644
index 0000000..e8579e4
--- /dev/null
+++ b/src/bsp/lk/target/uzed/include/target/gpioconfig.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2015 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+/* gpios on the microzed target */
+#define GPIO_LEDR       (47)
+
diff --git a/src/bsp/lk/target/uzed/rules.mk b/src/bsp/lk/target/uzed/rules.mk
new file mode 100644
index 0000000..a5bb54d
--- /dev/null
+++ b/src/bsp/lk/target/uzed/rules.mk
@@ -0,0 +1,19 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+PLATFORM := zynq
+
+# set the system base to sram
+ZYNQ_USE_SRAM ?= 1
+
+ZYNQ_SDRAM_SIZE := 0x10000000
+
+GLOBAL_DEFINES += \
+	EXTERNAL_CLOCK_FREQ=33333333 \
+	TARGET_HAS_DEBUG_LED=1 \
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/target.c
+
+include make/module.mk
diff --git a/src/bsp/lk/target/uzed/target.c b/src/bsp/lk/target/uzed/target.c
new file mode 100644
index 0000000..2129e71
--- /dev/null
+++ b/src/bsp/lk/target/uzed/target.c
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2014 Chris Anderson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <stdio.h>
+#include <dev/gpio.h>
+#include <target/gpioconfig.h>
+#include <lib/pktbuf.h>
+#include <kernel/vm.h>
+#include <platform/zynq.h>
+#include <platform/gem.h>
+
+zynq_pll_cfg_tree_t zynq_pll_cfg = {
+    .arm = {
+        .lock_cnt = 250,
+        .cp = 2,
+        .res = 2,
+        .fdiv = 40,
+    },
+    .ddr = {
+        .lock_cnt = 300,
+        .cp = 2,
+        .res = 2,
+        .fdiv = 32,
+    },
+    .io = {
+        .lock_cnt = 325,
+        .cp = 2,
+        .res = 12,
+        .fdiv = 30,
+    }
+};
+
+const unsigned long zynq_ddr_cfg[] = {
+    0XF8006000, 0x00000080U, 0XF8006004, 0x00001081U, 0XF8006008, 0x03C0780FU,
+    0XF800600C, 0x02001001U, 0XF8006010, 0x00014001U, 0XF8006014, 0x0004281AU,
+    0XF8006018, 0x44E458D2U, 0XF800601C, 0x720238E5U, 0XF8006020, 0x270872D0U,
+    0XF8006024, 0x00000000U, 0XF8006028, 0x00002007U, 0XF800602C, 0x00000008U,
+    0XF8006030, 0x00040930U, 0XF8006034, 0x00011054U, 0XF8006038, 0x00000000U,
+    0XF800603C, 0x00000777U, 0XF8006040, 0xFFF00000U, 0XF8006044, 0x0F666666U,
+    0XF8006048, 0x0003C000U, 0XF8006050, 0x77010800U, 0XF8006058, 0x00000000U,
+    0XF800605C, 0x00005003U, 0XF8006060, 0x0000003EU, 0XF8006064, 0x00020000U,
+    0XF8006068, 0x00284141U, 0XF800606C, 0x00001610U, 0XF8006078, 0x00466111U,
+    0XF800607C, 0x00032222U, 0XF80060A4, 0x10200802U, 0XF80060A8, 0x0690CB73U,
+    0XF80060AC, 0x000001FEU, 0XF80060B0, 0x1CFFFFFFU, 0XF80060B4, 0x00000200U,
+    0XF80060B8, 0x00200066U, 0XF80060C4, 0x00000003U, 0XF80060C4, 0x00000000U,
+    0XF80060C8, 0x00000000U, 0XF80060DC, 0x00000000U, 0XF80060F0, 0x00000000U,
+    0XF80060F4, 0x00000008U, 0XF8006114, 0x00000000U, 0XF8006118, 0x40000001U,
+    0XF800611C, 0x40000001U, 0XF8006120, 0x40000001U, 0XF8006124, 0x40000001U,
+    0XF800612C, 0x0002C000U, 0XF8006130, 0x0002C400U, 0XF8006134, 0x0002F003U,
+    0XF8006138, 0x0002EC03U, 0XF8006140, 0x00000035U, 0XF8006144, 0x00000035U,
+    0XF8006148, 0x00000035U, 0XF800614C, 0x00000035U, 0XF8006154, 0x00000077U,
+    0XF8006158, 0x00000077U, 0XF800615C, 0x00000083U, 0XF8006160, 0x00000083U,
+    0XF8006168, 0x00000105U, 0XF800616C, 0x00000106U, 0XF8006170, 0x00000111U,
+    0XF8006174, 0x00000110U, 0XF800617C, 0x000000B7U, 0XF8006180, 0x000000B7U,
+    0XF8006184, 0x000000C3U, 0XF8006188, 0x000000C3U, 0XF8006190, 0x00040080U,
+    0XF8006194, 0x0001FC82U, 0XF8006204, 0x00000000U, 0XF8006208, 0x000003FFU,
+    0XF800620C, 0x000003FFU, 0XF8006210, 0x000003FFU, 0XF8006214, 0x000003FFU,
+    0XF8006218, 0x000003FFU, 0XF800621C, 0x000003FFU, 0XF8006220, 0x000003FFU,
+    0XF8006224, 0x000003FFU, 0XF80062A8, 0x00000000U, 0XF80062AC, 0x00000000U,
+    0XF80062B0, 0x00005125U, 0XF80062B4, 0x000012A8U,
+};
+
+const unsigned long zynq_ddr_cfg_cnt = countof(zynq_ddr_cfg);
+
+const zynq_ddriob_cfg_t zynq_ddriob_cfg = {
+    .addr0 = DDRIOB_OUTPUT_EN(0x3),
+    .addr1 = DDRIOB_OUTPUT_EN(0x3),
+    .data0 = DDRIOB_INP_TYPE(1) | DDRIOB_TERM_EN | DDRIOB_DCI_TYPE(0x3) | DDRIOB_OUTPUT_EN(0x3),
+    .data1 = DDRIOB_INP_TYPE(1) | DDRIOB_TERM_EN | DDRIOB_DCI_TYPE(0x3) | DDRIOB_OUTPUT_EN(0x3),
+    .diff0 = DDRIOB_INP_TYPE(2) | DDRIOB_TERM_EN | DDRIOB_DCI_TYPE(0x3) | DDRIOB_OUTPUT_EN(0x3),
+    .diff1 = DDRIOB_INP_TYPE(2) | DDRIOB_TERM_EN | DDRIOB_DCI_TYPE(0x3) | DDRIOB_OUTPUT_EN(0x3),
+    .ibuf_disable = false,
+    .term_disable = false,
+};
+
+const uint32_t zynq_mio_cfg[ZYNQ_MIO_CNT] = {
+    [0] = MIO_IO_TYPE_LVCMOS33,
+    [1] = MIO_L0_SEL | MIO_IO_TYPE_LVCMOS33,
+    [2] = MIO_L0_SEL | MIO_IO_TYPE_LVCMOS33,
+    [3] = MIO_L0_SEL | MIO_IO_TYPE_LVCMOS33,
+    [4] = MIO_L0_SEL | MIO_IO_TYPE_LVCMOS33,
+    [5] = MIO_L0_SEL | MIO_IO_TYPE_LVCMOS33,
+    [6] = MIO_L0_SEL | MIO_IO_TYPE_LVCMOS33,
+    [7] = MIO_IO_TYPE_LVCMOS33,
+    [8] = MIO_L0_SEL | MIO_IO_TYPE_LVCMOS33,
+    [9] = MIO_IO_TYPE_LVCMOS33,
+    [10] = MIO_IO_TYPE_LVCMOS33,
+    [11] = MIO_IO_TYPE_LVCMOS33,
+    [12] = MIO_IO_TYPE_LVCMOS33,
+    [13] = MIO_IO_TYPE_LVCMOS33,
+    [14] = MIO_IO_TYPE_LVCMOS33,
+    [15] = MIO_IO_TYPE_LVCMOS33,
+    // 16-21 gem0
+    [16] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP | MIO_DISABLE_RCVR,
+    [17] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP | MIO_DISABLE_RCVR,
+    [18] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP | MIO_DISABLE_RCVR,
+    [19] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP | MIO_DISABLE_RCVR,
+    [20] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP | MIO_DISABLE_RCVR,
+    [21] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP | MIO_DISABLE_RCVR,
+    // 22-27 gem0
+    [22] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP,
+    [23] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP,
+    [24] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP,
+    [25] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP,
+    [26] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP,
+    [27] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP,
+    [28] = MIO_L1_SEL | MIO_IO_TYPE_LVCMOS18,
+    [29] = MIO_TRI_ENABLE | MIO_L1_SEL | MIO_IO_TYPE_LVCMOS18,
+    [30] = MIO_L1_SEL | MIO_IO_TYPE_LVCMOS18,
+    [31] = MIO_TRI_ENABLE | MIO_L1_SEL | MIO_IO_TYPE_LVCMOS18,
+    [32] = MIO_L1_SEL | MIO_IO_TYPE_LVCMOS18,
+    [33] = MIO_L1_SEL | MIO_IO_TYPE_LVCMOS18,
+    [34] = MIO_L1_SEL | MIO_IO_TYPE_LVCMOS18,
+    [35] = MIO_L1_SEL | MIO_IO_TYPE_LVCMOS18,
+    [36] = MIO_TRI_ENABLE | MIO_L1_SEL | MIO_IO_TYPE_LVCMOS18,
+    [37] = MIO_L1_SEL | MIO_IO_TYPE_LVCMOS18,
+    [38] = MIO_L1_SEL | MIO_IO_TYPE_LVCMOS18,
+    [39] = MIO_L1_SEL | MIO_IO_TYPE_LVCMOS18,
+    [40] = MIO_L3_SEL(0x4) | MIO_IO_TYPE_LVCMOS18,
+    [41] = MIO_L3_SEL(0x4) | MIO_IO_TYPE_LVCMOS18,
+    [42] = MIO_L3_SEL(0x4) | MIO_IO_TYPE_LVCMOS18,
+    [43] = MIO_L3_SEL(0x4) | MIO_IO_TYPE_LVCMOS18,
+    [44] = MIO_L3_SEL(0x4) | MIO_IO_TYPE_LVCMOS18,
+    [45] = MIO_L3_SEL(0x4) | MIO_IO_TYPE_LVCMOS18,
+    [46] = MIO_TRI_ENABLE | MIO_IO_TYPE_LVCMOS18,
+    [47] = MIO_IO_TYPE_LVCMOS18,
+    [48] = MIO_L3_SEL(0x7) | MIO_IO_TYPE_LVCMOS18,
+    [49] = MIO_TRI_ENABLE | MIO_L3_SEL(0x7) | MIO_IO_TYPE_LVCMOS18,
+    [50] = MIO_TRI_ENABLE | MIO_IO_TYPE_LVCMOS18,
+    [51] = MIO_IO_TYPE_LVCMOS18,
+    // 52-53 gem0
+    [52] = MIO_L3_SEL(0x4) | MIO_IO_TYPE_LVCMOS18 | MIO_PULLUP,
+    [53] = MIO_L3_SEL(0x4) | MIO_IO_TYPE_LVCMOS18 | MIO_PULLUP,
+};
+
+const zynq_clk_cfg_t zynq_clk_cfg = {
+    .arm_clk    = ARM_CLK_CTRL_DIVISOR(2) | ARM_CLK_CTRL_CPU_6OR4XCLKACT |
+                    ARM_CLK_CTRL_CPU_3OR2XCLKACT | ARM_CLK_CTRL_CPU_2XCLKACT |
+                    ARM_CLK_CTRL_CPU_1XCLKACT | ARM_CLK_CTRL_PERI_CLKACT,
+    .ddr_clk    = DDR_CLK_CTRL_DDR_3XCLKACT | DDR_CLK_CTRL_DDR_2XCLKACT |
+                    DDR_CLK_CTRL_DDR_3XCLK_DIV(2) | DDR_CLK_CTRL_DDR_2XCLK_DIV(3),
+    .dci_clk    = CLK_CTRL_CLKACT | CLK_CTRL_DIVISOR0(35) | CLK_CTRL_DIVISOR1(3),
+    .gem0_clk   = CLK_CTRL_CLKACT | CLK_CTRL_DIVISOR0(8) | CLK_CTRL_DIVISOR1(1),
+    .gem0_rclk  = CLK_CTRL_CLKACT,
+    .lqspi_clk  = CLK_CTRL_CLKACT | CLK_CTRL_DIVISOR0(5),
+    .sdio_clk   = CLK_CTRL_CLKACT | CLK_CTRL_DIVISOR0(20),
+    .uart_clk   = CLK_CTRL_CLKACT1 | CLK_CTRL_DIVISOR0(20),
+    .pcap_clk   = CLK_CTRL_CLKACT | CLK_CTRL_DIVISOR0(5),
+    .fpga0_clk  = CLK_CTRL_DIVISOR0(10) | CLK_CTRL_DIVISOR1(1),
+    .fpga1_clk  = CLK_CTRL_DIVISOR0(10) | CLK_CTRL_DIVISOR1(1),
+    .fpga2_clk  = CLK_CTRL_DIVISOR0(30) | CLK_CTRL_DIVISOR1(1),
+    .fpga3_clk  = CLK_CTRL_DIVISOR0(20) | CLK_CTRL_DIVISOR1(1),
+    .aper_clk   = DMA_CPU_CLK_EN | USB0_CPU_CLK_EN | USB1_CPU_CLK_EN | GEM0_CPU_CLK_EN |
+                    SDI0_CPU_CLK_EN | I2C0_CPU_CLK_EN | I2C1_CPU_CLK_EN | UART1_CPU_CLK_EN |
+                    GPIO_CPU_CLK_EN | LQSPI_CPU_CLK_EN | SMC_CPU_CLK_EN,
+    .clk_621_true = CLK_621_ENABLE,
+};
+
+void target_early_init(void)
+{
+    gpio_config(GPIO_LEDR, GPIO_OUTPUT);
+    gpio_set(GPIO_LEDR, 0);
+}
+
+void target_init(void)
+{
+    gem_init(GEM0_BASE);
+}
+
+void target_set_debug_led(unsigned int led, bool on)
+{
+    if (led == 0)
+        gpio_set(GPIO_LEDR, on);
+}
+
diff --git a/src/bsp/lk/target/zybo-microblaze/include/target/debugconfig.h b/src/bsp/lk/target/zybo-microblaze/include/target/debugconfig.h
new file mode 100644
index 0000000..554bdc1
--- /dev/null
+++ b/src/bsp/lk/target/zybo-microblaze/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2015 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/zybo-microblaze/include/target/microblaze-config.h b/src/bsp/lk/target/zybo-microblaze/include/target/microblaze-config.h
new file mode 100644
index 0000000..8afc6b7
--- /dev/null
+++ b/src/bsp/lk/target/zybo-microblaze/include/target/microblaze-config.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+/* zybo-microblaze is a project running on zybo */
+#define MDM_BASEADDR        0x40000000
+#define TIMER_BASEADDR      0x40001000
+#define GPIO_BASEADDR       0x40002000
+#define INTC_BASEADDR       0x40003000
+#define UARTLITE_BASEADDR   0x40004000
+
+#define TIMER_IRQ           0
+#define GPIO_IRQ            1
+#define MDM_IRQ             2
+#define UARTLITE_IRQ        3
+#define MAX_INT             4
+
+#define TIMER_RATE (100000000)
+
diff --git a/src/bsp/lk/target/zybo-microblaze/rules.mk b/src/bsp/lk/target/zybo-microblaze/rules.mk
new file mode 100644
index 0000000..f57e896
--- /dev/null
+++ b/src/bsp/lk/target/zybo-microblaze/rules.mk
@@ -0,0 +1,14 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+GLOBAL_INCLUDES += \
+	$(LOCAL_DIR)/include
+
+PLATFORM := microblaze
+
+MEMBASE ?= 0x10000000
+MEMSIZE ?= 0x01000000
+VECTOR_BASE_PHYS := 0x10000000
+LITTLE_ENDIAN := 1
+
+#include make/module.mk
+
diff --git a/src/bsp/lk/target/zybo/include/target/debugconfig.h b/src/bsp/lk/target/zybo/include/target/debugconfig.h
new file mode 100644
index 0000000..3c74bc5
--- /dev/null
+++ b/src/bsp/lk/target/zybo/include/target/debugconfig.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 1
diff --git a/src/bsp/lk/target/zybo/include/target/gpioconfig.h b/src/bsp/lk/target/zybo/include/target/gpioconfig.h
new file mode 100644
index 0000000..b45cff1
--- /dev/null
+++ b/src/bsp/lk/target/zybo/include/target/gpioconfig.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015 Christopher Anderson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+/* gpios on the zybo target */
+#define GPIO_LEDY       (7)
+#define ZYBO_BTN4       (50)
+#define ZYBO_BTN5       (51)
+
diff --git a/src/bsp/lk/target/zybo/rules.mk b/src/bsp/lk/target/zybo/rules.mk
new file mode 100644
index 0000000..2df01d3
--- /dev/null
+++ b/src/bsp/lk/target/zybo/rules.mk
@@ -0,0 +1,20 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+PLATFORM := zynq
+
+# set the system base to sram
+ZYNQ_USE_SRAM ?= 1
+
+# we have sdram
+ZYNQ_SDRAM_SIZE := 0x20000000
+
+GLOBAL_DEFINES += \
+	EXTERNAL_CLOCK_FREQ=50000000 \
+	TARGET_HAS_DEBUG_LED=1
+
+MODULE_SRCS += \
+	$(LOCAL_DIR)/target.c
+
+include make/module.mk
diff --git a/src/bsp/lk/target/zybo/target.c b/src/bsp/lk/target/zybo/target.c
new file mode 100644
index 0000000..33e0df7
--- /dev/null
+++ b/src/bsp/lk/target/zybo/target.c
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ * Copyright (c) 2014 Chris Anderson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <dev/gpio.h>
+#include <lib/pktbuf.h>
+#include <kernel/vm.h>
+#include <platform/zynq.h>
+#include <platform/gem.h>
+#include <platform/gpio.h>
+#include <platform/interrupts.h>
+#include <target/gpioconfig.h>
+
+zynq_pll_cfg_tree_t zynq_pll_cfg = {
+    .arm = {
+        .lock_cnt = 375,
+        .cp = 2,
+        .res = 12,
+        .fdiv = 26,
+    },
+    .ddr = {
+        .lock_cnt = 475,
+        .cp = 2,
+        .res = 12,
+        .fdiv = 26,
+    },
+    .io = {
+        .lock_cnt = 500,
+        .cp = 2,
+        .res = 12,
+        .fdiv = 20,
+    }
+};
+
+const unsigned long zynq_ddr_cfg[] = {
+    0XF8006000, 0x00000080U, 0XF8006004, 0x0000107FU, 0XF8006008, 0x03C0780FU,
+    0XF800600C, 0x02001001U, 0XF8006010, 0x00014001U, 0XF8006014, 0x0004151AU,
+    0XF8006018, 0x44E354D2U, 0XF800601C, 0x720238E5U, 0XF8006020, 0x270872D0U,
+    0XF8006024, 0x00000000U, 0XF8006028, 0x00002007U, 0XF800602C, 0x00000008U,
+    0XF8006030, 0x00040930U, 0XF8006034, 0x00011014U, 0XF8006038, 0x00000000U,
+    0XF800603C, 0x00000777U, 0XF8006040, 0xFFF00000U, 0XF8006044, 0x0FF66666U,
+    0XF8006048, 0x0003C000U, 0XF8006050, 0x77010800U, 0XF8006058, 0x00000000U,
+    0XF800605C, 0x00005003U, 0XF8006060, 0x0000003EU, 0XF8006064, 0x00020000U,
+    0XF8006068, 0x00284141U, 0XF800606C, 0x00001610U, 0XF80060A4, 0x10200802U,
+    0XF80060A8, 0x0670C845U, 0XF80060AC, 0x000001FEU, 0XF80060B0, 0x1CFFFFFFU,
+    0XF80060B4, 0x00000200U, 0XF80060B8, 0x00200066U, 0XF80060C4, 0x00000003U,
+    0XF80060C4, 0x00000000U, 0XF80060C8, 0x00000000U, 0XF80060DC, 0x00000000U,
+    0XF80060F0, 0x00000000U, 0XF80060F4, 0x00000008U, 0XF8006114, 0x00000000U,
+    0XF8006118, 0x40000001U, 0XF800611C, 0x40000001U, 0XF8006120, 0x40000001U,
+    0XF8006124, 0x40000001U, 0XF800612C, 0x00023C00U, 0XF8006130, 0x00022800U,
+    0XF8006134, 0x00022C00U, 0XF8006138, 0x00024800U, 0XF8006140, 0x00000035U,
+    0XF8006144, 0x00000035U, 0XF8006148, 0x00000035U, 0XF800614C, 0x00000035U,
+    0XF8006154, 0x00000077U, 0XF8006158, 0x0000007CU, 0XF800615C, 0x0000007CU,
+    0XF8006160, 0x00000075U, 0XF8006168, 0x000000E4U, 0XF800616C, 0x000000DFU,
+    0XF8006170, 0x000000E0U, 0XF8006174, 0x000000E7U, 0XF800617C, 0x000000B7U,
+    0XF8006180, 0x000000BCU, 0XF8006184, 0x000000BCU, 0XF8006188, 0x000000B5U,
+    0XF8006190, 0x00040080U, 0XF8006194, 0x0001FC82U, 0XF8006204, 0x00000000U,
+    0XF8006208, 0x000003FFU, 0XF800620C, 0x000003FFU, 0XF8006210, 0x000003FFU,
+    0XF8006214, 0x000003FFU, 0XF8006218, 0x000003FFU, 0XF800621C, 0x000003FFU,
+    0XF8006220, 0x000003FFU, 0XF8006224, 0x000003FFU, 0XF80062A8, 0x00000000U,
+    0XF80062AC, 0x00000000U, 0XF80062B0, 0x00005125U, 0XF80062B4, 0x000012A6U,
+};
+
+const unsigned long zynq_ddr_cfg_cnt = countof(zynq_ddr_cfg);
+
+const zynq_ddriob_cfg_t zynq_ddriob_cfg = {
+    .addr0 = DDRIOB_OUTPUT_EN(0x3),
+    .addr1 = DDRIOB_OUTPUT_EN(0x3),
+    .data0 = DDRIOB_INP_TYPE(1) | DDRIOB_TERM_EN | DDRIOB_DCI_TYPE(0x3) | DDRIOB_OUTPUT_EN(0x3),
+    .data1 = DDRIOB_INP_TYPE(1) | DDRIOB_TERM_EN | DDRIOB_DCI_TYPE(0x3) | DDRIOB_OUTPUT_EN(0x3),
+    .diff0 = DDRIOB_INP_TYPE(2) | DDRIOB_TERM_EN | DDRIOB_DCI_TYPE(0x3) | DDRIOB_OUTPUT_EN(0x3),
+    .diff1 = DDRIOB_INP_TYPE(2) | DDRIOB_TERM_EN | DDRIOB_DCI_TYPE(0x3) | DDRIOB_OUTPUT_EN(0x3),
+    .ibuf_disable = false,
+    .term_disable = false,
+};
+
+const uint32_t zynq_mio_cfg[ZYNQ_MIO_CNT] = {
+    [0] = MIO_DEFAULT,
+    [1] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS33,
+    [2] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS33,
+    [3] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS33,
+    [4] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS33,
+    [5] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS33,
+    [6] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS33,
+    // LED4
+    [7] = MIO_IO_TYPE_LVCMOS18 | MIO_DISABLE_RCVR,
+    [8] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS33,
+    // 16-21 gem0
+    [9] = MIO_DEFAULT,
+    [10] = MIO_DEFAULT,
+    [11] = MIO_DEFAULT,
+    [12] = MIO_DEFAULT,
+    [13] = MIO_DEFAULT,
+    [14] = MIO_DEFAULT,
+    [15] = MIO_DEFAULT,
+    [16] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP | MIO_DISABLE_RCVR,
+    [17] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP | MIO_DISABLE_RCVR,
+    [18] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP | MIO_DISABLE_RCVR,
+    [19] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP | MIO_DISABLE_RCVR,
+    [20] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP | MIO_DISABLE_RCVR,
+    [21] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP | MIO_DISABLE_RCVR,
+    // 22-27 gem0
+    [22] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP,
+    [23] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP,
+    [24] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP,
+    [25] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP,
+    [26] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP,
+    [27] = MIO_L0_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_HSTL | MIO_PULLUP,
+    [28] = MIO_L1_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [29] = MIO_L1_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18 | MIO_TRI_ENABLE,
+    [30] = MIO_L1_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [31] = MIO_L1_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18 | MIO_TRI_ENABLE,
+    [32] = MIO_L1_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [33] = MIO_L1_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [34] = MIO_L1_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [35] = MIO_L1_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [36] = MIO_L1_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18 | MIO_TRI_ENABLE,
+    [37] = MIO_L1_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [38] = MIO_L1_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [39] = MIO_L1_SEL | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [40] = MIO_L3_SEL(0x4) | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [41] = MIO_L3_SEL(0x4) | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [42] = MIO_L3_SEL(0x4) | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [43] = MIO_L3_SEL(0x4) | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [44] = MIO_L3_SEL(0x4) | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [45] = MIO_L3_SEL(0x4) | MIO_SPEED_FAST | MIO_IO_TYPE_LVCMOS18,
+    [47] = MIO_TRI_ENABLE | MIO_IO_TYPE_LVCMOS18,
+    [48] = MIO_L3_SEL(0x7) | MIO_IO_TYPE_LVCMOS18,
+    [49] = MIO_TRI_ENABLE | MIO_L3_SEL(0x7) | MIO_IO_TYPE_LVCMOS18,
+    // 50-51 are BTN4 and BTN5
+    [50] = MIO_IO_TYPE_LVCMOS18 | MIO_DISABLE_RCVR,
+    [51] = MIO_IO_TYPE_LVCMOS18 | MIO_DISABLE_RCVR,
+    // 52-53 gem0
+    [52] = MIO_L3_SEL(0x4) | MIO_IO_TYPE_LVCMOS18 | MIO_PULLUP,
+    [53] = MIO_L3_SEL(0x4) | MIO_IO_TYPE_LVCMOS18 | MIO_PULLUP,
+};
+
+const zynq_clk_cfg_t zynq_clk_cfg = {
+    .arm_clk    = ARM_CLK_CTRL_DIVISOR(2) | ARM_CLK_CTRL_CPU_6OR4XCLKACT |
+                    ARM_CLK_CTRL_CPU_3OR2XCLKACT | ARM_CLK_CTRL_CPU_2XCLKACT |
+                    ARM_CLK_CTRL_CPU_1XCLKACT |ARM_CLK_CTRL_PERI_CLKACT,
+    .ddr_clk    = DDR_CLK_CTRL_DDR_3XCLKACT | DDR_CLK_CTRL_DDR_2XCLKACT |
+                    DDR_CLK_CTRL_DDR_3XCLK_DIV(2) | DDR_CLK_CTRL_DDR_2XCLK_DIV(3),
+    .dci_clk    = CLK_CTRL_CLKACT | CLK_CTRL_DIVISOR0(52) | CLK_CTRL_DIVISOR1(2),
+    .gem0_clk   = CLK_CTRL_CLKACT | CLK_CTRL_DIVISOR0(8) | CLK_CTRL_DIVISOR1(1),
+    .gem0_rclk  = CLK_CTRL_CLKACT,
+    .lqspi_clk  = CLK_CTRL_CLKACT | CLK_CTRL_DIVISOR0(5),
+    .sdio_clk   = CLK_CTRL_CLKACT | CLK_CTRL_DIVISOR0(20),
+    .uart_clk   = CLK_CTRL_CLKACT1 | CLK_CTRL_DIVISOR0(20),
+    .pcap_clk   = CLK_CTRL_CLKACT | CLK_CTRL_DIVISOR0(5),
+    .fpga0_clk  = CLK_CTRL_DIVISOR0(10) | CLK_CTRL_DIVISOR1(1),
+    .fpga1_clk  = CLK_CTRL_SRCSEL(3) | CLK_CTRL_DIVISOR0(6) | CLK_CTRL_DIVISOR1(1),
+    .fpga2_clk  = CLK_CTRL_SRCSEL(2) | CLK_CTRL_DIVISOR0(53) | CLK_CTRL_DIVISOR1(2),
+    .fpga3_clk  = CLK_CTRL_DIVISOR1(1),
+    .aper_clk   = DMA_CPU_CLK_EN | USB0_CPU_CLK_EN | USB1_CPU_CLK_EN |
+                    GEM0_CPU_CLK_EN | SDI0_CPU_CLK_EN | I2C0_CPU_CLK_EN |
+                    I2C1_CPU_CLK_EN | UART1_CPU_CLK_EN | GPIO_CPU_CLK_EN |
+                    LQSPI_CPU_CLK_EN | SMC_CPU_CLK_EN,
+    .clk_621_true = CLK_621_ENABLE,
+};
+
+void target_early_init(void)
+{
+    gpio_config(GPIO_LEDY, GPIO_OUTPUT);
+    gpio_set(GPIO_LEDY, 0);
+}
+
+static enum handler_return toggle_ledy(void *arg) {
+    static bool on = false;
+
+    gpio_set(GPIO_LEDY, on);
+    on = !on;
+
+    return INT_NO_RESCHEDULE;
+}
+
+void target_set_debug_led(unsigned int led, bool on)
+{
+    if (led == 0) {
+        gpio_set(GPIO_LEDY, on);
+    }
+}
+void target_init(void)
+{
+    gem_init(GEM0_BASE);
+
+    register_gpio_int_handler(ZYBO_BTN5, toggle_ledy, NULL);
+    zynq_unmask_gpio_interrupt(ZYBO_BTN5);
+}
+
+