It said that __delay_ms function was not found. I don't see its declaration in <delay.h> file distributed with SDCC. The file contains the next declarations:</delay.h> /* * the delayNNtcy family of functions performs a * delay of NN cycles. Possible values for NN are: * 10 10*n cycles delay * 100 100*n cycles delay * 1k 1000*n cycles delay * 10k 10000*n cycles delay * 100k 100000*n cycles delay * 1m 1000000*n cycles delay */ void delay10tcy(unsigned char) __wparam; void delay100tcy(unsigned char)...
Now it's ok but there's extra y register usage: ; .\Source\main.c: 390: uint16_t testadd() ; ----------------------------------------- ; function testadd ; ----------------------------------------- _testadd: ; .\Source\main.c: 392: return (val += 1); ldw x, _val+0 incw x ldw y, x ldw _val+0, y ; .\Source\main.c: 393: } ret
Invalid code for compound assignment operator
It seems the problem still exists with SDCC 11119... Compiling the next code: const char *const data[] = {"a", "b", "c"}; void testptrs(const char *const *ptr); void testptrs1() { testptrs(data); } void testptrs(const char *const *ptr) { } causes error: .\Source\testptr.c:7: error 78: incompatible types from type 'const-unsigned-char generic* const [3] code' to type 'const-unsigned-char generic* const unknown* fixed' The same code without testptrs function prototype can be compiled without errors:...
Sometimes the compiler creates too many auxiliary locals for the same local struct variable (Version 3.8.4 #10807 (MINGW32), compiler options: -mstm8 --std-c11 --opt-code-speed --max-allocs-per-node 100000). E.g., we have the next types: typedef struct { uint8_t f1; uint8_t f2; uint8_t f3; uint8_t f4; uint8_t f5; uint8_t f6; } str1; typedef struct { uint8_t f; str1 str; } str2; Assignment of every structure field to a local variable causes creating a separate local pointer to nested struct for every...
and the same for stm8 Version 3.8.1 #10625 (MINGW32) --opt-code-speed --max-allocs-per-node 100000 uint8_t mod4(uint8_t op) { return (op % 4); } _mod4: ; .\Source\main.c: 13: return (op % 4); clrw x ld a, (0x03, sp) ld xl, a push #0x04 push #0x00 pushw x call __modsint addw sp, #4 ld a, xl ; .\Source\main.c: 14: } ret but the next "hint" helps compiler taking right decision: uint8_t mod4(uint8_t op) { return (op % (uint8_t)4); } _mod4: ; .\Source\main.c: 13: return (op % (uint8_t)4); ld a, (0x03,...
and the same for stm8 Version 3.8.1 #10625 (MINGW32) --opt-code-speed --max-allocs-per-node 100000 uint8_t mod4(uint8_t op) { return (op % 4); } _mod4: ; .\Source\main.c: 13: return (op % 4); clrw x ld a, (0x03, sp) ld xl, a push #0x04 push #0x00 pushw x call __modsint addw sp, #4 ld a, xl ; .\Source\main.c: 14: } ret but the next "hint" helps compiler taking right decision: uint8_t mod4(uint8_t op) { return (op % **(uint8_t)**4); } _mod4: ; .\Source\main.c: 13: return (op % (uint8_t)4); ld a, (0x03,...
wrong code generation for union