dadamachines / doppler

Arduino compatible – Cortex M4F & FPGA Development Board
81 stars 9 forks source link

"dadamachines - M4" package links missing symbols - analogWrite broken #6

Open mcclure opened 4 years ago

mcclure commented 4 years ago

Consider the following code

#define VCA 7
void setup() {
    pinMode(VCA,OUTPUT);
}    
void loop() {
    static int i = 0;
    analogWrite(VCA, i++);
}

Normally in Arduino C analogWrite is used on digital pins to engage a PWM mode where the pin oscillates 0 and 1 outputs rapidly so as to be "on average" the specified voltage. If you add an RC filter this can be a way of getting analog values out of digital pins. I've used this before on Atmel chips and it is a documented feature of the Cortex used in the Doppler.

If you compile this program for the dadamachines - M4 board, you get this link error

../arduino_cache_743729/core/core_dadamachines - M4_samd_doppler_cache_on_372425e7815a96db1ec07b293caaf52c.a(wiring_analog.c.o): In function `analogWrite':
/Users/mcc/Library/Arduino15/packages/dadamachines - M4/hardware/samd/1.3.1/cores/arduino/wiring_analog.c:523: undefined reference to `GCLK_CLKCTRL_IDs'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board dadamachines doppler.

In other words the dadamachines - M4 board package exposes an analogWrite function, but the binary for this function links against this GCLK_CLKCTRL_IDs value which is not included in dadamachines - M4.

I asked around and I'm told this is normally something defined in the "Arduino SAMD Boards" header. I tried reinstalling the packages starting with "Arduino SAMD Boards" but I got the same error. I think either the dadamachines - M4 is not flagging a dependency it needs that would supply the GCLK_CLKCTRL_IDs symbol, or dadamachines - M4 did not port everything it needs from the cortex board definitions it's based on.

I would attempt to hack a fix myself but I don't really understand how the build system in Arduino IDE works or what documentation I should read to learn more. I tried asking about all this on the forum but didn't hear back.