This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

void pointer

Hi,

Any idea what does following do and how ?

((void (code *) (void)) 0) ();

Any help would be great

Parents
  • "What this snippet of code is probably meant to do (in short form) is reset the processor (or at least jump code execution to address 0 so it can jump to the start of the application)."

    As Jay so carefully says, that may be what it's meant to do; but note that jumping to code address 0x0000 is not the same thing as resetting the processor - by a long way.

    A true reset will reset the chip hardware and then restart the software from code address 0x0000.

    Simply jumping to code address 0x0000 will leave the chip hardware in an indeterminate state when the software restarts.

    If you need to do a reset, the best way is to use a watchdog and just let it time-out.

    There's been plenty of discussion of this - try a 'Search'

Reply
  • "What this snippet of code is probably meant to do (in short form) is reset the processor (or at least jump code execution to address 0 so it can jump to the start of the application)."

    As Jay so carefully says, that may be what it's meant to do; but note that jumping to code address 0x0000 is not the same thing as resetting the processor - by a long way.

    A true reset will reset the chip hardware and then restart the software from code address 0x0000.

    Simply jumping to code address 0x0000 will leave the chip hardware in an indeterminate state when the software restarts.

    If you need to do a reset, the best way is to use a watchdog and just let it time-out.

    There's been plenty of discussion of this - try a 'Search'

Children