Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4971

C/C++ • C to ASM

$
0
0
PI Pico , SDK Pico-v1.5.1 , PICO - Visual Studio , Pi Pico at 240MHz.
If you run Blink in a loop, you get a strange behavior.
And there is also a glitch when you first access the port pin. Instead of 40ns , I get 900 ns. Then everything starts to go steadily.

Code:

gpio_put(2, 1);busy_wait_at_least_cycles(repeat_delay);gpio_put(2, 0);
compiled into

Code:

////gpio_put(2, 1);//----------------------------------------------------------------------------------10000334:21d0      movsr1, #208; 0xd010000336:0609      lslsr1, r1, #24<- Why ? This is 24 cycles !!! A lot of time !!!10000338:2004      movsr0, #41000033a:6148      strr0, [r1, #20]////busy_wait_at_least_cycles(repeat_delay);//----------------------------------------------------------------------------------1000033c:4b1b      ldrr3, [pc, #108]; (100003ac <BLINK+0x84>)1000033e:681b      ldrr3, [r3, #0]10000340:3b01      subsr3, #110000342:d2fd      bcs.n10000340 <BLINK+0x18>////gpio_put(2, 0);//----------------------------------------------------------------------------------10000344:6188      strr0, [r1, #24]//----------------------------------------------------------------------------------

Statistics: Posted by Marchcat — Wed Feb 28, 2024 4:10 am



Viewing all articles
Browse latest Browse all 4971

Trending Articles