board707 / w80x_arduino

w806 package for Arduino IDE
GNU Lesser General Public License v2.1
68 stars 12 forks source link

fix for linker errors #23

Closed RudolphRiedel closed 1 year ago

RudolphRiedel commented 1 year ago

There is a linker error when trying to compile projects with not only an .ino but also .c and .cpp files. "multiple definition of `pin_Map'"

And the cause for this is that pins_arduino.h for has this in it: const PIN_MAP pin_Map[] = { { GPIOA, GPIO_PIN_0, PA0, DIO|PWM2|_SPI_SS}, { GPIOA, GPIO_PIN_1, PA1, DIO|ADC1|PWM3}, // JTAG_CK ...

As this is an declaration of a variable you end up with multiple copes of pin_Map across the object files.

This pull request fixes the issue by moving the declaration of pin_Map to Arduino.c.

This project did not link before the fix and not it does build for W801, W806 and Air103: EVE_HelloWorld_Arduino_IDE.zip

It may not work though, but that is something for me to explore, now that it builds.

board707 commented 1 year ago

Hi Thanks for the PR. I like the idea of describing the changes in the location of the pins in different versions of the boards through defines like MUX_PA11. I'm willing to consider accepting your code into the master branch. However, there is a problem - it seems that you used an outdated version of the package as the base of your PR. Please merge the hal-v0.6.0 branch into your branch to make changes to the analog pin definitions, add functionality yield() etc

RudolphRiedel commented 1 year ago

Oh, damn, I took the files from the fresh arduino installation, sorry, I will check and update the pull-request.

RudolphRiedel commented 1 year ago

Sorry again, that should be it. And I replaced the whole Arduino installation with the latest files from this repository now, what I should have done to begin with.

What I am actually interested in is the SPI and from the first look with the logic analyzer, the SPI is surprisingly slow, I'll have a look at that.

board707 commented 1 year ago

that should be it.

Thank you, looks good. I need a time to investigate it.

What I am actually interested in is the SPI and from the first look with the logic analyzer, the SPI is surprisingly slow, I'll have a look at that.

Could you please open an issue and share your observations?

board707 commented 1 year ago

Hi @RudolphRiedel

I have merged your PR to test branch test_pinmap to make it easier to test it. If no incompatibilities are found, it will be merged into the main branch. Thank for your contribution. Dmitry

board707 commented 1 year ago

Accepted in default branch.