[TUT] [C] Getting SD/MMC card working painlessly with FatFS

339 posts / 0 new
Last post
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi from where can i get he code to build this amazing project..
this link i not functional http://elm-chan.org/fsw/ff/ffsample.zip

please forward me the file
divyansh@ymail.com
thanx in advance..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Pointer to where I can learn about the xitoa function?
I can't find any definition about xitoa on the net. Seems odd, but this SD/MMC FATFS seems to be about the only piece of code that uses xitoa. It's not in the WINAVR library.
Especially this piece of code: !xatoi(&ptr, &p1) what is this doing?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As near as I can figure, xitoa seems to be Chen's implementation of an eXtended print-to-console API. I quite like it, and I now use it in a lot of other programs. For the most part, you would use it as you would use the normal functions in a C program running in the terminal. There are a couple ones which change functionality somewhat, notably xitoa(), which allows you to print directly to the serial port, instead of first printing to a string buffer and then writing the buffer to the port.

Quote:
Especially this piece of code: !xatoi(&ptr, &p1) what is this doing?

I have no idea what that does. There's some funky pointer-fu that I don't really understand in Chen's work. Of course, maybe with a bit more context it might be easier to grok.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Especially this piece of code: !xatoi(&ptr, &p1) what is this doing?

Well ptr is going to be a pointer to a string of digits such as "0x1F2C" or "0b101010" or whatever and p1 is a pointer to a 'long' variable that will take the result. The code then does a pretty standard atoi() style conversion but if it finds an "illegal" character (such as "01F2C" being passed without the 'x') it returns 0 rather than 1. So all the uses tend to be "if (!xatoi(&ptr, &p1)) break;" so that it doesn't use an illegally converted result.

You can see all this in the asm code in xitoa.S

Cliff

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Folks,
I just started playing around with the FAT FS code.
Seems to compile, but I'm also getting that signedness warning (about 50 times).

Using winavr 20080610

Quote:
main.c:235: warning: pointer targets in passing argument 1 of 'get_line' differ in signedness

Pretty much a noob with c. I sort of get the issue of unsigned versus signed char pointers, but with elm chans extended print routines being in assembler I'm lost. Was there an easy fix found for this error (other then going back to an earlier version of winavr)?

BTW, the -funsigned-char flag has no effect. But I don't know if that would affect pointers.

Thanks,

-carl

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's a benign warning - ignore it.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson,
Thanks, as long as it's benign I guess I can ignore it.

In general, I like to get rid of these warnings, especially when there are 40-50 of them. When an additional non-benign warning pops up (as I learn and develop new code) it tends to get lost in the field of all these other ignorable warnings.

I'll check to see if I can suppress this particular warning msg. Additionally, if this is becoming a more general gcc question, I'll take it over to the avr gcc forum.

-carl

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It was one of the recent GCC releases where that over-aggressive warning started to appear. As it doesn't help much and causes a lot of people concern I think moves are afoot to revert the behaviour in future.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

successfully compiled elmchan code..
I am able to read the MBR but not able find files..

Pages