Windows asks "Do you want to scan and fix...?" in bootloader (AN4379 on K60)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Windows asks "Do you want to scan and fix...?" in bootloader (AN4379 on K60)

Jump to solution
1,867 Views
TugboatCaptain
Contributor III

The bootloader and firmware update works fine, but when the device enumerates as a USB MSD volume, Windows 7 always asks "Do you want to scan and fix VOLUME (I:)?" and of course recommends that you scan and fix. Either selecting "scan and fix" or "continue without scanning" has no effect but is a bit of a nuisance for our customer/user to see.  Is there anything we can change to make this error go away?

Ported the AN4379 bootloader to the MK60FN1M0VLQ12 using CW10.3, Freescale C tool chain.

Thanks,

Cap'n

Labels (2)
1 Solution
1,054 Views
TugboatCaptain
Contributor III

If you run the fsutil windows utility on the bootloader volume it indicates the volume is dirty, which triggers the "scan and fix"

C:\Windows\system32>fsutil dirty query i:

Volume - i: is Dirty

Then looking in FAT16.c at location 37 in the hardcoded boot sector FAT16_BootSector I see that indeed the dirty bit is hardcoded to 1.

Setting the bit to 0 makes Windows no longer see the volume as dirty and needing a scan.

instead of :

    1,              /*37 - BS_Reserved1 = 1*/

use this:

    0,              /*37 - BS_Reserved1 = 0, dirty bit = 0 */

While the code originated five years ago, I do wonder if there were any underlying reasons for preferring setting of the dirty bit.

I hope this helps anyone else having the issue.

Cap'n

View solution in original post

5 Replies
1,054 Views
Novalis
Contributor III

Hello,

I am also having problem with AN4379, but on MCF51JM128, with windows 7 - when this dirty bit is set, upload runs fine. But when I clear the bit, upload fails, I traced it and the problem seems to be that after some time, windows 7 sends some different data and checksum fails in parses19.c

I am using sources from JM128 BADGE, then I found more recent sources from AN3927, but it didn't help.I dont' know why just changing this bit makes this difference.

Thanks for any help,

Martin

0 Kudos
1,055 Views
TugboatCaptain
Contributor III

If you run the fsutil windows utility on the bootloader volume it indicates the volume is dirty, which triggers the "scan and fix"

C:\Windows\system32>fsutil dirty query i:

Volume - i: is Dirty

Then looking in FAT16.c at location 37 in the hardcoded boot sector FAT16_BootSector I see that indeed the dirty bit is hardcoded to 1.

Setting the bit to 0 makes Windows no longer see the volume as dirty and needing a scan.

instead of :

    1,              /*37 - BS_Reserved1 = 1*/

use this:

    0,              /*37 - BS_Reserved1 = 0, dirty bit = 0 */

While the code originated five years ago, I do wonder if there were any underlying reasons for preferring setting of the dirty bit.

I hope this helps anyone else having the issue.

Cap'n

1,053 Views
pramodk_g_
Contributor III

Hi TugboatCaptain

Thanks a lot for sharing. I was also facing the same issue and it got solved.

But the original issue that i am facing is when i copy the ".afx.s19" image to the the Bootloader Drive the Drive disappears and appears again showing "SUCCESS.TXT" file which is expected as per document. But the code never switch to user application area, again when i restarts the board it goes to the boot loader. I tried with the images given in the zip file attached but no use. So i created a MQX hello world program by changing the .lcf file as the following

MEMORY

{

  vectorrom  (RX): ORIGIN = 0x0000C000, LENGTH = 0x00000400

  cfmprotrom  (R): ORIGIN = 0x0000C400, LENGTH = 0x00000020

  rom        (RX): ORIGIN = 0x0000C420, LENGTH = 0x00077BE0  # Code + Const data

  ram        (RW): ORIGIN = 0x1FFF0000, LENGTH = 0x00020000  # SRAM - RW data

  # kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap)

  end_of_kd  (RW): ORIGIN = 0x2000FFF0, LENGTH = 0x00000000

  # Boot stack reused by MQX Kernel data

  bstack      (RW): ORIGIN = 0x2000FA00, LENGTH = 0x00000200  # Boot stack

  end_bstack  (RW): ORIGIN = 0x2000FC00, LENGTH = 0x00000000

}

but the same issue it always goes into bootloader code and i am not sure if it is writing the user code to its flash location.

The serial port shows the following log before copying the .afx.s19 file,

CodeWarrior binary file found

FLASHING....

Please do not remove your device

########################

Erasing flash memory...

#######################################################################################################################################################################################################################################

ERASE complete!

        Open Image File

                ERROR......

Unknown file type#

Erasing flash memory...

#######################################################################################################################################################################################################################################

ERASE complete!

        Open Image File

Erasing flash memory...

#######################################################################################################################################################################################################################################

ERASE complete!

        Open Image File

And here is the log when i copy paste the .afx.s19 file to the drive,

"

Flash image file complete!

Press RESET button to enter application mode.

Erasing flash memory...

#######################################################################################################################################################################################################################################

ERASE complete!

        Open Image File

Erasing flash memory...

#######################################################################################################################################################################################################################################

ERASE complete!

        Open Image File

Erasing flash memory...

#######################################################################################################################################################################################################################################

ERASE complete!

        Open Image File

Erasing flash memory...

#######################################################################################################################################################################################################################################

ERASE complete!

        Open Image File

"

Then the drive reappears and shows SUCCESS.TXT file.

Please check attached .zip file for the MSD boot loader and please let me know in which step i went wrong.

Thanks

Pramod

0 Kudos
1,053 Views
pramodk_g_
Contributor III

Hi All,

Just now i figured out that this issue is only in Windows 8. In windows 8/8.1 when we try to copy and paste the .S19 file it is showing error because as soon as we paste or drag and drop into the drive, the drive disappears and windows shows error in copying. So i assume the image file is not loaded into the flash.

In windows 7, only after the completion of paste operation the drive disappears and the flashing is working. In this case the code is jumping to user application area.

Please let me know what is the issue in Windows 8. Will the provided code work on windows 8 or is it meant for only windows 7 etc?

Also we found that MAC PC is not even recognizing this device as Mass Storage.

Please let us know if there is any version of K70 boot loader code that will work for MAC, Windows 8 and Windows 7.

Thanks

Pramod

0 Kudos
1,053 Views
BlackNight
NXP Employee
NXP Employee

Hi Cap'n,

thanks for sharing! I was using that code for my bootloaders too, and was wondering why that annoying windows dialog was coming up. Your fixed helped me to get rid of this!

I cannot comment why this bit is set in the original bootloader. But I think it is simply an oversight.

At least I have not seen any issues so far with the bootloader having that bit cleared.

Many thanks again!

0 Kudos