energia / tivac-core

7 stars 17 forks source link

Support for Firmata Library (was: Error on uploading firmatta to tiva C) #26

Closed robertinant closed 4 years ago

robertinant commented 6 years ago

From @cjdg on May 30, 2015 17:55

when i load the StandardFirmata i get the next error

StandardFirmata.cpp.o: In function setPinModeCallback(unsigned char, int)': StandardFirmata.cpp:(.text._Z18setPinModeCallbackhi+0x5a): undefined reference toServo::attached()' StandardFirmata.cpp:(.text._Z18setPinModeCallbackhi+0x1ec): undefined reference to Servo::attached()' StandardFirmata.cpp.o: In functionsysexCallback(unsigned char, unsigned char, unsigned char*)': StandardFirmata.cpp:(.text._Z13sysexCallbackhhPh+0x1d6): undefined reference to `Servo::attached()' collect2: error: ld returned 1 exit status

Copied from original issue: energia/Energia#626

robertinant commented 6 years ago

From @rei-vilo on May 30, 2015 18:1

Please refer to #384 and #457 and #608.

robertinant commented 6 years ago

From @chintanp on June 18, 2015 18:1

So, there is no solution to the error .. correct ? I read those issues, and couldnt find anything relevant.

robertinant commented 6 years ago

From @rei-vilo on June 18, 2015 18:7

It seems Firmata has been ported to Energia.

robertinant commented 6 years ago

From @chintanp on June 19, 2015 6:10

Does that mean, we dont have to separately download the folder and add it to libraries ? I did as instructed in https://github.com/energia/Energia/tree/master/libraries/Firmata for initialising Firmata example - StandardFirmata, but I got the error as OP.

robertinant commented 6 years ago

From @rei-vilo on June 22, 2015 12:34

If you have a look at the Boards.h file, only __TM4C123GH6PM__ i.e. LaunchPad Tiva C Series is supported, not __LM4F120H5QR__ i.e. LaunchPad Stellaris.

Just edit the corresponding line and add the missing board:

#elif (defined(__TM4C123GH6PM__) || defined(__LM4F120H5QR__))
robertinant commented 6 years ago

From @chintanp on June 22, 2015 14:7

I am using a TM4C123GXL Launchpad, and when I read the boards.h in the firmata library, it has following definitions in TM4C123GXL section

// Tiva C TM4C123G - EK-TM4C123GXL

elif defined(TM4C123GH6PM)

define TOTAL_ANALOG_PINS 13

define TOTAL_PINS 41

define VERSION_BLINK_PIN 40

define IS_PIN_DIGITAL(p) ((p)>=2 && (p)<=TOTAL_PINS && (p)!=16 && (p)!=20 && (p)!=21 && (p)!=22)

define IS_PIN_ANALOG(p) ((p)>=23 && (p)<=29) || (p==2) || (p==5) || (p==6) || (p==7) || (p==18)

define IS_PIN_PWM(p) ((p)==2 || (p)==3 || (p)==4 || (p)==7) || \

                             (p)==14 || (p)==15 || (p)==17 || (p)==19 || \
                             ((p)>=23 && (p)<=26) || (p)==30 || \
                             ((p)>=31 && (p)<=40)

define IS_PIN_SERVO(p) (IS_PIN_PWM(p) && (p) >= 0 && (p) < MAX_SERVOS)

define IS_PIN_I2C(p) ((p) == 19 || (p) == 38)

define PIN_TO_DIGITAL(p) (p)

define PIN_TO_ANALOG(p) ((p)>=23 && (p)<=26)?(30-(p)):\

                             ((p)>=27&&(p)<=29)?(29-p):\
                             ((p)==18)?(3):\
                             ((p)==2)?(11):\
                             ((p)==5)?(9):\
                             ((p)==6)?(8):(10)

define PIN_TO_PWM(p) PIN_TO_DIGITAL(p)

define PIN_TO_SERVO(p) (p)

What more can I do ?

robertinant commented 6 years ago

From @chintanp on June 22, 2015 14:14

Actually, I understood what you meant when I saw the changes you had made to boards.h, even using the new version results in the same error, which I present verbatim:

StandardFirmata.cpp.o: In function `setPinModeCallback(unsigned char, int)':
StandardFirmata.cpp:(.text._Z18setPinModeCallbackhi+0x5a): undefined reference to     `Servo::attached()'
StandardFirmata.cpp:(.text._Z18setPinModeCallbackhi+0x1ec): undefined reference to `Servo::attached()'
StandardFirmata.cpp.o: In function `sysexCallback(unsigned char, unsigned char, unsigned char*)':
StandardFirmata.cpp:(.text._Z13sysexCallbackhhPh+0x1d6): undefined reference to `Servo::attached()'
collect2.exe: error: ld returned 1 exit status
robertinant commented 6 years ago

From @rei-vilo on June 22, 2015 14:36

Are you using the servo library?

Try and comment the lines related to the servo on the Firmata library.

Also, check TM4C123GH6PM or __TM4C123GH6PM__ is duly defined by Energia with Serial.println(TM4C123GH6PM);.

The Firmata library hasn't been updated for the last 6 months, so I guess it is not widely used and no longer maintained.

robertinant commented 6 years ago

From @chintanp on June 22, 2015 17:14

I am not doing anything with servo. I just want to run the vanilla code as in the example, it just gives me these errors. I tried commenting out the Library: Servo.h, but that creates so many errors, as the code is highly dependent on this library.

I did Serial.println(TM4C123GH6PM); and it worked.

Sorry to bother u, if you are not the maintainer, but suggest keeping the issue open,

robertinant commented 6 years ago

From @rei-vilo on June 22, 2015 20:1

The Firmata library isn't part of the compiled Energia.

A simple sketch compiled against the Stellaris LaunchPad as well as other boards throws the error

sketch_jun22a.ino:1:21: fatal error: Firmata.h: No such file or directory compilation terminated.

#include "Firmata.h"

void setup() { }

void loop() { }

So, IMHO, this library is no longer part of the package.

robertinant commented 6 years ago

From @rei-vilo on June 22, 2015 20:3

Adding the Firmata folder manually to the Library sub-folder of the sketchbook makes it available.

Compilation against the Stellaris LaunchPad completes successfully. I can't replicate your issue.

Are you using other libraries that may conflict with Firmata?

robertinant commented 6 years ago

From @rei-vilo on June 28, 2015 15:28

Renamed as Support for Firmata Library

robertinant commented 4 years ago

No plans to add the firmmate library to the tivac core thus closing.