You could try to putCode: [Select]asm volatile ("nop\n");inside you loop, that might stop the compiler from optimizing it out.
Just tried making the variable global, and it works properly now. Can't believe I wasted an entire day just because I underestimated the intelligence of GCC QuoteYou could try to putCode: [Select]asm volatile ("nop\n");inside you loop, that might stop the compiler from optimizing it out.OK thanks I'll try that in the second problem I had in my previous post.
Quote You could try to put Code: [Select] asm volatile ("nop\n"); inside you loop, that might stop the compiler from optimizing it out.OK thanks I'll try that in the second problem I had in my previous post.
No need to guess, locate your functions in core/main.bin.dump or post that file here.
Since the hardware counter wraps nearly (but not exactly ) once a second, ...
Also, what's this about the timer not wrapping exactly? QuoteSince the hardware counter wraps nearly (but not exactly ) once a second, ... How much is "not exactly" out by, a few microseconds, or much more? Is it syncing with the internal RTC or something?
Oh that explains it thanks. I was under the impression that it counted up to 2^20 every real second and that by 'microsecond' we were reffering to one 1048576th of a second. I would have thought this would be more logical but I guess the canon engineers thought differently.So this won't be a problem, still I don't look forward to writing a wraparound though. Has anyone else written one yet by any chance?
More Software 101. It's a 20 bit timer that increments once a uSec. 2**20-1 = 1048575So it wraps every 1.048575 seconds.
con> .set_yield(-1,-1) local t0=peek(0xc0242014) while peek(0xc0242014) > t0 do end local tick0=get_tick_count() for i=1 ,10 do t0=peek(0xc0242014)while peek(0xc0242014) > t0 do end end return get_tick_count() - tick0con 1> getm1:return:10490
QuoteNo need to guess, locate your functions in core/main.bin.dump or post that file here.How would I go about locating a certain function in it? (not that I need to, but just out of interest)
For decompiling I'm using Radare.
That's the disassembled version of the CHDK core, created during compilation. All functions are identified by their names, so just search for that.
Hmmm. One more utility I didn't know about. Unfortunately neither of its graphical frontends (web, bokken) is working for me for ARM.
(. and getm are required instead of = because polling PTP fails when the camera is in a tight no yield loop like that.)
For the record, there is a logical, but possibly not very interesting reason for this (which you may already be aware of, in which case my apologies for butting in ). ...
void LED_flasher(){ while (variable_counting_repetitions < 65536) { *((volatile int *) AF_LED_ADDRESS) = LED_ON; while (variable_to_increment_0 < 1024) { variable_to_increment_0++; } //variable_to_increment = 0; *((volatile int *) AF_LED_ADDRESS) = LED_OFF; while (variable_to_increment_1 < 1024) { variable_to_increment_1++; } //variable_to_increment = 0; variable_counting_repetitions++; unread_variable = variable_to_increment_0 + variable_to_increment_1; variable_to_increment_0 = 0; variable_to_increment_1 = 0; } start_LED_flasher = 1; variable_counting_repetitions = 0; variable_to_increment_0 = 0; variable_to_increment_1 = 0;}
Anyone know of any other decent free decompilers (that run on Linux)?
What is getm and how should it be used? I couldn't find anything on google about it, is it a CHDK only thing?
Thanks for the explanation, I guess that shifts the problem back to why the crystals are all based on powers of 10, (with maybe a power of 2 thrown in eg. 16000000Hz).
I'm not completely sure how the CPU allocates its clock cycles out, can I assume that while this is running, nothing else is?
Started by fudgey General Discussion and Assistance
Started by srsa_4c « 1 2 » General Discussion and Assistance
Started by lipefrs « 1 2 » Script Writing
Started by reyalp DryOS Development
Started by reyalp General Discussion and Assistance