Hi all,
The ti-rtos for tiva doesn't supply function drivers about flash.So I use the tivaware driver abou the flash(diverlib/flash.h).Here is my code :
int32_t flash_test(uint32_t *pData, uint32_t Address, uint32_t Count)
{
int32_t result;
SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480),1200000);
FlashErase(Address);
result = FlashProgram(pData, Address, Count);
SysCtlDelay(1000000);
return result;
}
Void flashtestFxn(UArg arg0, UArg arg1)
{
uint32_t pui32Data[2];
pui32Data[0] = 0x12345678;
pui32Data[1] = 0x56789abc;
uint32_t add = 0x800;
while (1) {
flash_test(pui32Data, add , sizeof(pui32Data));
Task_sleep((unsigned int)arg0);
GPIO_toggle(Board_LED0);
}
}
int main(void)
{
Task_Params taskParams;
/* Call board init functions */
Board_initGeneral();
Board_initGPIO();
Task_Params_init(&taskParams);
taskParams.arg0 = 1000;
taskParams.stackSize = TASKSTACKSIZE;
taskParams.stack = &task0Stack;
Task_construct(&task0Struct, (Task_FuncPtr)flashtestFxn, &taskParams, NULL);
System_printf("Starting the example\nSystem provider is set to SysMin");
System_flush();
BIOS_start();
return (0);
}
When I run the code on my board,set the brakpoint on the step of FlashErase() and FlashProgram() but the step can not go to FlashProgram().The whole project run fly when it is go to the FlashProgram().
Is there is any other requirements for run the fuction of FlashProgram()?How can i write and erease an address of flash?