请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
当对 Tivaware 的 EEPROM 运行编程示例并优化编译器时、它会跳过一些重要代码。
例如、在这个代码示例行22-27在调试时被跳转、变量 ui32EEPROMInit 根本未被初始化。:
uint32_t ui32EEPROMInit; uint32_t pui32Data[2]; uint32_t pui32Read[2]; // // Enable the EEPROM module. // SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0); // // Wait for the EEPROM module to be ready. // while(!SysCtlPeripheralReady(SYSCTL_PERIPH_EEPROM0)) { } // // Wait for the EEPROM Initialization to complete // ui32EEPROMInit = EEPROMInit(); // // Check if the EEPROM Initialization returned an error // and inform the application // if(ui32EEPROMInit != EEPROM_INIT_OK) { while(1) { } } // // Program some data into the EEPROM at address 0x400. // pui32Data[0] = 0x12345678; pui32Data[1] = 0x56789abc; EEPROMProgram(pui32Data, 0x400, sizeof(pui32Data)); // // Read it back. // EEPROMRead(pui32Read, 0x400, sizeof(pui32Read));
这里发生了什么?