[Update 2] I got the ieee_802_15_4 Connectivity_Test for the usbkw24d512 to build and run in KDS!! The project is located in:
C:\Freescale\KW2xD_SMAC\app\ieee_802_15_4\Connectivity_Test\usbkw24d512
The steps to build it were lengthy, sorry for the long post. I basically just started a fresh c project in KDS, and included things as needed to get it all to build. Most of the post is project settings, but there are a few minor code changes to get it to build/run. Just to reiterate, I had to do this because the SMAC example projects were all in IAR, and I wanted to use KDS instead.
This process will likely be obsolete when NXP/Freescale releases their SDK v2.0 code for KW2x (expected May, 2016)Introducing Kinetis SDK v2
---START---
Prerequisites:
Install KDS 3.0.0
Install ARM gcc compiler
Install KSDK v1.2.0
Install KW2xD_SMAC
Jlink(or other debugger) drivers
Project Files & Folders
Start a new C project...
Name it.
Select Empty project
Select Cross ARM GCC
Accept defaults for the rest
Finish.
Copy these folders into your recently created project folder (they’re surprisingly big=199MB)
C:\Freescale\KW2xD_SMAC\app
C:\Freescale\KW2xD_SMAC\boards
C:\Freescale\KW2xD_SMAC\drv
C:\Freescale\KW2xD_SMAC\framework
C:\Freescale\KW2xD_SMAC\ieee_802_15_4
Delete stuff you don’t need out of your project folder. This might be optional, depending on how mad Eclipse gets. I deleted everything listed.
\app\ieee_802_15_4\Connectivity_Test\frdmkw24
\app\ieee_802_15_4\Connectivity_Test\twrkw21d256
\app\ieee_802_15_4\Connectivity_Test\twrkw24d512
\app\ieee_802_15_4\Connectivity_Test\usbkw24d512\build\iar
\app\ieee_802_15_4\Low_Power_Demo
\app\ieee_802_15_4\Wireless_Messenger
\app\ieee_802_15_4\Wireless_Uart
\boards\frdmkw24
\boards\twrkw21d256
\boards\twrkw24d512
\framework\LPM
\framework\OSAbstraction\Source\fsl_osa_ext_bm.c
\framework\OSAbstraction\Source\fsl_osa_ext_mqx.c
Refresh the project tree (F5)
Right-click project, select New -> Folder.
Name the folder ‘RTOS’
Add a sub-folder, call it ‘FreeRTOS’
Add another sub-folder, call it ‘Startup’
Import the .c, and .S file(s) from the folders below into the ‘FreeRTOS’ folder
C:\Freescale\KSDK_1.2.0\rtos\FreeRTOS\src\(all)
C:\Freescale\KSDK_1.2.0\rtos\FreeRTOS\port\gcc\(all)
Import the .c, and .S file(s) from the folders below into the ‘Startup’ folder
C:\Freescale\KSDK_1.2.0\platform\devices\startup.c
C:\Freescale\KSDK_1.2.0\platform\devices\MKW24D5\startup\system_MKW24D5.c
C:\Freescale\KSDK_1.2.0\platform\devices\MKW24D5\startup\gcc\startup_MKW24D5.S
Refresh the project tree (F5)
In the end, the structure should look like this:

Project Properties
Open the project properties (Alt+Enter)
Properties -> C/C++ Build -> Behavior -> Build settings
Un-check "Stop on first build error"
Properties -> C/C++ Build -> Environment -> Environment variables to set
Add...
Name: PROJECT_LOC
Value: <your project location> e.g. C:\Users\crust\workspace.kds\Connectivity_Test_usbkw24
Properties -> C/C++ Build -> Settings -> Tool Settings:
Target Processor -> ARM family
cortex-m4
Target Processor -> Float ABI
Library (soft)
Warnings
Check "Enable all common warnings (-Wall)
Cross ARM GNU Assembler -> Preprocessor -> Defined symbols (-D)
Add...
DEBUG
Cross ARM GNU Assembler -> Includes -> Include paths (-I)
Add...
${KSDK_PATH}\rtos\FreeRTOS\config\KW24D5\gcc
Cross ARM C Compiler -> Preprocessor -> Defined symbols (-D)
Add… (or just paste the whole list all at once)
_DEBUG=1
CPU_MKW24D512VHA5
USB_KW24D512
CLOCK_SETUP=4
FSL_RTOS_FREE_RTOS
gSerialMgrUseUSB_c=1
gSerialMgrUseUart_c=1
gFsciIncluded_c=0
gSmacSupported=1
"PoolsDetails_c=_block_size_ 64 _number_of_blocks_ 10 _eol_ _block_size_ 128 _number_of_blocks_ 2 _eol_ _block_size_ 256 _number_of_blocks_ 10 _eol_"
gKBD_KeysCount_c=1
gLEDsOnTargetBoardCnt_c=2
gEepromType_d=gEepromDevice_InternalFlash_c
Cross ARM C Compiler -> Includes -> Include paths (-I)
Add… (paste)
${PROJECT_LOC}\app\ieee_802_15_4\Connectivity_Test\common
${PROJECT_LOC}\boards\usbkw24d512
${PROJECT_LOC}\drv\Portable\LED\Interface
${PROJECT_LOC}\drv\Portable\Keyboard\Interface
${PROJECT_LOC}\drv\Portable\GPIO_IrqAdapter
${PROJECT_LOC}\drv\Portable\TMR_Adapter\
${PROJECT_LOC}\drv\Portable\SPI_Adapter\
${PROJECT_LOC}\drv\Portable\USB_VirtualCom\
${PROJECT_LOC}\framework\Common
${PROJECT_LOC}\framework\OSAbstraction\Interface
${PROJECT_LOC}\framework\Utils\Lists
${PROJECT_LOC}\framework\Utils\FunctionLib
${PROJECT_LOC}\framework\Utils\SecLib
${PROJECT_LOC}\framework\Utils\ModuleInfo
${PROJECT_LOC}\framework\RNG\Interface
${PROJECT_LOC}\framework\Panic\Interface
${PROJECT_LOC}\framework\SerialManager\Interface
${PROJECT_LOC}\framework\MemManager\Interface
${PROJECT_LOC}\framework\TimersManager\Interface
${PROJECT_LOC}\framework\TimersManager\Source
${PROJECT_LOC}\framework\Messaging\Interface
${PROJECT_LOC}\ieee_802_15_4\Source\Phy\Interface
${PROJECT_LOC}\ieee_802_15_4\Source\Phy\Source\MCR20A\MCR20Drv
${PROJECT_LOC}\ieee_802_15_4\Source\Phy\Source\XcvrSPI
${PROJECT_LOC}\ieee_802_15_4\Source\SMAC\Interface
${PROJECT_LOC}\ieee_802_15_4\Source\SMAC\Generic
${PROJECT_LOC}\ieee_802_15_4\Source\SMAC\Source
${PROJECT_LOC}\app\ieee_802_15_4\Connectivity_Test\usbkw24d512\Source
${KSDK_PATH}\platform\CMSIS\Include
${KSDK_PATH}\platform\devices\
${KSDK_PATH}\platform\devices\MKW24D5\include
${KSDK_PATH}\platform\devices\MKW24D5\startup
${KSDK_PATH}\platform\osa\inc
${KSDK_PATH}\platform\drivers\src\flash\C90TFS\drvsrc\include
${KSDK_PATH}\platform\drivers\inc
${KSDK_PATH}\platform\drivers\src\mmcau\asm-cm4
${KSDK_PATH}\platform\hal\inc
${KSDK_PATH}\platform\system\inc
${KSDK_PATH}\platform\system\src\clock\MKW24D5
${KSDK_PATH}\platform\utilities\inc
${KSDK_PATH}\rtos\FreeRTOS\port\gcc
${KSDK_PATH}\rtos\FreeRTOS\config\KW24D5\gcc
${KSDK_PATH}\rtos\FreeRTOS\include
${KSDK_PATH}\rtos\FreeRTOS\src
${KSDK_PATH}\usb\adapter\sources
${KSDK_PATH}\usb\adapter\sources\sdk
${KSDK_PATH}\usb\usb_core\include
${KSDK_PATH}\usb\usb_core\device\include
${KSDK_PATH}\usb\usb_core\device\include\usbkw24d512
${KSDK_PATH}\usb\usb_core\device\sources\classes\include
${KSDK_PATH}\usb\usb_core\device\sources\classes\include\config
${KSDK_PATH}\usb\usb_core\device\sources\classes\cdc
Cross ARM C Compiler -> Optimization -> Language standard
GNU ISO C99
Cross ARM C Linker -> General -> Script files (-T)
Add...
“${KSDK_PATH}\platform\devices\MKW24D5\linker\gcc\MKW24D512xxx5_flash.ld”
Cross ARM C Linker -> General
Un-Check "Remove unused sections (-Xlinker --gc-sections)" [at least until you know it’s building okay]
Cross ARM C Linker -> Libraries -> Libraries (-I)
Add...
m
g
gcc
nosys
Cross ARM C Linker -> Libraries -> Library search path (-L)
Add...
“${KSDK_PATH}\platform\devices\MKW24D5\linker\gcc”
Cross ARM C Linker -> Miscellaneous -> Other Objects
${KSDK_PATH}\usb\usb_core\device\build\kds\usbd_sdk_usbkw24d512_freertos\debug\libusbd_freertos.a
${KSDK_PATH}\lib\ksdk_freertos_lib\kds\KW24D5\debug\libksdk_platform_freertos.a
${KSDK_PATH}\platform\drivers\src\mmcau\asm-cm4\lib_mmcau.a
Cross ARM C Linker -> Miscellaneous -> Other linker flags
-Xlinker --defsym=__ram_vector_table__=1 --specs=nano.specs -Xlinker --defsym=__heap_size__=0x2C00
Click Apply
Click OK
Comment Stuff Out
I couldn’t get it to build without any changes, but there are only 2 offending code segments that seem to be unused, so I commented them out.
comment-out the AES_128_CCM function, located in:
\framework\Utils\SecLib\SecLib.c
/*
uint8_t AES_128_CCM(uint8_t* pInput,
uint32_t inputLen,
uint8_t* pAuthData,
uint32_t authDataLen,
uint8_t* pInitVector,
uint8_t* pCounter,
uint8_t* pKey,
uint8_t* pOutput,
uint8_t* pCbcMac,
uint8_t flags)
{
#if FSL_FEATURE_SOC_LTC_COUNT
return LTC_AES128_CCM(pInput, inputLen, pAuthData, authDataLen, pInitVector, pCounter, pKey, pOutput, pCbcMac, flags);
#else
return sw_AES128_CCM(pInput, inputLen, pAuthData, authDataLen, pInitVector, pCounter, pKey, pOutput, pCbcMac, flags);
#endif
}*/ //Commented per KDS build instead of IAR
...as far as I can tell this function isn’t used, and I don’t know where to find the w_AES128_CCM() function.
comment-out vPortEndScheduler(), located in
\RTOS\FreeRTOS\tasks.c
It’s inside the vTaskEndScheduler(void) function:
void vTaskEndScheduler( void )
{
/* Stop the scheduler interrupts and call the portable scheduler end
routine so the original ISRs can be restored if necessary. The port
layer must ensure interrupts enable bit is left in the correct state. */
portDISABLE_INTERRUPTS();
xSchedulerRunning = pdFALSE;
//vPortEndScheduler(); //Commented per KDS build instead of IAR
}
...Things shouldn’t really call the vTaskEndScheduler function...right? I think it would stop the RTOS, so we don’t really need this.
Importing Dependency Projects
Import ksdk_freertos_lib_KW24D5 project
C:\Freescale\KSDK_1.2.0\lib\ksdk_freertos_lib\kds\KW24D5
Import usbd_sdk_usbkw24d512_freertos project
C:\Freescale\KSDK_1.2.0\usb\usb_core\device\build\kds\usbd_sdk_usbkw24d512_freertos
Build both projects.
Build the Connectivity_Test project
Finally ready to actually build the Connectivity_Test project in KDS. Yay!
Click Build.

When you build (if it works), the size will be 143k
If you go back to Cross ARM C Linker -> General
And check the box to remove unused sections (-Xlinker --gc-sections), the code is smaller (93k).

When this project is compiled in IAR, it’s 83k, so only ~10k smaller, which is good because I read somewhere that IAR has much better optimization than gcc, but I guess it's not a huge difference.

Fixing runtime errors
For unknown reasons the compiler malloc() function starts out at memory area(0x20000000), instead of (0x1FFFB000), so it runs out of memory(I think), and the program gets stuck in the default ISR.
DefaultISR:
b DefaultISR
There are probably better ways to fix this, but I just changed the memory management scheme to alloc/free. (FreeRTOSConfig.h)
#define configFRTOS_MEMORY_SCHEME 2
This change gets the example to run (or should). For me, everything worked after this!!
--END--
A different post I read stated that it wasn't possible to build the SMAC app examples in KDS because they relied on library .a files which were only built in IAR, but it seems to me that the full Mac and Phy source is included in the KW2xD_SMAC download, which is why I attempted this process in the first place.