I'm trying to get this rosserial library to work on Teensy 4.0 but I keep getting an error that I can't figure out:
I don't get this when building for teensy 3.2/3.1. Here are github links to the lines the error mentions: PSTR is defined here and the line with REQUESTPARAM in it is here.
The simplest way to reproduce this is by compiling this program:
I tried to isolate it and got this far but I'm not really sure what is going on:
The error goes away if I get rid of the Msg class but that is a bit tougher to do in the full code haha.
I'm using PlatformIO to build this and I get the same error in the Arduino IDE. Note that the version of this library in the Arduino library manager is outdated so it has to come from github. Here is my platformio.ini file:
My rough understanding is that it is trying to put two strings in the same place in flash or something. Anyone have any ideas on how to fix this or have any insight on what the error means?
Thanks!
- Caleb
Code:
In file included from C:\Users\Caleb\.platformio\packages\framework-arduinoteensy\cores\teensy4/WProgram.h:41:0,
from C:\Users\Caleb\.platformio\packages\framework-arduinoteensy\cores\teensy4/Arduino.h:6,
from src\main.cpp:1:
C:\Users\Caleb\.platformio\packages\framework-arduinoteensy\cores\teensy4/avr/pgmspace.h:35:39: error: data causes a section type conflict with rosserial_msgs::REQUESTPARAM
#define PSTR(str) ({static const char data[] PROGMEM = (str); &data[0];})
^
.pio\libdeps\teensy40\Rosserial Arduino Library\src/rosserial_msgs/RequestParam.h:213:41: note: in expansion of macro 'PSTR'
const char * getMD5() { return PSTR("9f0e98bda65981986ddf53afa7a40e49");};
^
In file included from .pio\libdeps\teensy40\Rosserial Arduino Library\src/ros/node_handle.h:43:0,
from .pio\libdeps\teensy40\Rosserial Arduino Library\src/ros.h:38,
from src\main.cpp:3:
.pio\libdeps\teensy40\Rosserial Arduino Library\src/rosserial_msgs/RequestParam.h:15:23: note: 'rosserial_msgs::REQUESTPARAM' was declared here
static const char REQUESTPARAM[] PROGMEM = "rosserial_msgs/RequestParam";
The simplest way to reproduce this is by compiling this program:
Code:
#include <Arduino.h>
#include "ros.h"
ros::NodeHandle node;
void setup() {}
void loop() {}
I tried to isolate it and got this far but I'm not really sure what is going on:
Code:
#include <Arduino.h>
class Msg
{
public:
virtual const char * getType() = 0;
virtual const char * getMD5() = 0;
};
static const char REQUESTPARAM[] PROGMEM = "test1";
class RequestParamRequest : public Msg
{
const char * getType(){ return REQUESTPARAM; };
const char * getMD5() { return PSTR("test2");};
};
RequestParamRequest test;
void setup() {}
void loop() {}
I'm using PlatformIO to build this and I get the same error in the Arduino IDE. Note that the version of this library in the Arduino library manager is outdated so it has to come from github. Here is my platformio.ini file:
Code:
[env:teensy40]
platform = teensy
board = teensy40
framework = arduino
lib_deps =
https://github.com/frankjoshua/rosserial_arduino_lib.git
;lib_ignore =
; Rosserial Arduino Library
[env:teensy31]
platform = teensy
board = teensy31
framework = arduino
lib_deps =
https://github.com/frankjoshua/rosserial_arduino_lib.git
My rough understanding is that it is trying to put two strings in the same place in flash or something. Anyone have any ideas on how to fix this or have any insight on what the error means?
Thanks!
- Caleb