Thank you, Antonio! I'll be looking forward to a minor bux fix release then. ;-)
ST-LINK V3 fails to connect to an STM8 target
Thanks, Erik!
Constant parameter leads to bogus compilation error
I believe __sfr and __at are not available for STM8.
The peephole optimizer is an interesting beast. The workaround to the case above is this: #include <stdint.h> #define ADDR (*(volatile uint8_t *)(0x5555)) static void wfi() { __asm__("wfi"); } void main(void) { ADDR |= 0x01; ADDR |= 0x02; ADDR |= 0x04; for (;;) wfi(); } If wfi() is inlined, no optimization for the third line. So it looks like the peephole optmizer sees the code after compiler optimizations (inlining, returns, etc.) and is akin of a "last wipe of dust". I guess I wish the compiler...
Well, the following code shows that the optimizer is somewhat "picky" about such optimizations: #include <stdint.h> #define ADDR (*(volatile uint8_t *)(0x5555)) void main(void) { ADDR |= 0x01; ADDR |= 0x02; ADDR |= 0x04; __asm__("wfi"); } 000000 89 _main: 90 ; main.c: 6: ADDR |= 0x01; 000000 72 10 55 55 [ 1] 91 bset 21845, #0 92 ; main.c: 7: ADDR |= 0x02; 000004 72 12 55 55 [ 1] 93 bset 21845, #1 94 ; main.c: 8: ADDR |= 0x04; 000008 C6 55 55 [ 1] 95 ld a, 0x5555 00000B AA 04 [ 1] 96 or a, #0x04 00000D...
Well, the following code shows that the optimizer is somewhat "picky" about such optimizations: #include <stdint.h> #define ADDR (*(volatile uint8_t *)(0x5555)) void main(void) { ADDR |= 0x01; ADDR |= 0x02; ADDR |= 0x04; __asm__("wfi"); } 000000 89 _main: 90 ; main.c: 6: ADDR |= 0x01; 000000 72 10 55 55 [ 1] 91 bset 21845, #0 92 ; main.c: 7: ADDR |= 0x02; 000004 72 12 55 55 [ 1] 93 bset 21845, #1 94 ; main.c: 8: ADDR |= 0x04; 000008 C6 55 55 [ 1] 95 ld a, 0x5555 00000B AA 04 [ 1] 96 or a, #0x04 00000D...