利用demo程序,中的GPIO_Demo 1.启动后编译,出现警告,暂时不理会 GPIO_PTH7_MASK = (1<<31), /*!< GPIO Pin PTH7 bit mask */ 根据野火的启动分析:
2.找到了start.C函数.void start(void){ /*Disable the watchdog timer but enable update */ WDOG_DisableWDOGEnableUpdate(); #ifndef __GNUC__ #ifndef KEIL /*Copy any vector or data sections that need to be in RAM */ common_startup();#endif#endif /*Jump to main process */ main(); /*No actions to perform after this so wait forever */ while(1);}------看到只是关闭了看门狗,然后就调用main().int main (void){ /* Perform processor initialization */ sysinit(); while (1);}---这是main()函数---调用sysinit();void sysinit (void){ SIM_ConfigType sSIMConfig ={{0},0}; ICS_ConfigType sICSConfig = {0}; /* initialize the Pass/Fail counts to 0 */ global_pass_count= 0; global_fail_count = 0; #if defined(TRIM_IRC) /* if not trimmed, do trim first */ ICS_Trim(ICS_TRIM_VALUE);#endif /* * Enable SWD pin, RESET pin */ /* * NOTE: please make sure other register bits are also write-once and * need add other bit mask here if needed. */#if defined(SPI0_PINREMAP) sSIMConfig.u32PinSel |= SIM_PINSEL_SPI0PS_MASK;#endif#if defined(OUTPUT_BUSCLK) sSIMConfig.sBits.bEnableCLKOUT= 1; /* output bus clock if enabled*/#endif#if defined(DISABLE_NMI) sSIMConfig.sBits.bDisableNMI = 1;#endif #if !defined(CPU_KE04) /* make sure clocks to peripheral modules are enabled */ sSIMConfig.u32SCGC |= SIM_SCGC_SWD_MASK | SIM_SCGC_FLASH_MASK | SIM_SCGC_UART0_MASK |SIM_SCGC_UART1_MASK | SIM_SCGC_UART2_MASK ; #else sSIMConfig.u32SCGC |= SIM_SCGC_SWD_MASK | SIM_SCGC_FLASH_MASK | SIM_SCGC_UART0_MASK ; #endif #if !defined(CPU_KE02) /* bus clock divided by 2 */ sSIMConfig.u32CLKDIV |= SIM_CLKDIV_OUTDIV2_MASK; #endif SIM_Init(&sSIMConfig); /* initialize SIM */#if defined(XOSC_STOP_ENABLE) sICSConfig.oscConfig.bStopEnable = 1; /* enabled in stop mode */ #endif #if defined(CRYST_HIGH_GAIN) sICSConfig.oscConfig.bGain = 1; /* high gain */ #endif #if (EXT_CLK_FREQ_KHZ >=4000) sICSConfig.oscConfig.bRange = 1; /* high range */#endif sICSConfig.oscConfig.bEnable = 1; /* enable OSC */ sICSConfig.u32ClkFreq = EXT_CLK_FREQ_KHZ;#if defined(USE_FEE) sICSConfig.u8ClkMode = ICS_CLK_MODE_FEE; #elif defined(USE_FBE_OSC) sICSConfig.u8ClkMode = ICS_CLK_MODE_FBE_OSC; #elif defined(USE_FEE_OSC) sICSConfig.u8ClkMode = ICS_CLK_MODE_FEE_OSC; #endif ICS_Init(&sICSConfig); /*initialize ICS */ /* initialize UART for printing */ UART_InitPrint(); #if defined(PRINT_SYS_LOG) print_sys_log();#endif } -----根据之前看到的**,这是时钟的初始化,到这里,就完成了,然后到main()初始化的工作 以下是我的问题,有几点不明白,请高手帮忙解答一下1. sysinit这个函数,如果我用其他名称替换,自己写一个函数初始化时钟,IO等行不,就放在main();2. 以下条件编码,XOSC_STOP_ENABLE需要自己用define定义吗?还是如何,谢谢#if defined(XOSC_STOP_ENABLE) sICSConfig.oscConfig.bStopEnable = 1; /* enabled in stop mode */ #endif3. 我的警告是什么意思?谢谢大家,因为之前没有接触这个,一直是8位机,现在开始做电机程序,所以请多指教
|