USL:https://community.nxp.com/docs/DOC-345487
由 Edgar Eduardo Lomeli Gonzalez于 2020-09-14 创建的文档
这篇文章将指导您如何从MKW36Z512VHT4迁移到MKW36A512VFT4 MCU。本示例将使用“信标(beacon)” SDK例程。
1- 前往MCUXpresso网页:MCUXpresso网页
2- 使用您的注册帐户登录。
3- 搜索“ KW36A”设备。点击推荐的处理器,然后单击“Build MCUXpresso SDK”。
4- 点击后将显示另一页面。在“Toolchain / IDE”框中选择“All toolchains”,并提供名称以标识软件包。然后点击“Download SDK”。
5- 接受许可协议。等待几分钟直到系统将软件包放入您的配置文件中。 单击“下载SDK存档”(Download SDK Archive),下载SDK,如下图所示。
6- 如果使用MCUXpresso IDE,‘请将KW36A SDK 压缩文件夹拖放到“Installed SDKs”视图中以安装软件包。
至此,您已经下载并安装好KW36A设备的SDK软件包。
1- 在 MCUXpresso工作区导入“信标(beacon)”示例。单击“Import SDK examples(s)…”选项,将出现一个新窗口。然后选择“ MKW36Z512xxx4”,单击FRDM-KW36图像。点击“Next >”按钮。
2- 查找“beacon(信标)”例程并选择是否支持FreeRTOS。
3- 转到Project/Properties。展开C / C ++ Build / MCU设置,然后选择MKW36A512xxx4 MCU。单击“Apply and Close”按钮以保存配置。
4- 通过单击鼠标右键并选择“重命名”将以下MKW36Z文件夹重命名为MKW36A,
framework/DCDC/Interface -> MKW36Z
framework/DCDC/Source -> MKW36Z
framework/LowPower/Interface -> MKW36Z
framework/LowPower/Source -> MKW36Z
framework/XCVR -> MKW36Z4
5- 在MCUXpresso IDE中打开“Project/Properties”窗口。 转到C / C ++ Build / Settings,然后在Tool Settings窗口中选择MCU C Compiler / Includes文件夹。在创建之前,根据MKW35文件夹编辑与MKW36 MCU相关的所有路径。结果类似如下所示:
../framework/LowPower/Interface/MKW36A
../framework/LowPower/Source/MKW36A
../framework/DCDC/Interface/MKW36A
../framework/XCVR/MKW36A4
6- 在工具设置中选择MCU Assembler/General文件夹。 编辑与MKW36 MCU相关的路径。结果类似如下所示:
../framework/LowPower/Interface/MKW36A
../framework/LowPower/Source/MKW36A
../framework/DCDC/Interface/MKW36A
../framework/XCVR/MKW36A4
7- 转到Project/Properties。展开MCU CCompiler/Preprocessor窗口。编辑“ CPU_MKW36Z512VHT4”和“ CPU_MKW36Z512VHT4_cm0plus”符号,分别将其重命名为“ CPU_MKW36A512VFT4”和“ CPU_MKW36A512VFT4_cm0plus”。保存更改。
8- 转到工作区。删除位于CMSIS文件夹中的“ fsl_device_registers,MKW36Z4,MKW36Z4_features,system_MKW36Z4.h和system_MKW36Z4.c”文件。然后解压缩MKW35Z SDK软件包并在以下路径中搜索“ fsl_device_registers,MKW36A4,MKW36A4_features,system_MKW36A4.h和system_MKW36A4.c”文件并复制到CMSIS文件夹中:
<SDK_folder_root>/devices/MKW36A4/fsl_device_registers.h
<SDK_folder_root>/devices/MKW36A4/MKW36A4.h
<SDK_folder_root>/devices/MKW36A4/MKW36A4_features.h
<SDK_folder_root>/devices/MKW36A4/system_MKW36A4.h
<SDK_folder_root>/devices/MKW36A4/system_MKW36A4.c
9- 将位于路径<SDK_folder_root> /devices/MKW36A4/mcuxpresso/startup_mkw36a4.c中的“ startup_mkw36a4.c”覆盖” startup”文件夹中的“ startup_mkw36z4.c”。 您可以简单的将文件拖放到“startup”文件夹中,然后删除旧的文件。
10- 在CMSIS文件夹中打开“ fsl_device_registers.h”文件。在以下代码(文件的第18行)中添加“ defined(CPU_MKW36A512VFT4)”:
/* * Include the cpu specific register header files. * * The CPU macro should be declared in the project or makefile. */#if (defined(CPU_MKW36A512VFP4) || defined(CPU_MKW36A512VFT4) || defined(CPU_MKW36A512VHT4) || defined(CPU_MKW36A512VFT4))
11- 在bluetooth->host->config文件夹中打开“ ble_config.h”文件。在以下代码中添加“ defined(CPU_MKW36A512VFT4)”(文件的第146行):
/* The maximum number of BLE connection supported by platform */#if defined(CPU_QN9080C) #define MAX_PLATFORM_SUPPORTED_CONNECTIONS 16#elif (defined(CPU_MKW36Z512VFP4) || defined(CPU_MKW36Z512VHT4) || defined(CPU_MKW36A512VFP4) || defined(CPU_MKW36A512VHT4) || defined(CPU_MKW36A512VFT4) || \ defined(CPU_MKW35Z512VHT4) || defined(CPU_MKW35A512VFP4) || \ defined(CPU_K32W032S1M2CAx_cm0plus) || defined(CPU_K32W032S1M2VPJ_cm0plus) || \ defined(CPU_K32W032S1M2CAx_cm4) || defined(CPU_K32W032S1M2VPJ_cm4) || \ defined(CPU_MKW38A512VFT4) || defined (CPU_MKW38Z512VFT4) || defined(CPU_MKW39A512VFT4) || \ defined(CPU_MKW37A512VFT4) || defined(CPU_MKW37Z512VFT4))
12- 在source-> common文件夹中打开“ ble_controller_task.c”文件。在以下代码(文件的第272行)中添加“ defined(CPU_MKW36A512VFT4)”:
#elif (defined(CPU_MKW35A512VFP4) || defined(CPU_MKW35Z512VHT4) || defined(CPU_MKW36A512VFP4) || defined(CPU_MKW36A512VFT4) ||\ defined(CPU_MKW36A512VHT4) || defined(CPU_MKW36Z512VFP4) || defined(CPU_MKW36Z512VHT4))/* Select BLE protocol on RADIO0_IRQ */ XCVR_MISC->XCVR_CTRL = (uint32_t)((XCVR_MISC->XCVR_CTRL & (uint32_t)~(uint32_t)( XCVR_CTRL_XCVR_CTRL_RADIO0_IRQ_SEL_MASK )) | (uint32_t)( (0UL << XCVR_CTRL_XCVR_CTRL_RADIO0_IRQ_SEL_SHIFT) ));
13-生成项目。
至此,该工程项目已经迁移完成。
1- 打开位于以下路径的信标(Beacon)项目:
2- 在工作区中选择项目,然后按Alt + F7打开项目选项。
3- 在General Options/Target 窗口中,单击设备名称旁边的图标,再选择适当的芯片NXP / KinetisKW / KW3x / NXP MKW36A512xxx4,然后单击“确定”按钮。
4- 在以下路径中创建一个名为MKW36A的新文件夹:
<SDK_root>/middleware/wireless/framework_5.4.6/DCDC/Interface
<SDK_root>/middleware/wireless/framework_5.4.6/DCDC/Source
<SDK_root>/middleware/wireless/framework_5.4.6/LowPower/Interface
<SDK_root>/middleware/wireless/framework_5.4.6/LowPower/Source
<SDK_root>/middleware/wireless/framework_5.4.6/XCVR
5- 复制位于上述路径的MKW36Z文件夹内的所有文件,然后粘贴到MKW36A文件夹中。
6- .在工作区中选择信标项目,然后按Alt + F7打开项目选项窗口。 在“ C/C++ Compiler/Preprocessor”窗口中,将所有路径里的MKW36Z文件夹的重命名为MKW36A文件夹。在已定义的符号文本框中,将CPU_MKW36Z512VHT4宏重命名为CPU_MKW36A512VFT4。结果如下图所示:然后单击确定按钮。
$PROJ_DIR$/middleware/wireless/framework_5.4.2/LowPower/Interface/MKW36A
$PROJ_DIR$/../../../../../../../devices/MKW36A4/drivers
$PROJ_DIR$/../../../../../../../middleware/wireless/framework_5.4.2/DCDC/Interface/MKW36A
$PROJ_DIR$/../../../../../../../middleware/wireless/framework_5.4.2/XCVR/MKW36A4
$PROJ_DIR$/../../../../../../../devices/MKW36A4
$PROJ_DIR$/../../../../../../../devices/MKW36A4/utilities
7- 展开startup文件夹,选择所有文件,单击鼠标右键,然后选择“Remove”选项。在文件夹上单击鼠标右键,然后选择““Add/Add files”。添加位于以下路径的startup_MKW36A4.s:
<SDK_root>/devices/MKW36A4/iar/startup_MKW36A4.s
另外,将system_MKW36A4.c和system_MKW36A4.h添加到startup文件夹中。 这两个文件都位于以下路径:
<SDK_root>/devices/MKW36A4
8- 在bluetooth->host->config文件夹中打开“ ble_config.h”文件。在以下代码中添加“ defined(CPU_MKW36A512VFT4)”:
/* The maximum number of BLE connection supported by platform */#if defined(CPU_QN9080C) #define MAX_PLATFORM_SUPPORTED_CONNECTIONS 16#elif (defined(CPU_MKW36Z512VFP4) || defined(CPU_MKW36Z512VHT4) || defined(CPU_MKW36A512VFP4) || defined(CPU_MKW36A512VHT4) || defined(CPU_MKW36A512VFT4) || \ defined(CPU_MKW35Z512VHT4) || defined(CPU_MKW35A512VFP4) || \ defined(CPU_K32W032S1M2CAx_cm0plus) || defined(CPU_K32W032S1M2VPJ_cm0plus) || \ defined(CPU_K32W032S1M2CAx_cm4) || defined(CPU_K32W032S1M2VPJ_cm4) || \ defined(CPU_MKW38A512VFT4) || defined (CPU_MKW38Z512VFT4) || defined(CPU_MKW39A512VFT4) || \ defined(CPU_MKW37A512VFT4) || defined(CPU_MKW37Z512VFT4))
9- 在source-> common文件夹中打开“ ble_controller_task.c”文件。在以下代码中添加“ defined(CPU_MKW36A512VFT4)”:
#elif (defined(CPU_MKW35A512VFP4) || defined(CPU_MKW35Z512VHT4) || defined(CPU_MKW36A512VFP4) || defined(CPU_MKW36A512VFT4) ||\ defined(CPU_MKW36A512VHT4) || defined(CPU_MKW36Z512VFP4) || defined(CPU_MKW36Z512VHT4))/* Select BLE protocol on RADIO0_IRQ */ XCVR_MISC->XCVR_CTRL = (uint32_t)((XCVR_MISC->XCVR_CTRL & (uint32_t)~(uint32_t)( XCVR_CTRL_XCVR_CTRL_RADIO0_IRQ_SEL_MASK )) | (uint32_t)( (0UL << XCVR_CTRL_XCVR_CTRL_RADIO0_IRQ_SEL_SHIFT) ));
10-生成项目。
至此,该项目已经迁移完成。