Hi All,
Having a peculiar experience with the compiler and hoping others here can steer me in the right direction. I just discovered a bug in my pins_arduino.h for my core while trying to use SoftwareSerial, where the following #define was taking precedence over my own definitions.
#ifndef ARDUINO_MAIN
extern const uint8_t PROGMEM digital_pin_to_PCMSK_bit_PGM;
#endif
... so I removed that block of code and tried to replace it with my own definition of digital_pin_to_PCMSK_bit_PGM. But when I do that and try to compile a basic sketch, I get the following compile time output from the IDE.
/tmp/build4992724107852600463.tmp/core.a(wiring.c.o):(.progmem.data.digital_pin_to_PCMSK_bit_PGM+0x0): multiple definition of `digital_pin_to_PCMSK_bit_PGM'
/tmp/build4992724107852600463.tmp/core.a(wiring_digital.c.o):(.progmem.data.digital_pin_to_PCMSK_bit_PGM+0x0): first defined here
collect2: error: ld returned 1 exit status
Error compiling.
... so I went looking for where this pre-existing definition was, and doing the following command;
grep -r digital_pin_to_PCMSK_bit_PGM .
... from the root of my arduino folder (i.e. ~/arduino-1.6.5) returned no results. So I double checked and I didn't see any such definition in the suspected location (~/arduino-1.6.5/hardware/arduino/avr/cores/arduino/wiring_digital.c). FWIW, my board definition delegates to the standard ".build.core=arduino:arduino", but I thought the whole point of pins_arduino.h was to over-ride pin-function-mappings in this manner.
So I'm totally puzzled as to what this means. Anyone encounter this before / know what I'm doing wrong? I think I can trivially "fix" this for myself by coming up with a new name to use for my mapping and using it instead of digital_pin_to_PCMSK_bit_PGM in my digitalPinToPCMSKbit macro in pins_arduino.h, but I thought it was strange enough to me to bring to the list for review. I guess I'm concerned about what might be quietly using the mysteriously defined digital_pin_to_PCMSK_bit_PGM array if I sweep it under the rug in that manner.
Insights and feedback appreciated!
Kind Regards,
Vic
Victor Aprea // Wicked Device