Simple blinky program and linker pruning
DavidZemon
Posts: 2,973
Simple blinky program:
Hangs if I compile with `-ffunction-sections -fdata-sections` and link with `-Wl,--gc-sections` with cog memory model. Any idea why?
int main () {
const int led = 0x10000;
DIRA |= led;
while (1) {
OUTA ^= led;
waitcnt(CLKFREQ / 4 + CNT);
}
}
Hangs if I compile with `-ffunction-sections -fdata-sections` and link with `-Wl,--gc-sections` with cog memory model. Any idea why?

Comments
.text .balign 4 .global _main _main mov r7, DIRA mov r6, .LC0 or r7, r6 mov DIRA, r7 .L2 xor OUTA,r6 mov r5, CNT rdlong r7, .LC1 shr r7, #2 add r7, r5 waitcnt r7,#0 jmp #.L2 .balign 4 .LC0 long 65536 .balign 4 .LC1 long __clkfreq