Closed Hecatron closed 4 years ago
@grbd can you provide link to discussed delay_basic.h
file?
From the looks of things it's part of the avr-gcc / avr-libc bundled with the arduino
I think it's an avr specific assembler directive "=w" and "0" commenting out those two lines fixes it
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
"1: sbiw %0,1" "\n\t"
"brne 1b"
: "=w" (__count)
: "0" (__count)
);
}
aha found a way around it
this then overrides / finds the modifed header before the default arduino one
d++ headers/SD.dpp --preprocess-only --parse-as-cpp --c++-standard="c++11" --define="__AVR_ATmega4809__" --include-path="C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" --include-path="D:\test1" --include-path="C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include" --include-path="C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" --include-path="C:\Program Files (x86)\Arduino\libraries\SD\src"
Now I just need to try this out with a few libs / look at the compile process via arduino-cli and try and script everything in python
Hi, This isn't a bug as such but more of a question I've recently been looking into if it's possible to use DLang with the Arduino
Ignoring the issues associated with compiling to the AVR target (I think one person got around it on the DLang forum by using LDC to compile to IR, then going from IR to AVR Code using LLVM, but I'll probably be using arm or esp32 anyway)
I've been seeing if I could use dpp to process the arduino library headers into something d could use anyway it seems to mostly work
Creating a Arduino.dpp file with a single line of
Then running the following works fine
Note I'm using Windows 10 / LLVM 10.0 and the latest dpp built from source However that's only doing C parsing not C++ parsing which is needed for some of the libs such as SPI or SD since they use Class's trying this
Leads to the following error
The error is due to some AVR specific assembler directives LLVM doesn't support within delay_basic.h Commenting out those assembler directives which is just two lines makes everything work fine
The question is, does anyone know of a clang option somewhere to disable the analysis of these assembler directives? that could be passed in with --clang-option