| ??? 09/08/06 21:31 Read: times |
#123945 - Is it a call? Responding to: ???'s previous message |
If you reset the stack pointer? One normally will set the stack pointer as a result of execution starting at 0x0000. As a result call or jmp have no significant difference here. The big issue is that jmp 0x0000 is not the same as RESET. I prefer the watchdog method where possible.
Regarding the explanation: 0x0000 is a number (U8 code *)0x0000 is a number which points to a byte of code space (void (*)()) typecasts it to a pointer to function with no parameters or return value (* )(); executes it. One probably doesn't need all the brackets or typecasts (since you can't execute from the other memory spaces anyway), but it makes it clearer to the compiler and I believe more strictly correct. Using LINT helps with this kind of thing. It really gets more interesting when you have a pointer to a pointer or arguments in the function. Here are the steps again:
0x0000 Number
(U8 code *)0x0000 Typecast to pointer to code
(void (*)()) ((U8 code *)0x0000) Typecast that to func
(* (void (*)()) ((U8 code *)0x0000) ) (); Execute (dereference) or do-that-thing
|
| Topic | Author | Date |
| Soft reset in C | 01/01/70 00:00 | |
| you can't do it with a jump anyhow | 01/01/70 00:00 | |
| No dog | 01/01/70 00:00 | |
| Very soft | 01/01/70 00:00 | |
| That was for Keil | 01/01/70 00:00 | |
| Explanation | 01/01/70 00:00 | |
| I try to explain. | 01/01/70 00:00 | |
| Incorrect comment | 01/01/70 00:00 | |
| Is it a call? | 01/01/70 00:00 | |
| Yuk | 01/01/70 00:00 | |
| the good thing about C is... | 01/01/70 00:00 | |
| LOL, made my day - thanks | 01/01/70 00:00 | |
| and that's how | 01/01/70 00:00 | |
| _asm ljmp 0x0000 _endasm; | 01/01/70 00:00 | |
| goto in C | 01/01/70 00:00 | |
| goto scope | 01/01/70 00:00 | |
| slow??? | 01/01/70 00:00 | |
| Re: Slow? | 01/01/70 00:00 | |
| The simple way to do reset in C | 01/01/70 00:00 | |
| I don't think so... | 01/01/70 00:00 | |
| that is NOT a \'reset\' | 01/01/70 00:00 | |
| C wizard: Dan Saks | 01/01/70 00:00 | |
| that is not what's tricky | 01/01/70 00:00 | |
| Bad karma | 01/01/70 00:00 | |
| nothing wrong with that after a hard reset | 01/01/70 00:00 | |
Mix Asysmbly | 01/01/70 00:00 |



