本文摘要:本文章介绍如何使用NXP官方软件S32KDS,新建工程及基本开发使用
开发平台:S32 Design Studio for ARM Version 2.2
SDK版本:S32_SDK_S32K1xx_RTM_3.0.0
使用芯片:S32K148
一、新建工程
创建空工程

工程命名和芯片选型

选择SDK和调试器(无特殊需求其余默认)

选择芯片具体类型(pin数和封装会影响对应功能)


更新pin_mux(重选芯片类型后引脚矩阵会变化)

二、实现一个点灯程序
选择引脚

添加组件

生成代码


复制或拖拽必要代码
int main(void)
{
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
#ifdef PEX_RTOS_INIT
PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
/* For example: for(;;) { } */
// 以下两句为时钟初始化,必须放在顶部,固定用法复制即可
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
// 端口初始化 拖拽pin_mux组件下的函数进来
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
while(1) {
// 我们选择的PTC10 pin0-pin31对应0-31位
PINS_DRV_TogglePins(PTC, 1 << 10UL);
// ms延时函数 拖拽osif组件下的函数进来
OSIF_TimeDelay(500);
}
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;) {
if(exit_code != 0) {
break;
}
}
return exit_code;
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
三、常用的一些东西
放大缩小程序字体
放大:ctrl + shift + 加号
缩小:ctrl + 减号
生成bin或hex文件


找不到某些页面

烧录设置
Run:程序烧录后直接运行,不进入debug
Debug:程序烧录后进入debug,需要再点击debug中的run程序才运行


全局搜索内容

S32K148更多例程和源码以及最新内容下载地址: