Mbed Ethernet with serial port error Nucleo F746ZG - c++

I am trying to use the ethernet connection on the Nucleo F746ZG,
But whenever i use the official include of mbed my pins aren't recognized anymore.
Besides that some of the standard commands dont work either like digitalout.
All help is welcome and thanks in advance.
#include "EthernetInterface.h"
#include "mbed.h" //Includes a diffent map.
#include <string>
Serial pc(USBTX, USBRX);//Selects the type of serial and assigns a name to it.
DigitalOut led1(LED1);//Selects the led.
CAN can1(PD_0, PD_1); <---- // CAN isnt recognized anymore //Sets the pins for the CAN.
this is the error i receive:
Error: Identifier "CAN" is undefined in "Nucleo_F746ZG_Ethernet/main.cpp", Line: 7, Col: 2

I'd suggest updating to the latest Mbed OS version, I've tested this on Mbed OS 5.10 against the Nucleo-F746ZG and it compiles fine.

Related

ESP8266[NodeMCU] LittleFS Library Problem

I'm working on Arduino IDE to implement LittleFS file system.However I get the error message as "src\LITTLEFS.cpp:17:21: fatal error: vfs_api.h: No such file or directory
#include "vfs_api.h" when I try to compile my program.
Code :
#include <Arduino.h>
#include "FS.h"
#include <LITTLEFS.h>
#define FORMAT_LITTLEFS_IF_FAILED true
void setup(){
}
void loop(){
}
Arduino version : 1.8.13
Board : NodeMCU v3(ESP12-E Module 1.0)
Flash Size : 4MB(1 MB SPIFFS)
Seems like you've chosen the ESP32 version of this project, which doesn't run on ESP8266. Try the ESP8266 version instead.

Arduino / esp8266: error: section attribute not allowed for 'Pchr

My Arduino program had compiled and worked correctly but something happen or I did something because now when I compile it, I get an compiler error. I have tried upgrading esp8266 v2.4.1 to 2.5.2 but then I get another error in the random.tcc header file. I am compiling my code with Visual Studio 2017 with Visual Micro. I have seen this error on the web but upgrading didn't seem to help.
Any suggestions?
OUTPUT
Adafruit_ESP8266.cpp:17: In file included from
Adafruit_ESP8266.h: 28:35: error: section attribute not allowed for 'Pchr
typedef const PROGMEM char Pchr; \\ Ditto, kindasorta
SOURCE
#include <Adafruit_ESP8266.h>
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
// the setup function runs once when you press reset or power the board
void setup()
{
Serial.println("Begin Setup");
Serial.println("End Setup");
}
// the loop function runs over and over again until power down or reset
void loop()
{
Serial.println("Begin Loop");
Serial.println("End Loop");
}
I fixed my error by removing the header file Adafruit_ESP8266.h. I must of clicked on something that included it.

cross compiler raspberry pi incomplete type while native compiler works

I've set up a cross compiler for my raspberry pi, the one I found here: Installing Raspberry Pi Cross-Compiler
Now this has been working fine, up to the point where I want to use an I2c library (i2c-dev.h).
When compiling the code below with the arm-linux-gnueabihf-g++ compiler, I get an error:
In file included from src/I2c.cpp:8:0:
src/../Include/I2c.h:29:18: error: field ‘message’ has incomplete type
struct i2c_msg message;
^
Meanwhile, when I compile the code on a raspi, it simply runs.
#ifndef I2C_H_
#define I2C_H_
#include <linux/i2c-dev.h> // Defines i2c_msg
#include ...
using namespace std;
typedef struct {
struct i2c_msg message;
void (*callback)(int);
int messageID;
} t_msgQueue;
Any ideas on a possible cause, or a solution on how I can make the cross compiler work properly?
My first suspect would be differing GCC versions between the RPi and your cross compiler; GCC has been known to change how it processes #include statements over time.
Barring a version difference, check to ensure that a host include file hasn't been picked up somwhere by accident.
Problem was solved by adding a
#include <linux/i2c.h>
before the i2c-dev headers. Still no idea why the two compilers gave different results...

PCAN USB QT Interfacing issue

I recently purchased one PCAN USB device. I am having trouble interfacing the APIs with my Qt GUI.
I am using #include <libpcan.h> and #include <pcan.h> in my code as mentioned in one sample code. I am compiling the code with -lpcanfd compiler flag . Once I add #include <libpcan.h> in the header and compile my Qt code I get an error like this:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qthread.h:53:16: error:
expected unqualified-id before 'void' static Qt::HANDLE
currentThreadId() Q_DECL_NOTHROW;
If i comment #include <libpcan.h> the compile process finished without error(s). Can anyone suggest me a solution? Without including libpcan header I won't be able to use the device.

How do you build the example CUDA Thrust device sort?

I am trying to build and run the Thrust example code in Visual Studio 2010 with the latest version (7.0) of CUDA and the THURST install that comes with it. I cannot get the example code to build and run.
By eliminating parts of the code, I found the problem to be with the thrust::sort(..) call. Host vectors work great, but device vectors produce the following compile error:
1>c:\program files\nvidia gpu computing toolkit\cuda\v7.0\include\thrust\system\cuda\detail\sort.inl(203): error C2027: use of undefined type 'thrust::detail::STATIC_ASSERTION_FAILURE'
This is the example code I'm using that won't compile which is largely out of the CUDA trust example at https://developer.nvidia.com/Thrust
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/generate.h>
#include <thrust/sort.h>
#include <thrust/copy.h>
#include <algorithm>
#include <cstdlib>
#include <time.h>
int main(void)
{
// generate 32M random numbers serially
thrust::host_vector<int> h_vec(32 << 20);
std::generate(h_vec.begin(), h_vec.end(), rand);
// transfer data to the device
thrust::device_vector<int> d_vec = h_vec;
// sort data on the device (This breaks the compile)
thrust::sort(d_vec.begin(), d_vec.end());
// sort data on the host (This works just fine)
thrust::sort(h_vec.begin(), d_vec.end());
// transfer data back to host
thrust::copy(d_vec.begin(), d_vec.end(), h_vec.begin());
return 0;
}
Playing around I found that if you comment out the line that uses the device vector:
// thrust::sort(d_vec.begin(), d_vec.end());
but leave the line that uses the host vector:
thrust::sort(h_vec.begin(), d_vec.end());
it compiles and runs just fine, though the sort seems to be running on the host.
How do I get the example code to compile and run so the sort will take place on the device vector and not the host vector?
My system configuration includes:
Visual Studio 2010 / SP1 installed
Windows 7 pro, 64bit
CUDA 7.0 Development kit
NVIDA Quadro K4000 with recent drivers
As #JaredHoberock pointed out, probably the key issue is that you are trying to compile a .cpp file. You need to rename that file to .cu and also make sure it is being compiled by nvcc.
After you fix that, you will probably run into another issue. This is not correct and will not compile:
thrust::sort(h_vec.begin(), d_vec.end());
The first parameter here is the start of the range to sort, the second parameter is the end of the range. Your first parameter identifies the start of the range as being on the host, and the end of the range as being on the device. That will trigger a compile error.
Change it to:
thrust::sort(h_vec.begin(), h_vec.end());
and your code compiles and runs successfully for me.
In your above example, this line is completely useless. It is not needed to sort the data, and you are overwriting the result anyway here:
thrust::copy(d_vec.begin(), d_vec.end(), h_vec.begin());
(marking CW as the key issue was pointed out by Jared Hoberock)