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


I am trying to program the internal Flash of MCF52259..i am using MQX 3.7 and CW 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);    
    read(flash_hdl,&flash_data, sizeof(flash_data));

            i=write(flash_hdl, &flash_data, sizeof(flash_data));


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