ext: hal: Add MSP432P4XX SDK Kconfig/Build support

This patch adds Kconfig/build support to MSP432P4XX
SDK. MSP432P4XX microcontrollers have driverlib flashed
onto the ROM, which will be used by default.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
diff --git a/ext/hal/ti/simplelink/Kbuild b/ext/hal/ti/simplelink/Kbuild
index f5a107c..5b968eb 100644
--- a/ext/hal/ti/simplelink/Kbuild
+++ b/ext/hal/ti/simplelink/Kbuild
@@ -1,4 +1,5 @@
-ccflags-$(CONFIG_HAS_CC3220SDK) += -D$(COMPILER)
+ifeq ($(CONFIG_HAS_CC3220SDK),y)
+ccflags-y += -D$(COMPILER)
 # Need to build prcm, utils and pin, which are not in ROM
 obj-$(CONFIG_HAS_CC3220SDK) += source/ti/devices/cc32xx/driverlib/utils.o
 obj-$(CONFIG_HAS_CC3220SDK) += source/ti/devices/cc32xx/driverlib/prcm.o
@@ -35,3 +36,10 @@
 obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += kernel/zephyr/dpl/SemaphoreP_zephyr.o
 obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += kernel/zephyr/dpl/ClockP_zephyr.o
 obj-$(CONFIG_SIMPLELINK_HOST_DRIVER) += kernel/zephyr/dpl/HwiP_zephyr.o
+endif
+
+ifeq ($(CONFIG_HAS_MSP432P4XXSDK),y)
+ccflags-y += -D$(COMPILER)
+# Need system_msp432p401r for SystemInit which is not in ROM
+obj-y += source/ti/devices/msp432p4xx/startup_system_files/system_msp432p401r.o
+endif
diff --git a/ext/hal/ti/simplelink/Kconfig b/ext/hal/ti/simplelink/Kconfig
index 362b9aa..f01c23a 100644
--- a/ext/hal/ti/simplelink/Kconfig
+++ b/ext/hal/ti/simplelink/Kconfig
@@ -15,3 +15,9 @@
 	select ERRNO
 	help
 	Build the SimpleLink host driver
+
+# Kconfig - MSP432 SDK HAL configuration
+
+config HAS_MSP432P4XXSDK
+        bool
+        select HAS_CMSIS
diff --git a/ext/hal/ti/simplelink/Makefile b/ext/hal/ti/simplelink/Makefile
index a3c94eb..89374df 100644
--- a/ext/hal/ti/simplelink/Makefile
+++ b/ext/hal/ti/simplelink/Makefile
@@ -4,9 +4,15 @@
 ZEPHYRINCLUDE +=-I$(srctree)/ext/hal/ti/simplelink/source/ti/devices/cc32xx/driverlib
 KBUILD_CFLAGS += -DUSE_CC3220_ROM_DRV_API
 endif # CONFIG_HAS_CC3220SDK
+
 ifdef CONFIG_SIMPLELINK_HOST_DRIVER
 ZEPHYRINCLUDE +=-I$(srctree)/ext/hal/ti/simplelink/source
 ZEPHYRINCLUDE +=-I$(srctree)/ext/hal/ti/simplelink/kernel/zephyr/dpl
 KBUILD_CFLAGS += -DSL_SUPPORT_IPV6
 KBUILD_CFLAGS += -DSL_PLATFORM_MULTI_THREADED
 endif # CONFIG_SIMPLELINK_HOST_DRIVER
+
+ifdef CONFIG_HAS_MSP432P4XXSDK
+ZEPHYRINCLUDE +=-I$(srctree)/ext/hal/ti/simplelink/source/
+ZEPHYRINCLUDE +=-I$(srctree)/ext/hal/ti/simplelink/source/ti/devices/msp432p4xx
+endif  # CONFIG_HAS_MSP432P4XXSDK
diff --git a/ext/hal/ti/simplelink/README b/ext/hal/ti/simplelink/README
index 2f8e2cf..f657c08 100644
--- a/ext/hal/ti/simplelink/README
+++ b/ext/hal/ti/simplelink/README
@@ -5,6 +5,8 @@
 For an explanation of the SimpleLink family SDK directory structure, see:
 http://dev.ti.com/tirex/content/simplelink_cc13x0_sdk_1_30_00_06/docs/simplelink_mcu_sdk/Users_Guide.html#directory-structure
 
+1. CC3220 SDK
+
 The current version supported in Zephyr is the SimpleLink CC3220 SDK
 1.50.00.06, downloaded from:
 
@@ -39,3 +41,22 @@
 Setting CONFIG_SIMPLELINK_HOST_DRIVER=y builds the SimpleLink Host
 Driver, which communicates over dedicated SPI to the
 network coprocessor.
+
+2. MSP432 SDK
+
+The current version supported in Zephyr is MSP432 SDK V1.50.00.12, downloaded
+from:
+
+        http://www.ti.com/tool/simplelink-msp432-sdk
+
+Files in source/ti/devices/msp432p4xx/driverlib/ and inc/ are copied from
+a Linux SDK installation (without modification).
+
+TI provides the driver library functions burned into ROM at the factory,
+or updated via a service pack patch, thus saving application code space.
+
+Calling driverlib APIs prefixed by "MAP_" will vector to those functions
+already existing in ROM.
+
+After setting CONFIG_HAS_MSP432P4XXSDK=y in Kconfig, most of the
+peripheral driver library functions will be accessible from ROM.