IRMP-org / IRMP

Infrared Multi Protocol Decoder
GNU General Public License v3.0
267 stars 43 forks source link

Redefinitions causing code to fail compilation on Sparkfun Artemis Boards (Apollo 3) #34

Closed marsfan closed 3 years ago

marsfan commented 3 years ago

Bug Report

Arduino Platform

IDE

IR-Protocol

Example to reproduce the issue

Pin(s) used for IR-receive, if not default

Version

Current behavior

Code is the AllProtocols example with no changes made to it

Output ``` In file included from D:\Documents\Arduino\libraries\IRMP\src/irmp.h:31, from D:\Documents\Arduino\libraries\IRMP\src/irmp.c.h:26, from C:\Users\Gabe\AppData\Local\Temp\arduino_modified_sketch_266082\AllProtocols.ino:88: D:\Documents\Arduino\libraries\IRMP\src/irmpArduinoExt.h:84: warning: "F" redefined #define F(a) a In file included from C:\Users\Gabe\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.0.3/cores/arduino/mbed-bridge/core-api/api/Print.h:24, from C:\Users\Gabe\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.0.3/cores/arduino/mbed-bridge/core-api/api/Stream.h:25, from C:\Users\Gabe\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.0.3/cores/arduino/mbed-bridge/core-api/api/Client.h:22, from C:\Users\Gabe\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.0.3/cores/arduino/mbed-bridge/core-api/api/ArduinoAPI.h:29, from C:\Users\Gabe\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.0.3/cores/arduino/mbed-bridge/Arduino.h:14, from C:\Users\Gabe\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.0.3/cores/arduino/sdk/ArduinoSDK.h:9, from : C:\Users\Gabe\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.0.3/cores/arduino/mbed-bridge/core-api/api/String.h:45: note: this is the location of the previous definition #define F(string_literal) (reinterpret_cast(PSTR(string_literal))) c:/users/gabe/appdata/local/arduino15/packages/sparkfun/tools/arm-none-eabi-gcc/8-2018-q4-major/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\Gabe\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.0.3\variants\SFE_ARTEMIS_ATP/mbed/libmbed-os.a(isr.o): in function `am_ctimer_isr': /github/workspace/mbed-builds/artemis-redboard-atp-lib_1/mbed-os/targets/TARGET_Ambiq_Micro/TARGET_Apollo3/device/isr.c:6: multiple definition of `am_ctimer_isr'; sketch\AllProtocols.ino.cpp.o:D:\Documents\Arduino\libraries\IRMP\src/IRTimer.cpp.h:657: first defined here collect2.exe: error: ld returned 1 exit status exit status 1 Error compiling for board RedBoard Artemis ATP. ```

Code fails during compilation due to redefinition of am_ctimer_isr(void) and F(a)

Expected behavior

Code Compiles correctly.

Additional context

It seems that Sparkfun added their own functions that implement the interrupts and F(a) substitution.

I tested commenting out the function definitions of am_ctimer_isr(void) and F(a) in this library and found that the Arduino IDE properly compiles the AllProtocols example when the configured board is the Sparkfun Artemis Redboard ATP. I will plan to verify that the library works properly with the code commented out, and will submit a PR if I find that it does.

ArminJo commented 3 years ago

Hi, I am not able to reporduce the error I only get some strange BFD errors at the end of linking.

marsfan commented 3 years ago

@ArminJo BFD Error on the Sparkfun Artemis? I don't even know what that is. I have a little bit of experience with wading through the Artemis docs, can you upload your error output?

ArminJo commented 3 years ago

Here they are: https://github.com/ukw100/IRMP/runs/1615150246?check_suite_focus=true#step:3:622 search for BFD and you will find a lot. I get the same error on W10 with the Arduino IDE, so support is highly appreciated ๐Ÿ‘

ArminJo commented 3 years ago

The BFD error is fixed! ๐Ÿ˜€

marsfan commented 3 years ago

@ArminJo I don't know about the BFD error, but I can tell you this, because i just fixed this myself earlier today. You are using a really old version of the Artemis Board Package (You are using 1.2.1, newest is 2.0.3). They changed the board manager URL to https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/master/package_sparkfun_apollo3_index.json.

I bet that updating that will also cause you to have the same error that I opened this bug report for. Like I said, I just realized and fixed the URL myself earlier today.

ArminJo commented 3 years ago

Thanks for the new board manager URL! I changed the sources now, so that no errors should happen any more. Can you please do me the favor and check if the timer works like before? I.e. IR receiving is working and the feedback led is flickering.

marsfan commented 3 years ago

@ArminJo I was working on that earlier and plugged my IR receiver in backwards and destroyed it, so I cannot test it right now. I likely will not be able to get another IR receiver until January 6, but I will look around and see if I have one laying around that I previously did not find. I am currently working on writing a script to run a test of the transmission mode, so I hope to have done tonight though.

marsfan commented 3 years ago

@ArminJo I found another IR receiver and tested it. It now compiles fine and runs fine. on the Artemis ATP

ArminJo commented 3 years ago

Thanks ๐Ÿ‘

marsfan commented 3 years ago

@ArminJo I just was looking around. You might actually want to test against both V1.2.1 cores and V2.x cores for the Artemis. Some of the capabilities from the V1 core are still not available in the V2 core, so some people still use the V1 core.

ArminJo commented 3 years ago

Thanks, for the advice ๐Ÿ‘