There seems to be two bugs in the flashx implementation for the internal flash of the MCF52259 in MQX 4.0.2 when using the FLASH_IOCTL_GET_NUM_SECTORS command.
I am referring to the file C:\Freescale\Freescale_MQX_4_0\mqx\source\io\flashx\flashx.c
In the _io_flashx_ioctl function:
Line 1053: _io_flashx_find_correct_sectors(fd_ptr, fd_ptr->SIZE, &sb, &ss, &offset, &fs);
I think this should be using the fd_ptr->LOCATION like other calls, or maybe 0 to indicate the entire flashx instance. It should not be fd_ptr->SIZE, as this will go beyond the end of the flashx range in the function.
In the _io_flashx_find_correct_sectors function if fd_ptr->SIZE is passed as the location argument, you will get a divide by zero error at line 650. The code does not check that the block is pointing to the NULL terminator in the block list and there is no way to return an error.
Has anyone else seen this problem?