vivek a k

Difficulty in Programming  the Internal flash of MCF52259

Discussion created by vivek a k on Nov 3, 2011
Latest reply on Nov 3, 2011 by vivek a k

Hi,

I am trying to program the internal Flash of MCF52259..i am using MQX 3.7 and CW v7.2....as i understand the internal flash size is of 512 Kb and it can be divided into sectors of 16 Kb each,giving 32 sectors in total...Now i want to hard code certain configuration parameters onto the flash which may take around 1Kb of space and want it to be protected..i tried doing the same by refering to the data sheet,but without success...Below is a sample code

 

 

flash_hdl = fopen("flashx:",NULL);
          /* Enable sector cache */
    _io_ioctl(flash_hdl, FLASH_IOCTL_DISABLE_SECTOR_CACHE, NULL);    
     fseek(flash_hdl,ROM_SETUP,IO_SEEK_SET);
    read(flash_hdl,&flash_data, sizeof(flash_data));
..........

             fseek(flash_hdl,ROM_SETUP,IO_SEEK_SET);
            i=write(flash_hdl, &flash_data, sizeof(flash_data));
            _time_delay(2000);
            fclose(flash_hdl);

 

and more importantly i want to specify the base address and end address where i want to write into...how can i do that....Your response is highly apppreciated

Outcomes