Author Topic: compiling error  (Read 12402 times)

Offline neil

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
compiling error
« on: February 12, 2012, 01:06:03 PM »
Hi Mark,
  I have copied the latest version of ufat to my project (still have to copy full utasker latest version) and getting an error.

The UTDISK structure has 1 change (which I changed in debug.c):
From : unsigned char  ucDiskFlags;
To: unsigned short usDiskFlags; 
When I upgrade the firmware  which is running out in the field ,will these effect any data currently stored?

Also:
Can you tell me the flags to pass to the new the following changes?

New function :
utFormat(DISK_D, ptrInput, ucFlags) 

Old Function: 
utFormat(const unsigned char ucDrive, const CHAR *cVolumeLabel)

---- Also ---
New function:
static int utReFormat(const unsigned char ucDrive, const CHAR *cVolumeLabel, unsigned char ucFlags)

Old Function :
extern int  utReFormat(const unsigned char ucDrive, const CHAR *cVolumeLabel);

-- Also --
I see there is a call to GET_SDCARD_WP_STATE() , but cant find this in my project ( I am assuming because I have to change all my project to the latest version). Can you let me know what and where this should go?

Thanks for all your help
Neil

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3240
    • View Profile
    • uTasker
Re: compiling error
« Reply #1 on: February 12, 2012, 01:35:20 PM »
Hi Neil

The flags in UTDISK struct were changed from 8 bit to 16 bit due to some new flag information which give more details of the state of the SD card. The original flags are compatible but there are new, extended ones that didn't fit in the 8 bits anymore:
DISK_NOT_PRESENT, DISK_TYPE_NOT_SUPPORTED, DISK_FORMAT_FULL, DISK_FORMAT_FAT16, DISK_TEST_MODE. The last is only for NAND Flash development mode.

These don't change the format of the date on the SD card and so won't cause problems with data already stored.

This change is valid since September 2010.

utFormat()
A new parameter was added in March 2011, for example to command fast formatting or full formatting (where all data is also set to 0 - which takes a long time to complete!), as well as to choose FAT16 rather than FAT32. If the parameter is added and left with 0 (or UTFAT_FORMAT) it will be compatible with previous use - the additional control will then use defaults.

The exception is when reformatting a disk - there used to be a seperate command for this but now the utFormat() is used instead with the flag UTFAT_REFORMAT set (rether than default UTFAT_FORMAT).
New options are to format with FAT16 [UTFAT_FORMAT_16] and/or to do a full format [UTFAT_FULL_FORMAT].

GET_SDCARD_WP_STATE() is a macro added in February 2011.
If you simple add
#define GET_SDCARD_WP_STATE() to a configuration file it will allows the project to build and will have no effect.
If your card socket has a write protect switch built in, or you have any switch which serves this function, you can use the macro to read the corresponding port input which it is attached to and then this will be used by the utFAT module as write protect flag. It will then not allow any write operations to the card if the switch was active.

Regards

Mark







Offline neil

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
Re: compiling error
« Reply #2 on: February 12, 2012, 01:52:58 PM »
Thanks Mark

Neil