Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple build fails on Teensy 4.1 #34

Open
robotichustle opened this issue Apr 13, 2022 · 1 comment
Open

Simple build fails on Teensy 4.1 #34

robotichustle opened this issue Apr 13, 2022 · 1 comment

Comments

@robotichustle
Copy link

robotichustle commented Apr 13, 2022

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.

@lexus2k
Copy link
Owner

lexus2k commented May 2, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants