lexus2k/tinyproto

Simple build fails on Teensy 4.1

robotichustle opened this issue · 1 comments

Hi, I am trying to build a simple tinyproto example on Teensy 4.1 using PlatformIO. I replaced tinyproto::Light to Tiny::ProtoLight and tinyproto::StaticPacket<256> to Tiny::Packet<256> because tinyproto namespace didn't exist. The error is undefined reference to millis.

My main.cpp code looks as follows:

#include <Arduino.h>
#include <TinyProtocol.h>

/* Creating protocol object is simple */
Tiny::ProtoLight  proto;

void setup()
{
    /* No timeout, since we want non-blocking UART operations. */
    Serial.setTimeout(10);
    /* Initialize serial protocol for test purposes */
    Serial.begin(115200);
    /* Lets use 8-bit checksum, available on all platforms */
    proto.enableCheckSum();
    /* Redirect all protocol communication to Serial0 UART */
    proto.beginToSerial();
}

/* Specify buffer for packets to send and receive */
Tiny::Packet<256> packet;

void loop()
{
    if (Serial.available())
    {
        int len = proto.read( packet );
        if (len > 0)
        {
            /* Send message back */
            proto.write( packet );
        }
    }
}

My platformio.ini file is simple:

[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
lib_deps = 
	lexus2k/tinyproto@^0.9.3

Here is the full error:

> Executing task: C:\Users\Robotic\.platformio\penv\Scripts\platformio.exe run --environment teensy41 <

Processing teensy41 (platform: teensy; board: teensy41; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.15.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
 - framework-arduinoteensy 1.156.0 (1.56) 
 - tool-teensy 1.155.0 (1.55)
 - toolchain-gccarmnoneeabi 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 93 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <tinyproto> 0.9.3
Building in release mode
Compiling .pio\build\teensy41\src\main.cpp.o
In file included from .pio\libdeps\teensy41\tinyproto\src/TinyProtocol.h:32:0,
                 from src\main.cpp:2:
.pio\libdeps\teensy41\tinyproto\src/TinyProtocolHd.h: In lambda function:
.pio\libdeps\teensy41\tinyproto\src/TinyProtocolHd.h:97:90: warning: invalid conversion from 'uint8_t* {aka unsigned char*}' to 'char*' [-fpermissive]
                [](void *p, void *b, int s)->int { return Serial.readBytes((uint8_t *)b, s); });
                                                                                          ^
In file included from C:\Users\Robotic\.platformio\packages\framework-arduinoteensy\cores\teensy4/WProgram.h:51:0,
                 from C:\Users\Robotic\.platformio\packages\framework-arduinoteensy\cores\teensy4/Arduino.h:6,
                 from src\main.cpp:1:
C:\Users\Robotic\.platformio\packages\framework-arduinoteensy\cores\teensy4/usb_serial.h:113:9: note:   initializing argument 1 of 'size_t usb_serial_class::readBytes(char*, size_t)'
  size_t readBytes(char *buffer, size_t length) {
         ^
In file included from .pio\libdeps\teensy41\tinyproto\src/TinyProtocol.h:33:0,
                 from src\main.cpp:2:
.pio\libdeps\teensy41\tinyproto\src/TinyProtocolFd.h: In lambda function:
.pio\libdeps\teensy41\tinyproto\src/TinyProtocolFd.h:91:90: warning: invalid conversion from 'uint8_t* {aka unsigned char*}' to 'char*' [-fpermissive]
                [](void *p, void *b, int s)->int { return Serial.readBytes((uint8_t *)b, s); });
                                                                                          ^
In file included from C:\Users\Robotic\.platformio\packages\framework-arduinoteensy\cores\teensy4/WProgram.h:51:0,
                 from C:\Users\Robotic\.platformio\packages\framework-arduinoteensy\cores\teensy4/Arduino.h:6,
                 from src\main.cpp:1:
C:\Users\Robotic\.platformio\packages\framework-arduinoteensy\cores\teensy4/usb_serial.h:113:9: note:   initializing argument 1 of 'size_t usb_serial_class::readBytes(char*, size_t)'
  size_t readBytes(char *buffer, size_t length) {
         ^
Linking .pio\build\teensy41\firmware.elf
.pio\build\teensy41\libbbb\libtinyproto.a(tiny_types.c.o): In function `tiny_events_wait':
tiny_types.c:(.text.tiny_events_wait+0x10): undefined reference to `millis'
tiny_types.c:(.text.tiny_events_wait+0x54): undefined reference to `millis'
.pio\build\teensy41\libbbb\libtinyproto.a(tiny_types.c.o): In function `tiny_millis':
tiny_types.c:(.text.tiny_millis+0x0): undefined reference to `millis'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\teensy41\firmware.elf] Error 1
================================================================================================================= [FAILED] Took 1.03 seconds =================================================================================================================
The terminal process "C:\Users\Robotic\.platformio\penv\Scripts\platformio.exe 'run', '--environment', 'teensy41'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

I'd appreciate any help in fixing this error. Thanks in advance.

Hi

The library version you have doesn't correspond to the example you pointed in the description.
Could you please move to the latest version of the library?