Diogo Martins Silva writes:

> Hello all.
>
> The avr-gcc wiki (https://gcc.gnu.org/wiki/avr-gcc) lists 24 bits
> (u)ints as an extension since version 4.7. How do I use them?

Use __uint24 as the type. Like so

$ cat test.c
volatile __uint24 x;
int main() { 
  x++;
  x--;
}

$ avr-gcc -S test.c -Os

$ cat test.s
        .file   "test.c"
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__SREG__ = 0x3f
__tmp_reg__ = 0
__zero_reg__ = 1
        .section        .text.startup,"ax",@progbits
.global main
        .type   main, @function
main:
/* prologue: function */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
        lds r24,x
        lds r25,x+1
        lds r26,x+2
        adiw r24,1
        adc r26,__zero_reg__
        sts x,r24
        sts x+1,r25
        sts x+2,r26
        lds r24,x
        lds r25,x+1
        lds r26,x+2
        sbiw r24,1
        sbc r26,__zero_reg__
        sts x,r24
        sts x+1,r25
        sts x+2,r26
        ret
        .size   main, .-main
        .comm   x,3,1
        .ident  "GCC: (AVR_8_bit_GNU_Toolchain_3.5.4_1709) 4.9.2"
.global __do_clear_bss

Regards
Senthil
>
> Thanks
>
> Diogo
>
>
> _______________________________________________
> AVR-GCC-list mailing list
> AVR-GCC-list@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/avr-gcc-list


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to