Can someone tell me how to apply this patch(delay_us)?

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, I have downloaded the delay_us routine patch from:
https://savannah.nongnu.org/patc..., but I donot know how to apply it. Can someone help me please!

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

Just use them, they are headers.

Why you absolutely want to use them is beyond me, they don't give you "better" delays, just better error message if you messed things up. And they don't break if you forgot to turn on optimization (which you should turn on, so the version for no optimization should anyhow not get in your code).

If you previously had things wrong, like using variable arguments, these delay versions won't magically make things right.

Stealing Proteus doesn't make you an engineer.

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

Arnold,

Don't forget that the modified _delay_ms() one also switches to coarse stepping when a delay value outside the previous "262.14 ms / F_CPU MHz" is attempted.

(though the argument goes that if you need delays that long you should probably using a timer anyway)

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

Hi,

I suppose you are working in Windows.

You need a patch program. If you have cygwin installed, then probably you have it already. If you don't have cygwin, then you could get patch from here: http://gnuwin32.sourceforge.net/packages/patch.htm (not tested).

To test the patch, open a DOS shell (Command Prompt) and cd to the directory where you want to apply the patch to.

cd c:\some\where\

Then test the patch:

patch -pX --dry-run < path-to-patch-file

NB: this is a dry-run and does not modify your files. You need to adapt the follwing parameters:

- -pX: X is a number, usually 1 or 0.
- path-to-patch-file, well... is the path to the patch file

If patch cannot find some files and it asks you to enter the name, press CTRL-C and use a different number for the -pX option.

If you get conflicts, then you're in trouble: the patch is for a different version of the code. This means usually some manual changes.

If the patch has no conflict (i.e. you see the list of modified files) then you're lucky and you can run the same command again, this time without --dry-run. This time patch will modify the files.

HTH,
Thomas

pycrc -- a free CRC calculator and C source code generator

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

clawson wrote:
Don't forget that the modified _delay_ms() one also switches to coarse stepping when a delay value outside the previous "262.14 ms / F_CPU MHz" is attempted.
But that is already fixed in the released avr-libc. Maybe since two releases or so (I didn't check).

Stealing Proteus doesn't make you an engineer.

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

tpircher wrote:
You need a patch program.
No, since what he got are not patches. The files are complete replacements for avr-libc headers. They can be used out of the box, replace the originals, and there is nothing to patch. The files don't even contain patch information (they aren't diffs or context diffs).

Stealing Proteus doesn't make you an engineer.

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

ArnoldB wrote:
No, since what he got are not patches.

D'oh! I didn't check the actual content of the link...

Thomas

pycrc -- a free CRC calculator and C source code generator