Closed un-clouded closed 2 months ago
Hi, I am a bit confused why this is necessary. I am also using AVR-GCC 5.4. and I can compile the code as is?
gcc version 5.4.0 (AVR_8_bit_GNU_Toolchain_3.6.2_1778)
Which version of gcc are you using specifically?
Whoops, OK. The package is gcc-avr
version 1:5.4.0+Atmel3.6.2-3
. Perhaps I am using different compiler options? It's a hand-rolled Makefile and the compiler invocation is:
avr-gcc -fdata-sections -ffunction-sections -std=c99 -mmcu=atmega48 -Os -fshort-enums -DF_CPU=16000000 -DBAUD=9600 -Wall -c light_ws2812.c -o light_ws2812.o
If I try to compile without changing asm
to __asm__
I get:
light_ws2812.c: In function ‘ws2812_sendarray_mask’:
light_ws2812.c:160:5: error: ‘asm’ undeclared (first use in this function)
asm volatile(
^
light_ws2812.c:160:5: note: each undeclared identifier is reported only once for each function it appears in
light_ws2812.c:160:9: error: expected ‘;’ before ‘volatile’
asm volatile(
^
can you try building the examples with the supplied makefile?
Edit: -std=c99 seems to be the reason.
Can you update the pull request to address the comments? I will merge then. Thank you for your help :)
Sure. Should I remove the code comments completely, or trim them down?
Thanks heaps for all the work. It's a delight to be able to choose AVR rather than Arduino.
Merged, thanks a lot!
Hi Tim,
I had to replace
asm volatile
with__asm__ volatile
to get it to build on avr-gcc. I did also add a few comments as I was trying to understand the code better. Please let me know if you want to separate the changes if you want one but not the other.Cheers!