diff options
| author | MDC Service <michael.schmid@mdc-service.de> | 2022-05-23 11:17:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-23 11:17:34 +0200 |
| commit | 74a0003fea4087de8e9f03b6f828c45d255bcd4a (patch) | |
| tree | 1b4615232dcac918fcc47cbd3c6ed54014fb38b7 /software/main | |
| parent | d2f3c7c9e17895ae43caed761f941a30e4e5eed6 (diff) | |
initial check in firmware files
Diffstat (limited to 'software/main')
32 files changed, 5890 insertions, 0 deletions
diff --git a/software/main/CMakeLists.txt b/software/main/CMakeLists.txt new file mode 100644 index 0000000..dc2a20b --- /dev/null +++ b/software/main/CMakeLists.txt @@ -0,0 +1,2 @@ +idf_component_register(SRCS "main.cpp" "SimplePgSQL.cpp" "MU80X.cpp" "HMI.cpp" "etc.cpp" "uart.cpp" "iic.cpp" "config.cpp" + INCLUDE_DIRS ".") diff --git a/software/main/HMI.cpp b/software/main/HMI.cpp new file mode 100644 index 0000000..8ed8cda --- /dev/null +++ b/software/main/HMI.cpp @@ -0,0 +1,176 @@ +/* + * HMI.cpp + * + * Created on: 17.08.2021 + * Author: steffen + */ +#include "HMI.h" + +#ifdef ESP32 +HMI::HMI(int fh) { + _devh = fh; +} +#else +HMI::HMI(const char *dev, const uint16_t baud) { + struct termios t1, t2; + + int bd = B115200; + if (baud == 57600) + bd = B57600; + + _devh = open(dev, O_RDWR | O_NONBLOCK); + if (_devh < 0) { + fprintf(stderr, "Unable to open serial device %s", dev); + } else { + + tcgetattr(_devh, &t1); + tcgetattr(_devh, &t2); + cfmakeraw(&t1); + + t1.c_cflag = (CLOCAL | CS8 | CREAD); + cfsetspeed(&t1, bd); + t1.c_cc[VMIN] = 0; + t1.c_cc[VTIME] = 0; + tcsetattr(_devh, TCSADRAIN, &t1); + } + +} +#endif + + +int HMI::serial_read(int fh, char *buf) { +#ifdef ESP32 + return (uart_read_bytes(fh, buf, 1, 1)); +#else + return (read(fh,buf,1)); +#endif +} + +int HMI::serial_write(int fh, char *buf, int len) { +#ifdef ESP32 + return (uart_write_bytes(fh, buf, len)); +#else + return(write(fh,buf,len)); +#endif +} + +int HMI::iReadProt(int ms) { + int cnt = ms; + int ec = 0; // end counter (3 x 0xFF) + char rc; + int i=0; + int res; + printf("CNT:%d\n",cnt);fflush(stdout); + while (cnt > 0) { + if ((res=serial_read(_devh, &rc)) == 1) { +#ifdef DEBUG + printf(" <%02X> ", rc); + fflush (stdout); +#endif + RecvBuf[i++]=rc; + if (rc==0xFF) { + ec++; + if (ec==3) { + i-=3; + RecvBuf[i]=0; +#ifdef DEBUG + idumpbuf(RecvBuf,i); + printf("OK Received:%d\n", i); + fflush(stdout); +#endif + return HMIResultOK; + } + } + cnt = ms; + } else { + cnt--; +#ifdef DEBUG + printf(" - "); + fflush (stdout); +#endif +#ifdef ESP32 + vTaskDelay(1); +#else + usleep(1000); +#endif + } + } + if (i==0) return HMIResultReadErr; + RecvBuf[i]=0; +#ifdef DEBUG + printf("ERR Received:%d:%s\n", i,RecvBuf); + fflush(stdout); +#endif + return HMIResultReadErr; +} + +int HMI::iReadValue(char *name,int *result) { + char cmd[64]; + int res; + sprintf(cmd,"get %s.txt",name); + res=iSendProt((int)strlen(cmd),cmd); + return res; +} +int HMI::iReadValue(char *name, char *result) { + char cmd[64]; + int res; + sprintf(cmd,"get %s.txt",name); + res=iSendProt((int)strlen(cmd),cmd,10); +// printf(">%s:%d<\n",cmd,res);fflush(stdout); + if (res==HMIResultOK) { +// idumpbuf((void *)RecvBuf, (int)strlen((char *)RecvBuf)); + strncpy(result,(char *)&RecvBuf[1],16); + } + return res; +} +int HMI::iWriteValue(char *name,int value) { + char cmd[64]; + int res; + sprintf(cmd,"%s.txt=\"%d\"",name,value); +#ifdef DEBUG +// printf(">%s<\n",cmd);fflush(stdout); +#endif + res=iSendProt((int)strlen(cmd),cmd); + return res; +} +int HMI::iWriteValue(char *name,char * value) { + char cmd[64]; + int res; + sprintf(cmd,"%s.txt=\"%s\"",name,value); +#ifdef DEBUG +// printf(">%s<\n",cmd);fflush(stdout); +#endif + res=iSendProt((int)strlen(cmd),cmd); + return res; +} +int HMI::iSendProt(int len, char *data) { + int res = 0; + int res2=0; + char lbuf[]={0xFF,0xFF,0xFF}; + res = serial_write(_devh, (char *)data, (int)len); + if (res>0) res2=serial_write(_devh, lbuf, 3); + else return HMIResultWriteErr; + if (res2<0) return HMIResultWriteErr; + return HMIResultOK;; +} +int HMI::iSendProt(int len, char *data, int wait) { + int res = 0; + int res2=0; + char lbuf[]={0xFF,0xFF,0xFF}; + res = serial_write(_devh, (char *)data, (int)len); + if (res>0) res2=serial_write(_devh, (char *)lbuf, 3); + else return HMIResultWriteErr; + if (res2<0) return HMIResultWriteErr; + if (wait==0) return res; + res = iReadProt(wait); + return res; +} +void HMI::idumpbuf(void *buf, int len) { + int i, c; + char *lb = (char*) buf; + for (i = 0; i < len; i++) { + c = (char) *lb++; + printf("%02X ", c); + } + printf("\n"); +} diff --git a/software/main/HMI.h b/software/main/HMI.h new file mode 100644 index 0000000..d377ccb --- /dev/null +++ b/software/main/HMI.h @@ -0,0 +1,114 @@ +/* + * LCD.h + * + * Created on: 17.08.2021 + * Author: steffen + */ + +#ifndef HMI_H_ +#define HMI_H_ +#include "main.h" + +#define DEBUG +#define ESP32 +#define ProtBufLen 260 + +#define ERR_NOERR 0 +#define ERR_CRC -1 +#define ERR_WRITE -2 +#define ERR_NOANSWER -3 +#define ERR_DECODE -4 + + +#define BAUD_9600 0 +#define BAUD_19200 1 +#define BAUD_38400 2 +#define BAUD_57600 5 +#define BAUD_115200 6 + +#define PIC_WELCOME 0 +#define PIC_OPENDOOR 1 +#define PIC_EMPTY 2 +#define PIC_KAS_OK 3 +#define PIC_KAS_DIS 4 +#define PIC_TRS_OK 5 +#define PIC_TRS_DIS 6 + +#define BUT0 p0 +#define TXT0 t0 +#define BUT1 p1 +#define TXT1 t1 +#define BUT2 p2 +#define TXT2 t2 +#define BUT3 p3 +#define TXT3 t3 +#define BUT4 p4 +#define TXT4 t4 +#define BUT5 p5 +#define TXT5 t5 + +#ifdef ESP32 +#include <sys/types.h> +#include <stdio.h> +#include <string.h> +#include <stdint.h> +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_event.h" +#include "esp_log.h" +#include "driver/uart.h" +#else +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <unistd.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <fcntl.h> +#include <termios.h> +#endif + +#define ESP32 +#define HMIResultOK 0 +#define HMIResultWriteErr -1 +#define HMIResultReadErr -2 +#define HMIResultProtErr -3 + +typedef struct { + int page; + int id; + int state; +} HMI_t; + +class HMI { +public: + +#ifdef ESP32 + HMI(const int fh); +#else + HMI(const char *dev = "/dev/ttyUSB0", const uint16_t baud = 57600); +#endif + ~HMI(void); + + int iReadProt(int ms); + int iReadValue(char *name, int *res); + int iReadValue(char *name,char *res); + int iWriteValue(char *name,int value); + int iWriteValue(char *name,char *value); + int iSendProt(int len, char *data); // done + int iSendProt(int len, char *data, int wait); // done + +private: + int _devh; + unsigned char SendBuf[ProtBufLen]; + unsigned char RecvBuf[ProtBufLen]; + int serial_read(int fh, char *buf); + int serial_write(int fh, char * buf,int len); + void idumpbuf(void *buf, int len); + +}; +#endif /* HMI_H_ */ diff --git a/software/main/Kconfig.projbuild b/software/main/Kconfig.projbuild new file mode 100644 index 0000000..be15538 --- /dev/null +++ b/software/main/Kconfig.projbuild @@ -0,0 +1,183 @@ +menu "Example Configuration" + + config EXAMPLE_USE_SPI_ETHERNET + bool + + choice EXAMPLE_ETHERNET_TYPE + prompt "Ethernet Type" + default EXAMPLE_USE_INTERNAL_ETHERNET if IDF_TARGET_ESP32 + default EXAMPLE_USE_W5500 + help + Select which kind of Ethernet will be used in the example. + + config EXAMPLE_USE_INTERNAL_ETHERNET + depends on IDF_TARGET_ESP32 + select ETH_USE_ESP32_EMAC + bool "Internal EMAC" + help + Select internal Ethernet MAC controller. + + config EXAMPLE_USE_DM9051 + bool "DM9051 Module" + select EXAMPLE_USE_SPI_ETHERNET + select ETH_USE_SPI_ETHERNET + select ETH_SPI_ETHERNET_DM9051 + help + Select external SPI-Ethernet module (DM9051). + + config EXAMPLE_USE_W5500 + bool "W5500 Module" + select EXAMPLE_USE_SPI_ETHERNET + select ETH_USE_SPI_ETHERNET + select ETH_SPI_ETHERNET_W5500 + help + Select external SPI-Ethernet module (W5500). + + config EXAMPLE_USE_KSZ8851SNL + bool "KSZ8851SNL Module" + select EXAMPLE_USE_SPI_ETHERNET + select ETH_USE_SPI_ETHERNET + select ETH_SPI_ETHERNET_KSZ8851SNL + help + Select external SPI-Ethernet module (KSZ8851SNL). + endchoice # EXAMPLE_ETHERNET_TYPE + + if EXAMPLE_USE_INTERNAL_ETHERNET + choice EXAMPLE_ETH_PHY_MODEL + prompt "Ethernet PHY Device" + default EXAMPLE_ETH_PHY_IP101 + help + Select the Ethernet PHY device to use in the example. + + config EXAMPLE_ETH_PHY_IP101 + bool "IP101" + help + IP101 is a single port 10/100 MII/RMII/TP/Fiber Fast Ethernet Transceiver. + Goto http://www.icplus.com.tw/pp-IP101G.html for more information about it. + + config EXAMPLE_ETH_PHY_RTL8201 + bool "RTL8201/SR8201" + help + RTL8201F/SR8201F is a single port 10/100Mb Ethernet Transceiver with auto MDIX. + Goto http://www.corechip-sz.com/productsview.asp?id=22 for more information about it. + + config EXAMPLE_ETH_PHY_LAN8720 + bool "LAN8720" + help + LAN8720A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX Support. + Goto https://www.microchip.com/LAN8720A for more information about it. + + config EXAMPLE_ETH_PHY_DP83848 + bool "DP83848" + help + DP83848 is a single port 10/100Mb/s Ethernet Physical Layer Transceiver. + Goto http://www.ti.com/product/DP83848J for more information about it. + + config EXAMPLE_ETH_PHY_KSZ8041 + bool "KSZ8041" + help + The KSZ8041 is a single supply 10Base-T/100Base-TX Physical Layer Transceiver. + Goto https://www.microchip.com/wwwproducts/en/KSZ8041 for more information about it. + + config EXAMPLE_ETH_PHY_KSZ8081 + bool "KSZ8081" + help + The KSZ8081 is a single supply 10Base-T/100Base-TX Physical Layer Transceiver. + Goto https://www.microchip.com/wwwproducts/en/KSZ8081 for more information about it. + endchoice # EXAMPLE_ETH_PHY_MODEL + + config EXAMPLE_ETH_MDC_GPIO + int "SMI MDC GPIO number" + default 23 + help + Set the GPIO number used by SMI MDC. + + config EXAMPLE_ETH_MDIO_GPIO + int "SMI MDIO GPIO number" + default 18 + help + Set the GPIO number used by SMI MDIO. + endif # EXAMPLE_USE_INTERNAL_ETHERNET + + if EXAMPLE_USE_SPI_ETHERNET + config EXAMPLE_ETH_SPI_HOST + int "SPI Host Number" + range 0 2 + default 1 + help + Set the SPI host used to communicate with the SPI Ethernet Controller. + + config EXAMPLE_ETH_SPI_SCLK_GPIO + int "SPI SCLK GPIO number" + range 0 34 if IDF_TARGET_ESP32 + range 0 46 if IDF_TARGET_ESP32S2 + range 0 19 if IDF_TARGET_ESP32C3 + default 18 if IDF_TARGET_ESP32 + default 20 if IDF_TARGET_ESP32S2 + default 6 if IDF_TARGET_ESP32C3 + help + Set the GPIO number used by SPI SCLK. + + config EXAMPLE_ETH_SPI_MOSI_GPIO + int "SPI MOSI GPIO number" + range 0 34 if IDF_TARGET_ESP32 + range 0 46 if IDF_TARGET_ESP32S2 + range 0 19 if IDF_TARGET_ESP32C3 + default 23 if IDF_TARGET_ESP32 + default 19 if IDF_TARGET_ESP32S2 + default 7 if IDF_TARGET_ESP32C3 + help + Set the GPIO number used by SPI MOSI. + + config EXAMPLE_ETH_SPI_MISO_GPIO + int "SPI MISO GPIO number" + range 0 34 if IDF_TARGET_ESP32 + range 0 46 if IDF_TARGET_ESP32S2 + range 0 19 if IDF_TARGET_ESP32C3 + default 19 if IDF_TARGET_ESP32 + default 18 if IDF_TARGET_ESP32S2 + default 2 if IDF_TARGET_ESP32C3 + help + Set the GPIO number used by SPI MISO. + + config EXAMPLE_ETH_SPI_CS_GPIO + int "SPI CS GPIO number" + range 0 34 if IDF_TARGET_ESP32 + range 0 46 if IDF_TARGET_ESP32S2 + range 0 19 if IDF_TARGET_ESP32C3 + default 16 if IDF_TARGET_ESP32 + default 21 if IDF_TARGET_ESP32S2 + default 10 if IDF_TARGET_ESP32C3 + help + Set the GPIO number used by SPI CS. + + config EXAMPLE_ETH_SPI_CLOCK_MHZ + int "SPI clock speed (MHz)" + range 5 80 + default 12 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C3 + default 36 if IDF_TARGET_ESP32S2 + help + Set the clock speed (MHz) of SPI interface. + + config EXAMPLE_ETH_SPI_INT_GPIO + int "Interrupt GPIO number" + default 17 if IDF_TARGET_ESP32 + default 4 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 + help + Set the GPIO number used by the SPI Ethernet module interrupt line. + endif # EXAMPLE_USE_SPI_ETHERNET + + config EXAMPLE_ETH_PHY_RST_GPIO + int "PHY Reset GPIO number" + default 5 + help + Set the GPIO number used to reset PHY chip. + Set to -1 to disable PHY chip hardware reset. + + config EXAMPLE_ETH_PHY_ADDR + int "PHY Address" + range 0 31 + default 1 + help + Set PHY address according your board schematic. +endmenu diff --git a/software/main/MU80X.cpp b/software/main/MU80X.cpp new file mode 100644 index 0000000..c50ac07 --- /dev/null +++ b/software/main/MU80X.cpp @@ -0,0 +1,429 @@ +/* + * clou.cpp + * + * Created on: 15.07.2021 + * Author: steffen + */ +#include "MU80X.h" + +//#define DEBUG +#ifdef ESP32 +MU80X::MU80X(int fh) { + ProtStatus = 0; + ConnectionStatus=0; + TagsInBuffer=0; + TagsSeen=0; + _devid = 0xFF; + + _devh = fh; + + int res = iGetReaderInformation(_devid); + if (res >= 0) { +// printf("RDR Info:%d\n",res); +// DumpBuffer(RecvBuf,res); +// fflush (stdout); + _devid = RecvBuf[1]; + } +} +#else +MU80X::MU80X(const char *dev, const uint16_t baud) { + struct termios t1, t2; + + ProtStatus = 0; + _devid = 0xFF; + + int bd = B115200; + if (baud == 57600) + bd = B57600; + + _devh = open(dev, O_RDWR | O_NONBLOCK); + if (_devh < 0) { + fprintf(stderr, "Unable to open serial device %s", dev); + } else { + + tcgetattr(_devh, &t1); + tcgetattr(_devh, &t2); + cfmakeraw(&t1); + + t1.c_cflag = (CLOCAL | CS8 | CREAD); + cfsetspeed(&t1, bd); + t1.c_cc[VMIN] = 0; + t1.c_cc[VTIME] = 0; + tcsetattr(_devh, TCSADRAIN, &t1); + + int res = iGetReaderInformation(_devid); + if (res >= 0) { + fflush (stdout); + _devid = RecvBuf[1]; + } + } + +} +#endif + +MU80X::~MU80X(void) { +#ifdef ESP32 + +#else + if (_devh > 0) + close(_devh); +#endif +} +// internal +void MU80X::DumpBuffer(unsigned char *buf, int len) { + int i, c; + char *lb = (char*) buf; + for (i = 0; i < len; i++) { + if (i % 32 == 0) + printf("\n"); + c = (char) *lb++; + printf("%02X ", (unsigned char) c); + if (c > 32) + printf(" %c ", c); + else + printf(" "); + + } + printf("\n"); +} + +void MU80X::PrintTag(Tag_t tag) { + int i; + for (i = 0; i < 12; i++) { + printf("%02X ", tag.b[i]); + } + printf("Ant:%d RSSI:%d Count:%d ", tag.ant, tag.rssi, tag.count); + printf("\n"); +} + +int MU80X::_DecodeBuffer(int todecode, int start, unsigned char *buf, + Tag_t *tagbuf) { + int i; + uint8_t len, ant, rssi, count; + for (i = start; i < start + todecode; i++) { +// DumpBuffer(buf,s); + ant = *buf; + buf++; + len = *buf; + buf++; + tagbuf[i].ant = ant; +#ifdef DEBUG + printf("Ant: %d Len: %d",ant,len); +#endif + if (len == 8) { + tagbuf[i].b[0] = 0; + tagbuf[i].b[1] = 0; + tagbuf[i].b[2] = 0; + tagbuf[i].b[3] = 0; + memcpy(&tagbuf[i].b[4], buf, len); + } else if (len == 12) { + memcpy(&tagbuf[i].b[0], buf, len); + } else { + fprintf(stderr, "Unknown Taglength:%d :\n", len); + } + buf += len; + rssi = *buf; + buf++; + count = *buf; + buf++; + tagbuf[i].rssi = rssi; + tagbuf[i].count = count; +#ifdef DEBUG + printf("Ant: %d Len: %d\n",ant,len); +// PrintTag(tagbuf[i]); +#endif + + } + return i - start; +} + +#define PRESET_VALUE 0xFFFF +#define POLYNOMIAL 0x8408 +uint16_t MU80X::_ui16CalculateCrc(unsigned char *data, unsigned char len) { + + unsigned char ucI, ucJ; + uint16_t uiCrcValue = PRESET_VALUE; + for (ucI = 0; ucI < len; ucI++) { + uiCrcValue = uiCrcValue ^ *(data + ucI); + for (ucJ = 0; ucJ < 8; ucJ++) { + if (uiCrcValue & 0x0001) { + uiCrcValue = (uiCrcValue >> 1) ^ POLYNOMIAL; + } else { + uiCrcValue = (uiCrcValue >> 1); + } + } + } + return uiCrcValue; +} + +int MU80X::serial_read(int fh, unsigned char *buf) { +#ifdef ESP32 + return (uart_read_bytes(fh, buf, 1, 1)); +#else + return (read(fh,buf,1)); +#endif +} + +int MU80X::serial_write(int fh, unsigned char *buf, int len) { +#ifdef ESP32 + return (uart_write_bytes(fh, buf, len)); +#else + return(write(fh,buf,len)); +#endif +} + +// low level read and write +int MU80X::iReadProt(int ms) { + int cnt = ms; + int cc = 0; + uint8_t len = 0; + int i; + while (cnt > 0) { + if ((cc == 0) & (serial_read(_devh, &RecvBuf[0]) == 1)) { + len = (uint8_t) RecvBuf[0]; +#ifdef DEBUG + printf("\nNeed to receive:%d\n", len+1); +#endif + fflush (stdout); + cc = 1; + cnt = ms; + i = 1; + while (i <= len) { + if (serial_read(_devh, &RecvBuf[i]) == 1) { + i++; + cnt = ms; + } else { +// printf(" X ");fflush(stdout); + cnt--; + if (cnt == 0) + return ERR_NOANSWER; +#ifdef ESP32 + vTaskDelay(1); +#else + usleep(1000); +#endif + } + } +#ifdef DEBUG + printf("Received:%d\n", len+1); + fflush(stdout); +#endif + return len + 1; + } + + cnt--; +#ifdef ESP32 + vTaskDelay(1); +#else + usleep(1000); +#endif + } + return -1; +} + +int MU80X::iSendProt(uint8_t len, uint8_t adr, uint8_t cmd, + unsigned char *data) { + int res = 0; + uint16_t CRC = 0; + SendBuf[0] = len + 4; + SendBuf[1] = adr; + SendBuf[2] = cmd; + memcpy(&SendBuf[3], data, len); + CRC = _ui16CalculateCrc(SendBuf, len + 3); + SendBuf[3 + len] = CRC & 0xFF; + SendBuf[4 + len] = CRC >> 8; +#ifdef DEBUG + printf("Send:"); + DumpBuffer(SendBuf, len + 5); +#endif + res = serial_write(_devh, (unsigned char *)SendBuf, (int)len + 5); +#ifdef DEBUG + printf("Written:%d\n", res); +#endif + if (res == len + 5) { + res = iReadProt(1000); + if (res > 0) { + uint8_t LEN = RecvBuf[0]; + uint16_t RCRC = RecvBuf[LEN - 1] + (RecvBuf[LEN] << 8); + uint16_t CCRC = _ui16CalculateCrc(RecvBuf, LEN - 1); +#ifdef DEBUG + printf("CRC: %04X %04X\n", RCRC, CCRC); +#endif + if (RCRC == CCRC) { + ProtStatus = RecvBuf[2]; + return res; + } else + return ERR_CRC; + } else + return ERR_NOANSWER; + + } else + return ERR_WRITE; + return res; +} + +int MU80X::iSendProt(uint8_t len, uint8_t adr, uint8_t cmd, unsigned char *data, + int wait) { + int res = 0; + uint16_t CRC = 0; + SendBuf[0] = len + 4; + SendBuf[1] = adr; + SendBuf[2] = cmd; + memcpy(&SendBuf[3], data, len); + CRC = _ui16CalculateCrc(SendBuf, len + 3); + SendBuf[3 + len] = CRC & 0xFF; + SendBuf[4 + len] = CRC >> 8; +#ifdef DEBUG + printf("Send:"); + DumpBuffer(SendBuf, len + 5); +#endif + res = serial_write(_devh, (unsigned char*)SendBuf, (int)len + 5); +#ifdef DEBUG + printf("SendProt wrtn:%d ", res); +#endif + if (res == len + 5) { + res = iReadProt(wait); +#ifdef DEBUG + printf(" rcvd:%d\n",res);fflush(stderr); +#endif + if (res > 0) { + uint8_t LEN = RecvBuf[0]; + uint16_t RCRC = RecvBuf[LEN - 1] + (RecvBuf[LEN] << 8); + uint16_t CCRC = _ui16CalculateCrc(RecvBuf, LEN - 1); + if (RCRC == CCRC) { + ProtStatus = RecvBuf[2]; + return res; + } else + return ERR_CRC; + } else + return ERR_NOANSWER; + + } else + return ERR_WRITE; + return res; +} + +// protocol implementation +int MU80X::iBufferInventory(uint8_t Q, uint8_t antenna, uint8_t time) { + int res = 0; + unsigned char param[16]; + param[0] = Q; // QV + param[1] = 0xFF; // SS = TID:01 EPC:FF + param[2] = 0x00; // TG no clue + param[3] = 0x80 + antenna; + param[4] = time; + res = iSendProt(5, _devid, 0x18, param, 20000); + if (res > 0) { +#ifdef DEBUG + printf("INV:%d Stat:%d\n",res,ProtStatus);fflush(stdout); +#endif +// DumpBuffer(RecvBuf, res); + printf("-------------------------\n"); + fflush (stdout); + if (RecvBuf[0] == 9) { + TagsInBuffer = RecvBuf[5] + (RecvBuf[4] << 8); + TagsSeen = RecvBuf[7] + (RecvBuf[6] << 8); + } + } + return res; + +} + +int MU80X::iClearBuffer() { + int res; + res = iSendProt(0, _devid, 0x73, NULL); + return res; +} + +int MU80X::iGetBuffer(Tag_t *tagbuf) { + int res = 0; + int havedata = 1; + int tagcount = 0; + int todecode = 0; + int decoded = 0; + int readmore = 0; + res = iSendProt(0, _devid, 0x72, NULL); + if (res < 0) + return res; + while (havedata) { + todecode = RecvBuf[4]; + readmore = (RecvBuf[3] == 3); // == 3 ! + decoded = _DecodeBuffer(todecode, tagcount, &RecvBuf[5], tagbuf); +#ifdef DEBUG + DumpBuffer(RecvBuf,res); + printf("To decode:%d decoded:%d \n", todecode, decoded); + fflush(stdout); +#endif + if (decoded == todecode) { + tagcount += decoded; + if (readmore) { + res = iReadProt(100); + if (res < 0) + return tagcount; + todecode = RecvBuf[4]; + readmore = (RecvBuf[3] == 3); // == 3 ! + } else + havedata = 0; + } else { + // sometingwong + return ERR_DECODE; + } + } + return tagcount; +} + +int MU80X::iGetReaderInformation(uint8_t addr) { + int res; + res = iSendProt(0, addr, 0x21, NULL); + return res; +} + +int MU80X::iGetReaderInformation() { + int res; + res = iSendProt(0, _devid, 0x21, NULL); + return res; +} + +int MU80X::iGetReaderSerial() { + int res; + res = iSendProt(0, _devid, 0x4C, NULL); + return res; +} + +int MU80X::iSetBaud(uint8_t bd) { // 0=9600,1=19200,2=38400,5=57600,115200 + int res; + unsigned char param[2]; + param[0] = bd; + param[1] = 0; + res = iSendProt(1, _devid, 0x28, param); + return res; +} + +int MU80X::iSetPower(uint8_t dBm) { + int res; + unsigned char param[2]; + param[0] = dBm; + param[1] = 0; + res = iSendProt(1, _devid, 0x2F, param); + return res; +} + +int MU80X::iSetRFRegion() { + int res; + unsigned char param[2]; + param[0] = 0x4E; // 0x01 001110 maximum band = 1 + 865,1 + (14x200KHz=2,8 MHz) = 867,9 + param[1] = 0x00; // 0x00 000000 minimum band = 0 = 865,1 MHz + (0 x 200KHz) + param[2] = 0; + res = iSendProt(2, _devid, 0x22, param); + return res; +} + +int MU80X::iSetScantime(uint8_t time) { // x * 100ms + int res; + unsigned char param[2]; + param[0] = time; + param[1] = 0; + res = iSendProt(1, _devid, 0x25, param); + return res; +} + diff --git a/software/main/MU80X.h b/software/main/MU80X.h new file mode 100644 index 0000000..40b3751 --- /dev/null +++ b/software/main/MU80X.h @@ -0,0 +1,101 @@ +#ifndef MU80X_H_ +#define MU80X_H_ +#include "main.h" + +#define ESP32 + +#ifdef ESP32 +#include <sys/types.h> +#include <stdio.h> +#include <string.h> +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_event.h" +#include "esp_log.h" +#include "driver/uart.h" +#else +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <unistd.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <fcntl.h> +#include <termios.h> +#endif + +#define HashSize 16 +#define CRC_POLY_16 0x8005 +#define ProtBufLen 260 + +#define ERR_NOERR 0 +#define ERR_CRC -1 +#define ERR_WRITE -2 +#define ERR_NOANSWER -3 +#define ERR_DECODE -4 + +#define BAUD_9600 0 +#define BAUD_19200 1 +#define BAUD_38400 2 +#define BAUD_57600 5 +#define BAUD_115200 6 + +class MU80X { +public: +#ifdef ESP32 + MU80X(const int fh); +#else + MU80X(const char *dev = "/dev/ttyUSB0", const uint16_t baud = 57600); +#endif + ~MU80X(void); + + int ConnectionStatus; + int iBufferInventory(uint8_t Q, uint8_t antenna, uint8_t time); + int iClearBuffer(void); // done + void DumpBuffer(unsigned char *buf, int len); + int iGetBuffer(Tag_t *tagarr); + int iGetReaderInformation(); + int iGetReaderInformation(uint8_t addr); + int iGetReaderSerial(); // done + // int iGetGPI(void); +// int iGetRFIDSettings(); +// int iReset(void); + int iReadProt(int ms); + int iSendProt(uint8_t len, uint8_t adr, uint8_t cmd, unsigned char *data); // done + int iSendProt(uint8_t len, uint8_t adr, uint8_t cmd, unsigned char *data, int wait); // done +// int iSetAntennas(int antennas); // done each antenna is represented by its bit + int iSetBaud(uint8_t Bd); // BAUD_XXXXX definitions +// int iSetGPO(uint8_t GPO); // later + int iSetPower(uint8_t dBm); + int iSetRFRegion(); // fixed to ETSI + int iSetScantime(uint8_t time); + void PrintTag(Tag_t tag); + // int iSetRFIDSettings(int Q); +// int iStop(); + + unsigned char SendBuf[ProtBufLen]; + unsigned char RecvBuf[ProtBufLen]; + int ProtStatus; + int TagsInBuffer; + int TagsSeen; + +private: + // void vCreateTable(); + +// uint16_t crc_tab16_init = 0xFFFF; +// uint16_t crc_tab16[256]; + int serial_read(int fh,unsigned char *buf); + int serial_write(int fh, unsigned char * buf,int len); + uint16_t _ui16CalculateCrc(unsigned char *data, unsigned char len); + int _DecodeBuffer(int tagcount, int start, unsigned char *buf, Tag_t *tagbuf); + + int _devh; + uint8_t _devid; +// unsigned int _baud; +}; + +#endif /* MU80X_H_ */ diff --git a/software/main/PCF8575.cpp b/software/main/PCF8575.cpp new file mode 100644 index 0000000..3308c3b --- /dev/null +++ b/software/main/PCF8575.cpp @@ -0,0 +1,474 @@ +/*
+ * PCF8575 GPIO Port Expand
+ * https://www.mischianti.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Renzo Mischianti www.mischianti.org All right reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "PCF8575.h"
+#include "Wire.h"
+
+/**
+ * Constructor
+ * @param address: i2c address
+ */
+PCF8575::PCF8575(uint8_t address){
+ _wire = &Wire;
+
+ _address = address;
+};
+
+/**
+ * Construcor
+ * @param address: i2c address
+ * @param interruptPin: pin to set interrupt
+ * @param interruptFunction: function to call when interrupt raised
+ */
+PCF8575::PCF8575(uint8_t address, uint8_t interruptPin, void (*interruptFunction)() ){
+ _wire = &Wire;
+
+ _address = address;
+ _interruptPin = interruptPin;
+ _interruptFunction = interruptFunction;
+ _usingInterrupt = true;
+};
+
+#if !defined(__AVR) && !defined(__STM32F1__)
+ /**
+ * Constructor
+ * @param address: i2c address
+ * @param sda: sda pin
+ * @param scl: scl pin
+ */
+ PCF8575::PCF8575(uint8_t address, uint8_t sda, uint8_t scl){
+ _wire = &Wire;
+
+ _address = address;
+ _sda = sda;
+ _scl = scl;
+ };
+
+ /**
+ * Constructor
+ * @param address: i2c address
+ * @param sda: sda pin
+ * @param scl: scl pin
+ * @param interruptPin: pin to set interrupt
+ * @param interruptFunction: function to call when interrupt raised
+ */
+ PCF8575::PCF8575(uint8_t address, uint8_t sda, uint8_t scl, uint8_t interruptPin, void (*interruptFunction)() ){
+ _wire = &Wire;
+
+ _address = address;
+ _sda = sda;
+ _scl = scl;
+
+ _interruptPin = interruptPin;
+ _interruptFunction = interruptFunction;
+
+ _usingInterrupt = true;
+ };
+#endif
+
+#ifdef ESP32
+ /**
+ * Constructor
+ * @param address: i2c address
+ */
+ PCF8575::PCF8575(TwoWire *pWire, uint8_t address){
+ _wire = pWire;
+
+ _address = address;
+ };
+
+ /**
+ * Construcor
+ * @param address: i2c address
+ * @param interruptPin: pin to set interrupt
+ * @param interruptFunction: function to call when interrupt raised
+ */
+ PCF8575::PCF8575(TwoWire *pWire, uint8_t address, uint8_t interruptPin, void (*interruptFunction)() ){
+ _wire = pWire;
+
+ _address = address;
+ _interruptPin = interruptPin;
+ _interruptFunction = interruptFunction;
+ _usingInterrupt = true;
+ };
+
+ /**
+ * Constructor
+ * @param address: i2c address
+ * @param sda: sda pin
+ * @param scl: scl pin
+ */
+ PCF8575::PCF8575(TwoWire *pWire, uint8_t address, uint8_t sda, uint8_t scl){
+ _wire = pWire;
+
+ _address = address;
+ _sda = sda;
+ _scl = scl;
+ };
+
+ /**
+ * Constructor
+ * @param address: i2c address
+ * @param sda: sda pin
+ * @param scl: scl pin
+ * @param interruptPin: pin to set interrupt
+ * @param interruptFunction: function to call when interrupt raised
+ */
+ PCF8575::PCF8575(TwoWire *pWire, uint8_t address, uint8_t sda, uint8_t scl, uint8_t interruptPin, void (*interruptFunction)() ){
+ _wire = pWire;
+
+ _address = address;
+ _sda = sda;
+ _scl = scl;
+
+ _interruptPin = interruptPin;
+ _interruptFunction = interruptFunction;
+
+ _usingInterrupt = true;
+ };
+#endif
+
+/**
+ * wake up i2c controller
+ */
+void PCF8575::begin(){
+ #if !defined(__AVR) && !defined(__STM32F1__)
+ _wire->begin(_sda, _scl);
+ #else
+ // Default pin for AVR some problem on software emulation
+ // #define SCL_PIN _scl
+ // #define SDA_PIN _sda
+ _wire->begin();
+ #endif
+
+// Serial.println( writeMode, BIN);
+// Serial.println( readMode, BIN);
+
+ // Check if there are pins to set low
+ if (writeMode>0 || readMode>0){
+ DEBUG_PRINTLN("Set write mode");
+ _wire->beginTransmission(_address);
+ DEBUG_PRINT(" ");
+ DEBUG_PRINT("usedPin pin ");
+
+
+ uint16_t usedPin = writeMode | readMode;
+ DEBUG_PRINTLN( ~usedPin, BIN);
+// Serial.println( ~usedPin, BIN);
+
+ _wire->write((uint8_t) ~usedPin);
+ _wire->write((uint8_t) (~(usedPin >> 8)));
+
+ DEBUG_PRINTLN("Start end trasmission if stop here check pullup resistor.");
+ _wire->endTransmission();
+ }
+
+ // If using interrupt set interrupt value to pin
+ if (_usingInterrupt){
+ DEBUG_PRINTLN("Using interrupt pin (not all pin is interrupted)");
+ ::pinMode(_interruptPin, INPUT_PULLUP);
+ attachInterrupt(digitalPinToInterrupt(_interruptPin), (*_interruptFunction), FALLING );
+ }
+
+ // inizialize last read
+ lastReadMillis = millis();
+}
+
+/**
+ * Set if fin is OUTPUT or INPUT
+ * @param pin: pin to set
+ * @param mode: mode, supported only INPUT or OUTPUT (to semplify)
+ */
+void PCF8575::pinMode(uint8_t pin, uint8_t mode){
+ DEBUG_PRINT("Set pin ");
+ DEBUG_PRINT(pin);
+ DEBUG_PRINT(" as ");
+ DEBUG_PRINTLN(mode);
+
+ if (mode == OUTPUT){
+ writeMode = writeMode | bit(pin);
+ readMode = readMode & ~bit(pin);
+// DEBUG_PRINT("writeMode: ");
+// DEBUG_PRINT(writeMode, BIN);
+// DEBUG_PRINT("readMode: ");
+// DEBUG_PRINTLN(readMode, BIN);
+
+ }else if (mode == INPUT){
+ writeMode = writeMode & ~bit(pin);
+ readMode = readMode | bit(pin);
+// DEBUG_PRINT("writeMode: ");
+// DEBUG_PRINT(writeMode, BIN);
+// DEBUG_PRINT("readMode: ");
+// DEBUG_PRINTLN(readMode, BIN);
+ }
+ else{
+ DEBUG_PRINTLN("Mode non supported by PCF8575")
+ }
+ DEBUG_PRINT("Write mode: ");
+ DEBUG_PRINTLN(writeMode, BIN);
+
+};
+
+/**
+ * Read value from i2c and bufferize it
+ * @param force
+ */
+void PCF8575::readBuffer(bool force){
+ if (millis() > PCF8575::lastReadMillis+READ_ELAPSED_TIME || _usingInterrupt || force){
+ _wire->requestFrom(_address,(uint8_t)2);// Begin transmission to PCF8575 with the buttons
+ lastReadMillis = millis();
+ if(_wire->available()) // If uint16_ts are available to be recieved
+ {
+ uint16_t iInput = _wire->read();// Read a uint16_t
+ iInput |= _wire->read() << 8;// Read a uint16_t
+ if ((iInput & readMode)>0){
+ byteBuffered = byteBuffered | (uint16_t)iInput;
+ }
+ }
+ }
+}
+
+#ifndef PCF8575_LOW_MEMORY
+ /**
+ * Read value of all INPUT pin
+ * Debounce read more fast than 10millis, non managed for interrupt mode
+ * @return
+ */
+ PCF8575::DigitalInput PCF8575::digitalReadAll(void){
+ DEBUG_PRINTLN("Read from buffer");
+ _wire->requestFrom(_address,(uint8_t)2);// Begin transmission to PCF8575 with the buttons
+ lastReadMillis = millis();
+ if(_wire->available()) // If uint16_ts are available to be recieved
+ {
+ DEBUG_PRINTLN("Data ready");
+ uint16_t iInput = _wire->read();// Read a uint16_t
+ iInput |= _wire->read() << 8;// Read a uint16_t
+
+ if ((iInput & readMode)>0){
+ DEBUG_PRINT("Input ");
+ DEBUG_PRINTLN((uint16_t)iInput, BIN);
+
+ byteBuffered = byteBuffered | (uint16_t)iInput;
+ DEBUG_PRINT("byteBuffered ");
+ DEBUG_PRINTLN(byteBuffered, BIN);
+ }
+ }
+
+ DEBUG_PRINT("Buffer value ");
+ DEBUG_PRINTLN(byteBuffered, BIN);
+#ifdef NOT_SEQUENTIAL_PINOUT
+ if ((bit(0) & readMode)>0) digitalInput.p00 = ((byteBuffered & bit(0))>0)?HIGH:LOW;
+ if ((bit(1) & readMode)>0) digitalInput.p01 = ((byteBuffered & bit(1))>0)?HIGH:LOW;
+ if ((bit(2) & readMode)>0) digitalInput.p02 = ((byteBuffered & bit(2))>0)?HIGH:LOW;
+ if ((bit(3) & readMode)>0) digitalInput.p03 = ((byteBuffered & bit(3))>0)?HIGH:LOW;
+ if ((bit(4) & readMode)>0) digitalInput.p04 = ((byteBuffered & bit(4))>0)?HIGH:LOW;
+ if ((bit(5) & readMode)>0) digitalInput.p05 = ((byteBuffered & bit(5))>0)?HIGH:LOW;
+ if ((bit(6) & readMode)>0) digitalInput.p06 = ((byteBuffered & bit(6))>0)?HIGH:LOW;
+ if ((bit(7) & readMode)>0) digitalInput.p07 = ((byteBuffered & bit(7))>0)?HIGH:LOW;
+ if ((bit(8) & readMode)>0) digitalInput.p10 = ((byteBuffered & bit(8))>0)?HIGH:LOW;
+ if ((bit(9) & readMode)>0) digitalInput.p11 = ((byteBuffered & bit(9))>0)?HIGH:LOW;
+ if ((bit(10) & readMode)>0) digitalInput.p12 = ((byteBuffered & bit(10))>0)?HIGH:LOW;
+ if ((bit(11) & readMode)>0) digitalInput.p13 = ((byteBuffered & bit(11))>0)?HIGH:LOW;
+ if ((bit(12) & readMode)>0) digitalInput.p14 = ((byteBuffered & bit(12))>0)?HIGH:LOW;
+ if ((bit(13) & readMode)>0) digitalInput.p15 = ((byteBuffered & bit(13))>0)?HIGH:LOW;
+ if ((bit(14) & readMode)>0) digitalInput.p16 = ((byteBuffered & bit(14))>0)?HIGH:LOW;
+ if ((bit(15) & readMode)>0) digitalInput.p17 = ((byteBuffered & bit(15))>0)?HIGH:LOW;
+#else
+ if ((bit(0) & readMode)>0) digitalInput.p0 = ((byteBuffered & bit(0))>0)?HIGH:LOW;
+ if ((bit(1) & readMode)>0) digitalInput.p1 = ((byteBuffered & bit(1))>0)?HIGH:LOW;
+ if ((bit(2) & readMode)>0) digitalInput.p2 = ((byteBuffered & bit(2))>0)?HIGH:LOW;
+ if ((bit(3) & readMode)>0) digitalInput.p3 = ((byteBuffered & bit(3))>0)?HIGH:LOW;
+ if ((bit(4) & readMode)>0) digitalInput.p4 = ((byteBuffered & bit(4))>0)?HIGH:LOW;
+ if ((bit(5) & readMode)>0) digitalInput.p5 = ((byteBuffered & bit(5))>0)?HIGH:LOW;
+ if ((bit(6) & readMode)>0) digitalInput.p6 = ((byteBuffered & bit(6))>0)?HIGH:LOW;
+ if ((bit(7) & readMode)>0) digitalInput.p7 = ((byteBuffered & bit(7))>0)?HIGH:LOW;
+ if ((bit(8) & readMode)>0) digitalInput.p8 = ((byteBuffered & bit(8))>0)?HIGH:LOW;
+ if ((bit(9) & readMode)>0) digitalInput.p9 = ((byteBuffered & bit(9))>0)?HIGH:LOW;
+ if ((bit(10) & readMode)>0) digitalInput.p10 = ((byteBuffered & bit(10))>0)?HIGH:LOW;
+ if ((bit(11) & readMode)>0) digitalInput.p11 = ((byteBuffered & bit(11))>0)?HIGH:LOW;
+ if ((bit(12) & readMode)>0) digitalInput.p12 = ((byteBuffered & bit(12))>0)?HIGH:LOW;
+ if ((bit(13) & readMode)>0) digitalInput.p13 = ((byteBuffered & bit(13))>0)?HIGH:LOW;
+ if ((bit(14) & readMode)>0) digitalInput.p14 = ((byteBuffered & bit(14))>0)?HIGH:LOW;
+ if ((bit(15) & readMode)>0) digitalInput.p15 = ((byteBuffered & bit(15))>0)?HIGH:LOW;
+#endif
+ if ((readMode & byteBuffered)>0){
+ byteBuffered = ~readMode & byteBuffered;
+ DEBUG_PRINT("Buffer hight value readed set readed ");
+ DEBUG_PRINTLN(byteBuffered, BIN);
+ }
+ DEBUG_PRINT("Return value ");
+ return digitalInput;
+ };
+#else
+ /**
+ * Read value of all INPUT pin in byte format for low memory usage
+ * Debounce read more fast than 10millis, non managed for interrupt mode
+ * @return
+ */
+ uint16_t PCF8575::digitalReadAll(void){
+ DEBUG_PRINTLN("Read from buffer");
+ _wire->requestFrom(_address,(uint8_t)2);// Begin transmission to PCF8575 with the buttons
+ lastReadMillis = millis();
+ if(_wire->available()) // If uint16_ts are available to be recieved
+ {
+ DEBUG_PRINTLN("Data ready");
+ uint16_t iInput = _wire->read();// Read a uint16_t
+ iInput |= _wire->read() << 8;// Read a uint16_t
+
+ if ((iInput & readMode)>0){
+ DEBUG_PRINT("Input ");
+ DEBUG_PRINTLN((uint16_t)iInput, BIN);
+
+ byteBuffered = byteBuffered | (uint16_t)iInput;
+ DEBUG_PRINT("byteBuffered ");
+ DEBUG_PRINTLN(byteBuffered, BIN);
+ }
+ }
+
+ DEBUG_PRINT("Buffer value ");
+ DEBUG_PRINTLN(byteBuffered, BIN);
+
+ uint16_t byteRead = byteBuffered;
+
+ if ((readMode & byteBuffered)>0){
+ byteBuffered = ~readMode & byteBuffered;
+ DEBUG_PRINT("Buffer hight value readed set readed ");
+ DEBUG_PRINTLN(byteBuffered, BIN);
+ }
+ DEBUG_PRINT("Return value ");
+ return byteRead;
+ };
+#endif
+
+/**
+ * Read value of specified pin
+ * Debounce read more fast than 10millis, non managed for interrupt mode
+ * @param pin
+ * @return
+ */
+uint8_t PCF8575::digitalRead(uint8_t pin){
+ uint8_t value = LOW;
+ if ((bit(pin) & writeMode)>0){
+ DEBUG_PRINTLN("Pin in write mode, return value");
+ DEBUG_PRINT("Write data ");
+ DEBUG_PRINT(writeByteBuffered, BIN);
+ DEBUG_PRINT(" for pin ");
+ DEBUG_PRINT(pin);
+ DEBUG_PRINT(" bin value ");
+ DEBUG_PRINT(bit(pin), BIN);
+ DEBUG_PRINT(" value ");
+ DEBUG_PRINTLN(value);
+
+ if ((bit(pin) & writeByteBuffered)>0){
+ value = HIGH;
+ }else{
+ value = LOW;
+ }
+ return value;
+ }
+
+ DEBUG_PRINT("Read pin ");
+ DEBUG_PRINTLN(pin);
+ // Check if pin already HIGH than read and prevent reread of i2c
+ if ((bit(pin) & byteBuffered)>0){
+ DEBUG_PRINTLN("Pin already up");
+ value = HIGH;
+ }else if ((/*(bit(pin) & byteBuffered)<=0 && */millis() > PCF8575::lastReadMillis+READ_ELAPSED_TIME) /*|| _usingInterrupt*/){
+ DEBUG_PRINTLN("Read from buffer");
+ _wire->requestFrom(_address,(uint8_t)2);// Begin transmission to PCF8575 with the buttons
+ lastReadMillis = millis();
+ if(_wire->available()) // If bytes are available to be recieved
+ {
+ DEBUG_PRINTLN("Data ready");
+ uint16_t iInput = _wire->read();// Read a uint16_t
+ iInput |= _wire->read() << 8;// Read a uint16_t
+
+// Serial.println(iInput, BIN);
+
+ if ((iInput & readMode)>0){
+ DEBUG_PRINT("Input ");
+ DEBUG_PRINTLN((uint16_t)iInput, BIN);
+
+ byteBuffered = byteBuffered | (uint16_t)iInput;
+ DEBUG_PRINT("byteBuffered ");
+ DEBUG_PRINTLN(byteBuffered, BIN);
+
+ if ((bit(pin) & byteBuffered)>0){
+ value = HIGH;
+ }
+ }
+ }
+ }
+ DEBUG_PRINT("Buffer value ");
+ DEBUG_PRINTLN(byteBuffered, BIN);
+ // If HIGH set to low to read buffer only one time
+ if (value==HIGH){
+ byteBuffered = ~bit(pin) & byteBuffered;
+ DEBUG_PRINT("Buffer hight value readed set readed ");
+ DEBUG_PRINTLN(byteBuffered, BIN);
+ }
+ DEBUG_PRINT("Return value ");
+ DEBUG_PRINTLN(value);
+ return value;
+};
+
+/**
+ * Write on pin
+ * @param pin
+ * @param value
+ */
+void PCF8575::digitalWrite(uint8_t pin, uint8_t value){
+ DEBUG_PRINTLN("Begin trasmission");
+ _wire->beginTransmission(_address); //Begin the transmission to PCF8575
+ if (value==HIGH){
+ writeByteBuffered = writeByteBuffered | bit(pin);
+ }else{
+ writeByteBuffered = writeByteBuffered & ~bit(pin);
+ }
+// DEBUG_PRINT("Write data ");
+// DEBUG_PRINT(writeByteBuffered, BIN);
+// DEBUG_PRINT(" for pin ");
+// DEBUG_PRINT(pin);
+// DEBUG_PRINT(" bin value ");
+// DEBUG_PRINT(bit(pin), BIN);
+// DEBUG_PRINT(" value ");
+// DEBUG_PRINTLN(value);
+
+// Serial.print(" --> ");
+// Serial.println(writeByteBuffered);
+// Serial.println((uint8_t) writeByteBuffered);
+// Serial.println((uint8_t) (writeByteBuffered >> 8));
+
+ writeByteBuffered = writeByteBuffered & writeMode;
+ _wire->write((uint8_t) writeByteBuffered);
+ _wire->write((uint8_t) (writeByteBuffered >> 8));
+ DEBUG_PRINTLN("Start end trasmission if stop here check pullup resistor.");
+
+ _wire->endTransmission();
+};
+
+
diff --git a/software/main/PCF8575.h b/software/main/PCF8575.h new file mode 100644 index 0000000..660b2c6 --- /dev/null +++ b/software/main/PCF8575.h @@ -0,0 +1,208 @@ +/*
+ * PCF8575 GPIO Port Expand
+ * https://www.mischianti.org/2019/07/22/pcf8575-i2c-16-bit-digital-i-o-expander/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 Renzo Mischianti www.mischianti.org All right reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef PCF8575_h
+#define PCF8575_h
+
+#include "Wire.h"
+
+#if ARDUINO >= 100
+#include "Arduino.h"
+#else
+#include "WProgram.h"
+#endif
+
+// Uncomment to enable printing out nice debug messages.
+// #define PCF8575_DEBUG
+
+// Uncomment for low memory usage this prevent use of complex DigitalInput structure and free 7byte of memory
+// #define PCF8575_LOW_MEMORY
+
+// Define where debug output will be printed.
+#define DEBUG_PRINTER Serial
+
+// Define to manage original pinout of pcf8575
+// like datasheet but not sequential
+//#define NOT_SEQUENTIAL_PINOUT
+
+// Setup debug printing macros.
+#ifdef PCF8575_DEBUG
+ #define DEBUG_PRINT(...) { DEBUG_PRINTER.print(__VA_ARGS__); }
+ #define DEBUG_PRINTLN(...) { DEBUG_PRINTER.println(__VA_ARGS__); }
+#else
+ #define DEBUG_PRINT(...) {}
+ #define DEBUG_PRINTLN(...) {}
+#endif
+
+#define READ_ELAPSED_TIME 10
+
+//#define P0 B00000001
+//#define P1 B00000010
+//#define P2 B00000100
+//#define P3 B00001000
+//#define P4 B00010000
+//#define P5 B00100000
+//#define P6 B01000000
+//#define P7 B10000000
+//
+#ifdef NOT_SEQUENTIAL_PINOUT
+ #define P00 0
+ #define P01 1
+ #define P02 2
+ #define P03 3
+ #define P04 4
+ #define P05 5
+ #define P06 6
+ #define P07 7
+ #define P10 8
+ #define P11 9
+ #define P12 10
+ #define P13 11
+ #define P14 12
+ #define P15 13
+ #define P16 14
+ #define P17 15
+#else
+ #define P0 0
+ #define P1 1
+ #define P2 2
+ #define P3 3
+ #define P4 4
+ #define P5 5
+ #define P6 6
+ #define P7 7
+ #define P8 8
+ #define P9 9
+ #define P10 10
+ #define P11 11
+ #define P12 12
+ #define P13 13
+ #define P14 14
+ #define P15 15
+#endif
+
+#include <math.h>
+
+
+class PCF8575 {
+public:
+
+ PCF8575(uint8_t address);
+ PCF8575(uint8_t address, uint8_t interruptPin, void (*interruptFunction)() );
+
+#if !defined(__AVR) && !defined(__STM32F1__)
+ PCF8575(uint8_t address, uint8_t sda, uint8_t scl);
+ PCF8575(uint8_t address, uint8_t sda, uint8_t scl, uint8_t interruptPin, void (*interruptFunction)());
+#endif
+
+#ifdef ESP32
+ ///// changes for second i2c bus
+ PCF8575(TwoWire *pWire, uint8_t address);
+ PCF8575(TwoWire *pWire, uint8_t address, uint8_t sda, uint8_t scl);
+
+ PCF8575(TwoWire *pWire, uint8_t address, uint8_t interruptPin, void (*interruptFunction)() );
+ PCF8575(TwoWire *pWire, uint8_t address, uint8_t sda, uint8_t scl, uint8_t interruptPin, void (*interruptFunction)());
+#endif
+
+ void begin();
+ void pinMode(uint8_t pin, uint8_t mode);
+
+ void readBuffer(bool force = true);
+ uint8_t digitalRead(uint8_t pin);
+ #ifndef PCF8575_LOW_MEMORY
+ struct DigitalInput {
+#ifdef NOT_SEQUENTIAL_PINOUT
+ uint8_t p00;
+ uint8_t p01;
+ uint8_t p02;
+ uint8_t p03;
+ uint8_t p04;
+ uint8_t p05;
+ uint8_t p06;
+ uint8_t p07;
+ uint8_t p10;
+ uint8_t p11;
+ uint8_t p12;
+ uint8_t p13;
+ uint8_t p14;
+ uint8_t p15;
+ uint8_t p16;
+ uint8_t p17;
+#else
+ uint8_t p0;
+ uint8_t p1;
+ uint8_t p2;
+ uint8_t p3;
+ uint8_t p4;
+ uint8_t p5;
+ uint8_t p6;
+ uint8_t p7;
+ uint8_t p8;
+ uint8_t p9;
+ uint8_t p10;
+ uint8_t p11;
+ uint8_t p12;
+ uint8_t p13;
+ uint8_t p14;
+ uint8_t p15;
+#endif
+ } digitalInput;
+
+
+ DigitalInput digitalReadAll(void);
+ #else
+ uint16_t digitalReadAll(void);
+ #endif
+ void digitalWrite(uint8_t pin, uint8_t value);
+
+private:
+ uint8_t _address;
+
+ #if defined(__AVR) || defined(__STM32F1__)
+ uint8_t _sda;
+ uint8_t _scl;
+ #else
+ uint8_t _sda = SDA;
+ uint8_t _scl = SCL;
+ #endif
+
+ TwoWire *_wire;
+
+ bool _usingInterrupt = false;
+ uint8_t _interruptPin = 2;
+ void (*_interruptFunction)(){};
+
+ uint16_t writeMode = 0;
+ uint16_t readMode = 0;
+ uint16_t byteBuffered = 0;
+ unsigned long lastReadMillis = 0;
+
+ uint16_t writeByteBuffered = 0;
+
+};
+
+#endif
diff --git a/software/main/SimplePgSQL.cpp b/software/main/SimplePgSQL.cpp new file mode 100644 index 0000000..0e76e0a --- /dev/null +++ b/software/main/SimplePgSQL.cpp @@ -0,0 +1,900 @@ +/*
+ SimplePgSQL.c - Lightweight PostgreSQL connector for Arduino
+ Copyright (C) Bohdan R. Rau 2016 <ethanak@polip.com>
+
+ SimplePgSQL is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ SimplePgSQL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with SimplePgSQL. If not, write to:
+ The Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor
+ Boston, MA 02110-1301, USA.
+ */
+#include <stdio.h>
+//#include "esp_eth.h"
+#include <string.h>
+#include <sys/param.h>
+#include "freertos/FreeRTOS.h"
+#include "freertos/task.h"
+#include "freertos/event_groups.h"
+#include "esp_system.h"
+#include "esp_wifi.h"
+#include "esp_event.h"
+#include "esp_log.h"
+#include "nvs_flash.h"
+#include "esp_netif.h"
+#include "lwip/err.h"
+#include "lwip/sockets.h"
+
+
+#include "SimplePgSQL.h"
+
+#define AUTH_REQ_OK 0 /* User is authenticated */
+#define AUTH_REQ_PASSWORD 3 /* Password */
+#define PGTAG "PGSQL"
+static const char EM_OOM[] = "Out of mem";
+static const char EM_READ[] = "Backend read err";
+static const char EM_WRITE[] = "Backend write err";
+static const char EM_CONN[] = "Cannot conn 2 srv";
+static const char EM_SYNC[] = "Backend out of sync";
+static const char EM_INTR[] = "Internal err";
+static const char EM_UAUTH[] = "auth method !sptd";
+static const char EM_BIN[] = "Bin fmt !sptd";
+static const char EM_EXEC[] = "Previ exe !finished";
+static const char EM_PASSWD[] = "Pwd req";
+static const char EM_EMPTY[] = "empty qry";
+static const char EM_FORMAT[] = "Illegal chr fmt";
+
+PGconnection::PGconnection(const int flags, const unsigned char *Buffer, const int bufSize) {
+ conn_status = CONNECTION_NEEDED;
+ _passwd = NULL;
+ _user = NULL;
+ _buffer = (char *) Buffer;
+ _bufSize = bufSize;
+ bufPos = 0;
+ result_status=0;
+ _available=0;
+ _nfields=0;
+ _ntuples=0;
+ _flags=0;
+}
+
+int PGconnection::PGsetDbLogin(const char *ServerIP, int ServerPort, const char *dbName, const char *dbUser, const char *dbPasswd, const char *dbCharset) {
+
+ char *startpacket;
+ int packetlen;
+ int len;
+
+// close();
+ memset(&DestAddr, 0, sizeof(DestAddr));
+ AddrFamily = AF_INET;
+ ipProtocol = IPPROTO_IP;
+ DestAddr.sin_addr.s_addr = inet_addr(ServerIP);
+ DestAddr.sin_family = AF_INET;
+ DestAddr.sin_port = htons(ServerPort);
+
+ if (!dbName)
+ dbName = dbUser;
+ len = strlen(dbUser) + 1;
+ if (dbPasswd) {
+ len += strlen(dbPasswd) + 1;
+ }
+ _user = (char *) malloc(len);
+ strcpy(_user, dbUser);
+ if (dbPasswd) {
+ _passwd = _user + strlen(dbUser) + 1;
+ strcpy(_passwd, dbPasswd);
+ } else {
+ _passwd = NULL;
+ }
+
+ //int8_t connected = connect(client->connect(server, port);
+ SockH = socket(AddrFamily, SOCK_STREAM, ipProtocol);
+ if (SockH < 0) {
+ ESP_LOGE(PGTAG, "Unable to create socket: errno %d", errno);
+ setMsg_P(EM_CONN, PG_RSTAT_HAVE_ERROR);
+ return conn_status = CONNECTION_BAD;
+ } else {
+ int err = connect(SockH, (struct sockaddr *) &DestAddr, sizeof(DestAddr));
+ if (err != 0) {
+ ESP_LOGE(PGTAG, "Socket unable to connect: errno %d", errno);
+ return conn_status = CONNECTION_BAD;
+ }
+ NetConnected = 1;
+ ESP_LOGI(PGTAG, "Successfully connected");
+ }
+
+ packetlen = build_startup_packet(NULL, dbName, dbCharset);
+ if (packetlen > _bufSize - 10) {
+ setMsg_P(EM_OOM, PG_RSTAT_HAVE_ERROR);
+ conn_status = CONNECTION_BAD;
+ return conn_status;
+ }
+
+ startpacket = _buffer + (_bufSize - (packetlen + 1));
+ build_startup_packet(startpacket, dbName, dbCharset);
+ if (pqPacketSend(0, startpacket, packetlen) < 0) {
+ setMsg_P(EM_WRITE, PG_RSTAT_HAVE_ERROR);
+ return conn_status = CONNECTION_BAD;
+ }
+ attempts = 0;
+ return conn_status = CONNECTION_AWAITING_RESPONSE;
+}
+
+void PGconnection::PGclose(void) {
+ if (NetConnected) {
+ pqPacketSend('X', NULL, 0);
+// client->stop();
+ shutdown(SockH, 0);
+ close(SockH);
+ }
+ if (_user) {
+ free(_user);
+ _user = _passwd = NULL;
+ }
+ NetConnected = 0;
+ conn_status = CONNECTION_NEEDED;
+}
+
+int PGconnection::PGstatus(void) {
+ char bereq;
+ char rc;
+ int32_t msgLen;
+ int32_t areq;
+ char * pwd = _passwd;
+
+ switch (conn_status) {
+ case CONNECTION_NEEDED:
+ case CONNECTION_OK:
+ case CONNECTION_BAD:
+
+ return conn_status;
+
+ case CONNECTION_AWAITING_RESPONSE:
+ if (dataAvailable() == 0) return conn_status;
+ if (attempts++ >= 2) {
+ setMsg_P(EM_SYNC, PG_RSTAT_HAVE_ERROR);
+ return conn_status = CONNECTION_BAD;
+ }
+ if (pqGetc(&bereq)) {
+ goto read_error;
+ }
+ if (bereq == 'E') {
+ pqGetInt4(&msgLen);
+ pqGetNotice(PG_RSTAT_HAVE_ERROR);
+ return conn_status = CONNECTION_BAD;
+ }
+ if (bereq != 'R') {
+ setMsg_P(EM_SYNC, PG_RSTAT_HAVE_ERROR);
+ return conn_status = CONNECTION_BAD;
+ }
+ if (pqGetInt4(&msgLen)) {
+ goto read_error;
+ }
+ if (pqGetInt4(&areq)) {
+ goto read_error;
+ }
+ if (areq == AUTH_REQ_OK) {
+ if (_user) {
+ free(_user);
+ _user = _passwd = NULL;
+ }
+ result_status = PG_RSTAT_READY;
+ return conn_status = CONNECTION_AUTH_OK;
+ }
+ if (areq != AUTH_REQ_PASSWORD) {
+ setMsg_P(EM_UAUTH, PG_RSTAT_HAVE_ERROR);
+ return conn_status = CONNECTION_BAD;
+ }
+ if (!_passwd || !*_passwd) {
+ setMsg_P(EM_PASSWD, PG_RSTAT_HAVE_ERROR);
+ return conn_status = CONNECTION_BAD;
+ }
+ pwd = _passwd;
+ rc = pqPacketSend('p', pwd, strlen(pwd) + 1);
+ if (rc) {
+ goto write_error;
+ }
+ return conn_status;
+
+ case CONNECTION_AUTH_OK:
+ for (;;) {
+ if (dataAvailable() == 0) return conn_status;
+ if (pqGetc(&bereq))
+ goto read_error;
+ if (pqGetInt4(&msgLen))
+ goto read_error;
+ msgLen -= 4;
+ if (bereq == 'A' || bereq == 'N' || bereq == 'S' || bereq == 'K') {
+ if (pqSkipnchar(msgLen))
+ goto read_error;
+ continue;
+ }
+ if (bereq == 'E') {
+ pqGetNotice(PG_RSTAT_HAVE_ERROR);
+ return conn_status = CONNECTION_BAD;
+ }
+
+ /* if (bereq == 'K') {
+ if (pqGetInt4(&be_pid)) goto read_error;
+ if (pqGetInt4(&be_key)) goto read_error;
+ continue;
+ }
+ */
+ if (bereq == 'Z') {
+ pqSkipnchar(msgLen);
+ return conn_status = CONNECTION_OK;
+ }
+ return conn_status = CONNECTION_BAD;
+ }
+ break;
+ default:
+ setMsg_P(EM_INTR, PG_RSTAT_HAVE_ERROR);
+ return conn_status = CONNECTION_BAD;
+ }
+ read_error: setMsg_P(EM_READ, PG_RSTAT_HAVE_ERROR);
+ return conn_status = CONNECTION_BAD;
+ write_error: setMsg_P(EM_WRITE, PG_RSTAT_HAVE_ERROR);
+ return conn_status = CONNECTION_BAD;
+}
+
+int PGconnection::PGexecute(const char *query) {
+ /*
+ if (!(result_status & PG_RSTAT_READY)) {
+ setMsg_P(EM_EXEC, PG_RSTAT_HAVE_ERROR);
+ return -1;
+ }
+ */
+ int len = strlen(query);
+ if (pqPacketSend('Q', query, len + 1)) {
+ setMsg_P(EM_WRITE, PG_RSTAT_HAVE_ERROR);
+ conn_status = CONNECTION_BAD;
+ return -1;
+ }
+ result_status = PG_RSTAT_COMMAND_SENT;
+ return 0;
+}
+
+int PGconnection::PGescapeName(const char *inbuf, char *outbuf) {
+ const char *c;
+ int l = 2;
+ for (c = inbuf; *c; c++) {
+ l++;
+ if (*c == '\\' || *c == '"')
+ l++;
+ }
+ if (outbuf) {
+ *outbuf++ = '"';
+ for (c = inbuf; *c; c++) {
+ *outbuf++ = *c;
+ if (*c == '\\' || *c == '"')
+ *outbuf++ = *c;
+ }
+ *outbuf++ = '"';
+ }
+ return l;
+}
+
+int PGconnection::PGescapeString(const char *inbuf, char *outbuf) {
+ const char *c;
+ int e = 0, l;
+ for (c = inbuf; *c; c++) {
+ if (*c == '\\' || *c == '\'')
+ e++;
+ }
+ l = e + (c - inbuf) + (e ? 4 : 2);
+ if (outbuf) {
+ if (e) {
+ *outbuf++ = ' ';
+ *outbuf++ = 'E';
+ }
+ *outbuf++ = '\'';
+ for (c = inbuf; *c; c++) {
+ *outbuf++ = *c;
+ if (*c == '\\' || *c == '\'')
+ *outbuf++ = *c;
+ }
+ *outbuf++ = '\'';
+ }
+ return l;
+}
+
+char * PGconnection::PGgetValue(int nr) {
+ int i;
+ if (_null & (1 << nr)) return NULL;
+ char *c = _buffer;
+ if (nr < 0 || nr >= _nfields) return NULL;
+ for (i = 0; i < nr; i++) {
+ if (_null & (1 << i)) continue;
+ c += strlen(c) + 1;
+ }
+ return c;
+}
+
+char *PGconnection::PGgetColumn(int n) {
+ char *c;
+ int i;
+ if (!(result_status & PG_RSTAT_HAVE_COLUMNS)) return NULL;
+ if (n < 0 || n >= _nfields) return NULL;
+ for (c = _buffer, i = 0; i < n; i++) {
+ c += strlen(c) + 1;
+ }
+ return c;
+}
+
+char *PGconnection::PGgetMessage(void) {
+ if (!(result_status & PG_RSTAT_HAVE_MESSAGE))
+ return NULL;
+ return _buffer;
+}
+
+void dumpbuffer(char *b,int l) {
+ int i;
+ unsigned int v;
+ for (i=0;i<l;i++) {
+ if (i%8 == 0) {
+ printf("\n%04X ",i);
+ }
+ v=*b;
+ printf("%02X ",v);
+ if (v>31) printf(" %c ",v);
+ else printf(" ");
+ b++;
+ }
+ printf("\n");
+}
+
+int PGconnection::PGgetData(void) {
+ char id;
+ int32_t msgLen;
+ int rc;
+ char *c;
+ int r=0;
+ r=dataAvailable();
+// printf("getData:avail:%d\n",r);fflush(stdout);
+ if (r==0) return 0;
+
+ if (pqGetc(&id)) goto read_error;
+ if (pqGetInt4(&msgLen)) goto read_error;
+// printf("MSG ID: %c Len:%d (avail:%d)\n",id,msgLen,r);fflush(stdout);
+ msgLen -= 4;
+ switch (id) {
+ case 'T':
+ if ((rc = pqGetRowDescriptions())) {
+ if (rc == -2)
+ setMsg_P(EM_OOM, PG_RSTAT_HAVE_ERROR);
+ else if (rc == -3)
+ setMsg_P(EM_BIN, PG_RSTAT_HAVE_ERROR);
+ goto read_error;
+ }
+ if (_flags & PG_FLAG_IGNORE_COLUMNS) {
+ result_status &= ~PG_RSTAT_HAVE_MASK;
+ return 0;
+ }
+ return result_status = (result_status & ~PG_RSTAT_HAVE_MASK) | PG_RSTAT_HAVE_COLUMNS;
+
+ case 'E':
+ if (pqGetNotice(PG_RSTAT_HAVE_ERROR))
+ goto read_error;
+ return result_status;
+
+ case 'N':
+ if (_flags & PG_FLAG_IGNORE_NOTICES) {
+ if (pqSkipnchar(msgLen))
+ goto read_error;
+ return 0;
+ }
+ if (pqGetNotice(PG_RSTAT_HAVE_NOTICE))
+ goto read_error;
+ return result_status = (result_status & ~PG_RSTAT_HAVE_MASK) | PG_RSTAT_HAVE_NOTICE;
+
+ case 'A':
+ if (_flags & PG_FLAG_IGNORE_NOTICES) {
+ if (pqSkipnchar(msgLen))
+ goto read_error;
+ return 0;
+ }
+ if (pqGetNotify(msgLen))
+ goto read_error;
+ return result_status = (result_status & ~PG_RSTAT_HAVE_MASK) | PG_RSTAT_HAVE_NOTICE;
+
+ case 'Z':
+ if (pqSkipnchar(msgLen))
+ goto read_error;
+ result_status = (result_status & PG_RSTAT_HAVE_SUMMARY) | PG_RSTAT_READY;
+ return PG_RSTAT_READY;
+
+ case 'S':
+ case 'K':
+ if (pqSkipnchar(msgLen))
+ goto read_error;
+ return 0;
+
+ case 'C':
+ if (msgLen > _bufSize - 1)
+ goto oom;
+ if (pqGetnchar(_buffer, msgLen))
+ goto read_error;
+ _buffer[msgLen] = 0;
+ _ntuples = 0;
+ result_status = (result_status & ~PG_RSTAT_HAVE_MASK) | PG_RSTAT_HAVE_SUMMARY;
+ for (c = _buffer; *c && !isdigit(*c); c++)
+ ;
+ if (!*c)
+ return result_status;
+ if (strncmp(_buffer, "SELECT ", 7)) {
+ for (; *c && isdigit(*c); c++)
+ ;
+ for (; *c && !isdigit(*c); c++)
+ ;
+ }
+ if (*c)
+ _ntuples = strtol(c, NULL, 10);
+ return result_status;
+
+ case 'D':
+ if ((rc = pqGetRow())) {
+ if (rc == -2)
+ setMsg_P(EM_OOM, PG_RSTAT_HAVE_ERROR);
+ else if (rc == -3)
+ setMsg_P(EM_SYNC, PG_RSTAT_HAVE_ERROR);
+ goto read_error;
+ }
+ if (_flags & PG_FLAG_IGNORE_COLUMNS) {
+ result_status &= ~PG_RSTAT_HAVE_MASK;
+ return 0;
+ }
+
+ return result_status = (result_status & ~PG_RSTAT_HAVE_MASK) | PG_RSTAT_HAVE_ROW;
+
+ case 'I':
+ if (pqSkipnchar(msgLen))
+ goto read_error;
+ setMsg_P(EM_EMPTY, PG_RSTAT_HAVE_ERROR);
+ return result_status;
+
+ default:
+ setMsg_P(EM_SYNC, PG_RSTAT_HAVE_ERROR);
+ conn_status = CONNECTION_BAD;
+ return -1;
+ }
+
+ oom: setMsg_P(EM_OOM, PG_RSTAT_HAVE_ERROR);
+
+ read_error: if (!(result_status & PG_RSTAT_HAVE_ERROR)) {
+ printf("READERROR!\n");fflush(stdout);
+ setMsg_P(EM_READ, PG_RSTAT_HAVE_ERROR);
+ }
+ conn_status = CONNECTION_BAD;
+ return -1;
+}
+
+int PGconnection::PGexecuteFormat(const char *format, ...) {
+ int32_t msgLen;
+ va_list va;
+ va_start(va, format);
+ msgLen = writeFormattedQuery(0, format, va);
+ va_end(va);
+ if (msgLen < 0)
+ return -1;
+ va_start(va, format);
+ msgLen = writeFormattedQuery(msgLen, format, va);
+ va_end(va);
+ if (msgLen) {
+ return -1;
+ }
+ result_status = PG_RSTAT_COMMAND_SENT;
+ return 0;
+}
+
+int PGconnection::build_startup_packet(char *packet, const char *dbName, const char *dbCharset) {
+ int packet_len = 4;
+ if (packet) {
+ memcpy(packet, "\0\003\0\0", 4);
+ }
+#define ADD_STARTUP_OPTION(optname, optval) \
+ do { \
+ if (packet) \
+ strcpy(packet + packet_len, (char *)optname); \
+ packet_len += strlen((char *)optname) + 1; \
+ if (packet) \
+ strcpy(packet + packet_len, (char *)optval); \
+ packet_len += strlen((char *)optval) + 1; \
+ } while(0)
+
+#define ADD_STARTUP_OPTION_P(optname, optval) \
+ do { \
+ if (packet) \
+ strcpy(packet + packet_len, (char *)optname); \
+ packet_len += strlen((char *)optname) + 1; \
+ if (packet) \
+ strcpy(packet + packet_len, (char *)optval); \
+ packet_len += strlen((char *)optval) + 1; \
+ } while(0)
+
+ if (_user && _user[0])
+ ADD_STARTUP_OPTION("user", _user);
+ if (dbName && dbName[0])
+ ADD_STARTUP_OPTION("database", dbName);
+ if (dbCharset && dbCharset[0])
+ ADD_STARTUP_OPTION("client_encoding", dbCharset);
+ ADD_STARTUP_OPTION_P("application_name", "Scaladis");
+#undef ADD_STARTUP_OPTION
+ if (packet)
+ packet[packet_len] = '\0';
+ packet_len++;
+
+ return packet_len;
+}
+
+int PGconnection::pqPacketSend(char pack_type, const char *buf, int buf_len) {
+ char *start = _buffer;
+ int l = _bufSize - 4;
+// int n;
+ if (pack_type) {
+ *start++ = pack_type;
+ l--;
+ }
+ *start++ = ((buf_len + 4) >> 24) & 0xff;
+ *start++ = ((buf_len + 4) >> 16) & 0xff;
+ *start++ = ((buf_len + 4) >> 8) & 0xff;
+ *start++ = (buf_len + 4) & 0xff;
+
+ if (buf) {
+ if (buf_len <= l) {
+ memcpy(start, buf, buf_len);
+ start += buf_len;
+ buf_len = 0;
+ } else {
+ memcpy(start, buf, l);
+ start += l;
+ buf_len -= l;
+ buf += l;
+ }
+ }
+ int err = send(SockH, _buffer, start - _buffer, 0);
+ if (err < 0) {
+ ESP_LOGE(PGTAG, "Send Error occurred during sending: errno %d", errno);
+ return err;
+ }
+ if (buf && buf_len) {
+ err = send(SockH, (const char *) buf, (size_t) buf_len, 0);
+ if (err < 0) {
+ ESP_LOGE(PGTAG, "Send2 Error occurred during sending: errno %d", errno);
+ return err;
+
+ }
+ }
+
+ return 0;
+}
+
+int PGconnection::pqGetc(char *buf) {
+ int i=0;
+// for (i = 0; !client->available() && i < 10; i++) {
+ while (i<10) {
+ if (dataAvailable()>0) break;
+ else {
+ vTaskDelay(i++);
+ }
+ }
+ if (i==10) return -1;
+
+ int len = read(SockH, (void *) buf, 1);
+ _available-=len;
+ return -1+len;
+}
+
+int PGconnection::pqGetInt4(int32_t *result) {
+ uint32_t tmp4 = 0;
+ uint8_t tmp, i;
+ int rt=0;
+ for (i = 0; i < 4; i++) {
+ rt=pqGetc((char *) &tmp);
+ if (rt) return -1;
+ tmp4 = (tmp4 << 8) | tmp;
+ }
+ *result = tmp4;
+ return 0;
+}
+
+int PGconnection::pqGetInt2(int16_t *result) {
+ uint16_t tmp2 = 0;
+ uint8_t tmp, i;
+ for (i = 0; i < 2; i++) {
+ if (pqGetc((char *) &tmp)) return -1;
+ tmp2 = (tmp2 << 8) | tmp;
+ }
+ *result = tmp2;
+ return 0;
+}
+
+int PGconnection::pqGetnchar(char *s, int len) {
+ while (len-- > 0) {
+ if (pqGetc(s++)) return -1;
+ }
+ return 0;
+}
+
+int PGconnection::pqGets(char *s, int maxlen) {
+ int len;
+ char z;
+ for (len = 0; len < maxlen; len++) {
+ if (pqGetc(&z)) return -1;
+ if (s) *s++ = z;
+ if (!z) return len + 1;
+ }
+ return -(len + 1);
+}
+
+int PGconnection::pqSkipnchar(int len) {
+ char dummy;
+ int i;
+ for (i=0;i<len;i++) read(SockH,&dummy,1);
+ /*
+ while (len-- > 0) {
+ if (pqGetc(&dummy))
+ return -1;
+ }
+ */
+ return 0;
+}
+
+int PGconnection::pqGetRow(void) {
+ int i;
+ int bufpos = 0;
+ int32_t len;
+ int16_t cols;
+
+ _null = 0;
+ if (pqGetInt2(&cols)) return -1;
+ if (cols != _nfields) return -3;
+
+ for (i = 0; i < _nfields; i++) {
+ if (pqGetInt4(&len)) return -1;
+ if (len < 0) {
+ _null |= 1 << i;
+ continue;
+ }
+ if (bufpos + len + 1 > _bufSize) {
+ return -2;
+ }
+ if (pqGetnchar(_buffer + bufpos, len))
+ return -1;
+ bufpos += len;
+ _buffer[bufpos++] = 0;
+ }
+ return 0;
+}
+
+int PGconnection::pqGetRowDescriptions(void) {
+ int i;
+ int16_t format;
+ int rc;
+ int bufpos;
+ if (pqGetInt2(&_nfields))
+ return -1;
+ if (_nfields > PG_MAX_FIELDS)
+ return -2; // implementation limit
+ _formats = 0;
+ bufpos = 0;
+
+ for (i = 0; i < _nfields; i++) {
+ if (!(_flags & PG_FLAG_IGNORE_COLUMNS)) {
+ if (bufpos >= _bufSize - 1)
+ return -2;
+ rc = pqGets(_buffer + bufpos, _bufSize - bufpos);
+ if (rc < 0)
+ return -1;
+ bufpos += rc;
+ } else {
+ if (pqGets(NULL, 8192) < 0) {
+ return -1;
+ }
+ }
+ if (pqSkipnchar(16))
+ return -1;
+ if (pqGetInt2(&format))
+ return -1;
+ format = format ? 1 : 0;
+ _formats |= format << i;
+ }
+ if (_formats)
+ return -3;
+ return 0;
+}
+
+void PGconnection::setMsg(const char *s, int type) {
+ strcpy(_buffer, s);
+ result_status = (result_status & ~PG_RSTAT_HAVE_MASK) | type;
+}
+
+void PGconnection::setMsg_P(const char *s, int type) {
+ strcpy(_buffer, s);
+ result_status = (result_status & ~PG_RSTAT_HAVE_MASK) | type;
+}
+
+int PGconnection::pqGetNotice(int type) {
+ int bufpos = 0;
+ char id;
+ int rc;
+ for (;;) {
+ if (pqGetc(&id)) goto read_error;
+ if (!id)
+ break;
+ if (id == 'S' || id == 'M') {
+ if (bufpos && bufpos < _bufSize - 1)
+ _buffer[bufpos++] = ':';
+ rc = pqGets(_buffer + bufpos, _bufSize - bufpos);
+ if (rc < 0)
+ goto read_error;
+ bufpos += rc - 1;
+ } else {
+ rc = pqGets(NULL, 8192);
+ if (rc < 0) goto read_error;
+ }
+ }
+ _buffer[bufpos] = 0;
+ result_status = (result_status & ~PG_RSTAT_HAVE_MASK) | type;
+ return 0;
+
+ read_error: if (!bufpos)
+ setMsg_P(EM_READ, PG_RSTAT_HAVE_ERROR);
+ return -1;
+}
+
+int PGconnection::pqGetNotify(int32_t msgLen) {
+ int32_t pid;
+ int bufpos, i;
+ if (pqGetInt4(&pid))
+ return -1;
+ msgLen -= 4;
+ bufpos = sprintf(_buffer, "%d:", pid);
+ if (msgLen > _bufSize - (bufpos + 1)) {
+ if (pqGetnchar(_buffer + bufpos, _bufSize - (bufpos + 1)))
+ return -1;
+ msgLen -= _bufSize - (bufpos + 1);
+ if (pqSkipnchar(msgLen))
+ return -1;
+ _buffer[msgLen = _bufSize - 1] = 0;
+
+ } else {
+ if (pqGetnchar(_buffer + bufpos, msgLen))
+ return -1;
+ _buffer[bufpos + msgLen] = 0;
+ msgLen += bufpos;
+ }
+ for (i = 0; i < msgLen; i++)
+ if (!_buffer[i])
+ _buffer[i] = ':';
+ return 0;
+}
+
+int PGconnection::dataAvailable() {
+ int res=0;
+// if (_available) return _available;
+ ioctl(SockH,FIONREAD,&res);
+ return res;
+}
+
+int PGconnection::writeMsgPart(const char *s, int len, int fine) {
+ while (len > 0) {
+ int n = len;
+ if (n > _bufSize - bufPos)
+ n = _bufSize - bufPos;
+ memcpy(_buffer + bufPos, s, n);
+ bufPos += n;
+ s += n;
+ len -= n;
+ if (bufPos >= _bufSize) {
+// if (client->write((uint8_t *) Buffer, bufPos) != (size_t) bufPos) return -1;
+ int err = send(SockH, _buffer, bufPos, 0);
+ if (err < 0)
+ return -1;
+ bufPos = 0;
+ }
+ }
+ if (bufPos && fine) {
+// if (client->write((uint8_t *) Buffer, bufPos) != (size_t) bufPos) return -1;
+ int err = send(SockH, _buffer, bufPos, 0);
+ if (err < 0)
+ return -1;
+
+ bufPos = 0;
+ }
+
+ return 0;
+}
+
+int32_t PGconnection::writeFormattedQuery(int32_t length, const char *format, va_list va) {
+ int32_t msgLen = 0;
+ const char *percent;
+ int blen, rc;
+#define LBUFLEN 32
+ char buf[LBUFLEN], znak;
+ if (length) {
+ length += 4;
+ bufPos = 0;
+ _buffer[bufPos++] = 'Q';
+ _buffer[bufPos++] = (length >> 24) & 0xff;
+ _buffer[bufPos++] = (length >> 16) & 0xff;
+ _buffer[bufPos++] = (length >> 8) & 0xff;
+ _buffer[bufPos++] = (length) & 0xff;
+ }
+ for (;;) {
+ percent = strchr(format, '%');
+ if (!percent)
+ break;
+ znak = percent[1];
+ if (!length) {
+ msgLen += (percent - format);
+ } else {
+ rc = writeMsgPart(format, percent - format, false);
+ if (rc)
+ goto write_error;
+ }
+ format = percent + 2;
+ if (znak == 's' || znak == 'n') {
+ char *str = va_arg(va, char *);
+ blen = (znak == 's') ? PGescapeString(str, NULL) : PGescapeName(str, NULL);
+ if (!length) {
+ msgLen += blen;
+ } else {
+ if (bufPos + blen > _bufSize) {
+ rc = writeMsgPart(NULL, 0, true);
+ if (rc)
+ goto write_error;
+ }
+ }
+ if (znak == 's') {
+ PGescapeString(str, _buffer + bufPos);
+ } else {
+ PGescapeName(str, _buffer + bufPos);
+ }
+ bufPos += blen;
+ continue;
+ }
+ if (znak == 'l' || znak == 'd') {
+ if (znak == 'l') {
+ long n = va_arg(va, long);
+ blen = snprintf(buf, LBUFLEN, "'%ld'", n);
+ } else {
+ int n = va_arg(va, int);
+ blen = snprintf(buf, LBUFLEN, "'%d'", n);
+ }
+ if (length) {
+ rc = writeMsgPart(buf, blen, false);
+ if (rc)
+ goto write_error;
+ } else {
+ msgLen += blen;
+ }
+ }
+ setMsg_P(EM_FORMAT, PG_RSTAT_HAVE_ERROR);
+ return -1;
+ }
+ blen = strlen(format);
+ if (length) {
+ rc = writeMsgPart(format, blen, false);
+ if (!rc) {
+ rc = writeMsgPart("\0", 1, true);
+ }
+ if (rc)
+ goto write_error;
+ } else {
+ msgLen += blen + 1;
+ }
+ return msgLen;
+
+ write_error: setMsg_P(EM_WRITE, PG_RSTAT_HAVE_ERROR);
+ conn_status = CONNECTION_BAD;
+ return -1;
+}
diff --git a/software/main/SimplePgSQL.h b/software/main/SimplePgSQL.h new file mode 100644 index 0000000..9637ee5 --- /dev/null +++ b/software/main/SimplePgSQL.h @@ -0,0 +1,209 @@ +/*
+ * SimplePgSQL.h - Lightweight PostgreSQL connector for Arduino
+ * Copyright (C) Bohdan R. Rau 2016 <ethanak@polip.com>
+ *
+ * SimplePgSQL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * SimplePgSQL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with SimplePgSQL. If not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "esp_system.h"
+#include "esp_netif.h"
+#include "lwip/err.h"
+#include "lwip/sockets.h"
+
+#ifndef _SIMPLEPGSQL
+#define _SIMPLEPGSQL 1
+
+typedef enum {
+ CONNECTION_OK, CONNECTION_BAD, CONNECTION_NEEDED, /* setDbLogin() needed */
+ /* Internal states here */
+ CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the postmaster. */
+ CONNECTION_AUTH_OK /* Received authentication; waiting for backend startup. */
+} ConnStatusType;
+
+#define PG_BUFFER_SIZE 4096
+
+// maximum number of fields in backend response
+// must not exceed number of bits in _formats and _null
+#define PG_MAX_FIELDS 32
+
+// ignore notices and notifications
+#define PG_FLAG_IGNORE_NOTICES 1
+// do not store column names
+#define PG_FLAG_IGNORE_COLUMNS 2
+
+// ready for next query
+#define PG_RSTAT_READY 1 // command sent
+#define PG_RSTAT_COMMAND_SENT 2 // column names in buffer
+#define PG_RSTAT_HAVE_COLUMNS 4 // row values in buffer
+#define PG_RSTAT_HAVE_ROW 8 // summary (number of tuples/affected rows) received
+#define PG_RSTAT_HAVE_SUMMARY 16 // error message in buffer
+#define PG_RSTAT_HAVE_ERROR 32 // notice/notification in buffer
+#define PG_RSTAT_HAVE_NOTICE 64
+
+#define PG_RSTAT_HAVE_MASK (PG_RSTAT_HAVE_COLUMNS | \
+ PG_RSTAT_HAVE_ROW | \
+ PG_RSTAT_HAVE_SUMMARY | \
+ PG_RSTAT_HAVE_ERROR | \
+ PG_RSTAT_HAVE_NOTICE)
+
+#define PG_RSTAT_HAVE_MESSAGE (PG_RSTAT_HAVE_ERROR | PG_RSTAT_HAVE_NOTICE)
+
+class PGconnection {
+public:
+
+ PGconnection(const int flags, const unsigned char *Buffer, const int bufSize);
+ /*
+ * returns connection status.
+ * passwd may be null in case of 'trust' authorization.
+ * only 'trust', 'password' and 'md5' (if compiled in)
+ * authorization modes are implemented.
+ * ssl mode is not implemented.
+ * database name defaults to user name *
+ */
+ int PGsetDbLogin(const char *ServerIP, int ServerPort, const char *dbName, const char *dbUser, const char *dbPasswd, const char *charset);
+ /*
+ * performs authorization tasks if needed
+ * returns current connection status
+ * must be called periodically until OK, BAD or NEEDED
+ */
+ int PGstatus(void);
+ /*
+ * sends termination command if possible
+ * closes client connection and frees internal buffer
+ */
+ void PGclose(void);
+ /*
+ * sends query to backend
+ * returns negative value on error
+ * or zero on success
+ */
+ int PGexecute(const char *query);
+
+ /* should be called periodically in idle state
+ * if notifications are enabled
+ * returns:
+ * - negative value on error
+ * - zero if no interesting data arrived
+ * - current data status if some data arrived
+ */
+ int PGgetData(void);
+ /*
+ * returns pointer to n-th column name in internal buffer
+ * if available or null if column number out of range
+ * will be invalidated on next getData call
+ */
+ char *PGgetColumn(int n);
+ /*
+ * returns pointer to n-th column value in internal buffer
+ * if available or null if column number out of range
+ * or value is NULL
+ * will be invalidated on next getData call
+ */
+ char *PGgetValue(int);
+ /*
+ * returns pointer to message (error or notice)
+ * if available or NULL
+ * will be invalidated on next getData call
+ */
+ char *PGgetMessage(void);
+ int PGdataStatus(void) {
+ return result_status;
+ }
+ ;
+ int PGnfields(void) {
+ return _nfields;
+ }
+ ;
+ int PGntuples(void) {
+ return _ntuples;
+ }
+ ;
+ /*
+ * returns length of escaped string
+ * single quotes and E prefix (if needed)
+ * will be added.
+ */
+ int PGescapeString(const char *inbuf, char *outbuf);
+ /*
+ * returns length of escaped string
+ * double quotes will be added.
+ */
+ int PGescapeName(const char *inbuf, char *outbuf);
+ /*
+ * sends formatted query to backend
+ * returns negative value on error
+ * or zero on success
+ * Formatting sequences:
+ * %s - string literal (will be escaped with escapeString)
+ * %n - name (will be escaped with escapeName)
+ * %d - int (single quotes will be added)
+ * %l - long int (single quotes will be added)
+ * %% - % character
+ */
+ int PGexecuteFormat(const char *format, ...);
+
+private:
+ int pqPacketSend(char pack_type, const char *buf, int buf_len);
+ int pqGetc(char *);
+ int pqGetInt4(int32_t *result);
+ int pqGetInt2(int16_t *result);
+ int pqGetnchar(char *s, int len);
+ int pqSkipnchar(int len);
+ int pqGets(char *s, int maxlen);
+ int pqGetRowDescriptions(void);
+ int pqGetRow(void);
+ void setMsg(const char *, int);
+ void setMsg_P(const char *, int);
+ int pqGetNotice(int);
+ int pqGetNotify(int32_t);
+ char *_user;
+ char *_passwd;
+// char *Buffer;
+ char *_buffer;
+// int bufSize;
+ int _bufSize;
+ int bufPos;
+ int writeMsgPart(const char *s, int len, int fine);
+ int32_t writeFormattedQuery(int32_t length, const char *format, va_list va);
+ int dataAvailable(void);
+ int build_startup_packet(char *packet, const char *db, const char *charset);
+ uint8_t conn_status;
+ uint8_t attempts;
+ /*
+ int32_t be_pid;
+ int32_t be_key;
+ */
+ int16_t _nfields;
+ int16_t _ntuples;
+ uint32_t _formats;
+ uint32_t _null;
+ uint8_t _binary;
+ uint8_t _flags;
+ uint32_t _available;
+ int result_status;
+ // network stuff
+ struct sockaddr_in DestAddr;
+ int SockH = -1;
+ int ipProtocol = 0;
+ int AddrFamily = 0;
+ int NetConnected=0;
+
+};
+
+#endif
diff --git a/software/main/build/CMakeFiles/3.16.3/CMakeCCompiler.cmake b/software/main/build/CMakeFiles/3.16.3/CMakeCCompiler.cmake new file mode 100644 index 0000000..2692f73 --- /dev/null +++ b/software/main/build/CMakeFiles/3.16.3/CMakeCCompiler.cmake @@ -0,0 +1,76 @@ +set(CMAKE_C_COMPILER "/usr/bin/cc") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "9.3.0") +set(CMAKE_C_COMPILER_VERSION_INTERNAL "") +set(CMAKE_C_COMPILER_WRAPPER "") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11") +set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert") +set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") + +set(CMAKE_C_PLATFORM_ID "Linux") +set(CMAKE_C_SIMULATE_ID "") +set(CMAKE_C_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_C_SIMULATE_VERSION "") + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-9") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-9") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) +set(CMAKE_COMPILER_IS_MINGW ) +set(CMAKE_COMPILER_IS_CYGWIN ) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "ELF") +set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/software/main/build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake b/software/main/build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake new file mode 100644 index 0000000..504c250 --- /dev/null +++ b/software/main/build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake @@ -0,0 +1,88 @@ +set(CMAKE_CXX_COMPILER "/usr/bin/c++") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "9.3.0") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "14") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") + +set(CMAKE_CXX_PLATFORM_ID "Linux") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_CXX_SIMULATE_VERSION "") + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-9") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-9") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) +set(CMAKE_COMPILER_IS_MINGW ) +set(CMAKE_COMPILER_IS_CYGWIN ) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/9;/usr/include/x86_64-linux-gnu/c++/9;/usr/include/c++/9/backward;/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/software/main/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin b/software/main/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin Binary files differnew file mode 100644 index 0000000..b6f7a32 --- /dev/null +++ b/software/main/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin diff --git a/software/main/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_CXX.bin b/software/main/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_CXX.bin Binary files differnew file mode 100644 index 0000000..d8ed013 --- /dev/null +++ b/software/main/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_CXX.bin diff --git a/software/main/build/CMakeFiles/3.16.3/CMakeSystem.cmake b/software/main/build/CMakeFiles/3.16.3/CMakeSystem.cmake new file mode 100644 index 0000000..442aabb --- /dev/null +++ b/software/main/build/CMakeFiles/3.16.3/CMakeSystem.cmake @@ -0,0 +1,15 @@ +set(CMAKE_HOST_SYSTEM "Linux-5.11.0-43-generic") +set(CMAKE_HOST_SYSTEM_NAME "Linux") +set(CMAKE_HOST_SYSTEM_VERSION "5.11.0-43-generic") +set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") + + + +set(CMAKE_SYSTEM "Linux-5.11.0-43-generic") +set(CMAKE_SYSTEM_NAME "Linux") +set(CMAKE_SYSTEM_VERSION "5.11.0-43-generic") +set(CMAKE_SYSTEM_PROCESSOR "x86_64") + +set(CMAKE_CROSSCOMPILING "FALSE") + +set(CMAKE_SYSTEM_LOADED 1) diff --git a/software/main/build/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c b/software/main/build/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c new file mode 100644 index 0000000..d884b50 --- /dev/null +++ b/software/main/build/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c @@ -0,0 +1,671 @@ +#ifdef __cplusplus +# error "A C++ compiler has been selected for C." +#endif + +#if defined(__18CXX) +# define ID_VOID_MAIN +#endif +#if defined(__CLASSIC_C__) +/* cv-qualifiers did not exist in K&R C */ +# define const +# define volatile +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 +# define COMPILER_ID "XL" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version) +# define COMPILER_ID "Fujitsu" + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__BCC__) +# define COMPILER_ID "Bruce" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) +# define COMPILER_ID "SDCC" +# if defined(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) +# else + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXE) || defined(__CRAYXC) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number components. */ +#ifdef COMPILER_VERSION_MAJOR +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + + +#if !defined(__STDC__) +# if (defined(_MSC_VER) && !defined(__clang__)) \ + || (defined(__ibmxl__) || defined(__IBMC__)) +# define C_DIALECT "90" +# else +# define C_DIALECT +# endif +#elif __STDC_VERSION__ >= 201000L +# define C_DIALECT "11" +#elif __STDC_VERSION__ >= 199901L +# define C_DIALECT "99" +#else +# define C_DIALECT "90" +#endif +const char* info_language_dialect_default = + "INFO" ":" "dialect_default[" C_DIALECT "]"; + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +# if defined(__CLASSIC_C__) +int main(argc, argv) int argc; char *argv[]; +# else +int main(int argc, char* argv[]) +# endif +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXE) || defined(__CRAYXC) + require += info_cray[argc]; +#endif + require += info_language_dialect_default[argc]; + (void)argv; + return require; +} +#endif diff --git a/software/main/build/CMakeFiles/3.16.3/CompilerIdC/a.out b/software/main/build/CMakeFiles/3.16.3/CompilerIdC/a.out Binary files differnew file mode 100644 index 0000000..46f1233 --- /dev/null +++ b/software/main/build/CMakeFiles/3.16.3/CompilerIdC/a.out diff --git a/software/main/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp b/software/main/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 0000000..69cfdba --- /dev/null +++ b/software/main/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,660 @@ +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__COMO__) +# define COMPILER_ID "Comeau" + /* __COMO_VERSION__ = VRR */ +# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) +# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) + +#elif defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 +# define COMPILER_ID "XL" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version) +# define COMPILER_ID "Fujitsu" + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) || defined(__GNUG__) +# define COMPILER_ID "GNU" +# if defined(__GNUC__) +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# else +# define COMPILER_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXE) || defined(__CRAYXC) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number components. */ +#ifdef COMPILER_VERSION_MAJOR +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + + +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L +# if defined(__INTEL_CXX11_MODE__) +# if defined(__cpp_aggregate_nsdmi) +# define CXX_STD 201402L +# else +# define CXX_STD 201103L +# endif +# else +# define CXX_STD 199711L +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) +# define CXX_STD _MSVC_LANG +#else +# define CXX_STD __cplusplus +#endif + +const char* info_language_dialect_default = "INFO" ":" "dialect_default[" +#if CXX_STD > 201703L + "20" +#elif CXX_STD >= 201703L + "17" +#elif CXX_STD >= 201402L + "14" +#elif CXX_STD >= 201103L + "11" +#else + "98" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXE) || defined(__CRAYXC) + require += info_cray[argc]; +#endif + require += info_language_dialect_default[argc]; + (void)argv; + return require; +} diff --git a/software/main/build/CMakeFiles/3.16.3/CompilerIdCXX/a.out b/software/main/build/CMakeFiles/3.16.3/CompilerIdCXX/a.out Binary files differnew file mode 100644 index 0000000..c868426 --- /dev/null +++ b/software/main/build/CMakeFiles/3.16.3/CompilerIdCXX/a.out diff --git a/software/main/build/CMakeFiles/CMakeOutput.log b/software/main/build/CMakeFiles/CMakeOutput.log new file mode 100644 index 0000000..fba2dae --- /dev/null +++ b/software/main/build/CMakeFiles/CMakeOutput.log @@ -0,0 +1,429 @@ +The system is: Linux - 5.11.0-43-generic - x86_64 +Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. +Compiler: /usr/bin/cc +Build flags: +Id flags: + +The output was: +0 + + +Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" + +The C compiler identification is GNU, found in "/home/steffen/scaladis/schrank_ant_pcb/main/build/CMakeFiles/3.16.3/CompilerIdC/a.out" + +Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. +Compiler: /usr/bin/c++ +Build flags: +Id flags: + +The output was: +0 + + +Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" + +The CXX compiler identification is GNU, found in "/home/steffen/scaladis/schrank_ant_pcb/main/build/CMakeFiles/3.16.3/CompilerIdCXX/a.out" + +Determining if the C compiler works passed with the following output: +Change Dir: /home/steffen/scaladis/schrank_ant_pcb/main/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/ninja cmTC_2eb2e && [1/2] Building C object CMakeFiles/cmTC_2eb2e.dir/testCCompiler.c.o +[2/2] Linking C executable cmTC_2eb2e + + + +Detecting C compiler ABI info compiled with the following output: +Change Dir: /home/steffen/scaladis/schrank_ant_pcb/main/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/ninja cmTC_4ec92 && [1/2] Building C object CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +OFFLOAD_TARGET_NAMES=nvptx-none:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/9/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccL2lXYU.s +GNU C17 (Ubuntu 9.3.0-17ubuntu1~20.04) version 9.3.0 (x86_64-linux-gnu) + compiled by GNU C version 9.3.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/lib/gcc/x86_64-linux-gnu/9/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +GNU C17 (Ubuntu 9.3.0-17ubuntu1~20.04) version 9.3.0 (x86_64-linux-gnu) + compiled by GNU C version 9.3.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: bbf13931d8de1abe14040c9909cb6969 +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' + as -v --64 -o CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o /tmp/ccL2lXYU.s +GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34 +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' +[2/2] Linking C executable cmTC_4ec92 +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_4ec92' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/cczqceAf.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_4ec92 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_4ec92' '-mtune=generic' '-march=x86-64' + + + +Parsed C implicit include dir info from above output: rv=done + found start of include info + found start of implicit include info + add: [/usr/lib/gcc/x86_64-linux-gnu/9/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/9/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/9/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + +Parsed C implicit link information from above output: + link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] + ignore line: [Change Dir: /home/steffen/scaladis/schrank_ant_pcb/main/build/CMakeFiles/CMakeTmp] + ignore line: [] + ignore line: [Run Build Command(s):/usr/bin/ninja cmTC_4ec92 && [1/2] Building C object CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/9/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccL2lXYU.s] + ignore line: [GNU C17 (Ubuntu 9.3.0-17ubuntu1~20.04) version 9.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.3.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/9/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [GNU C17 (Ubuntu 9.3.0-17ubuntu1~20.04) version 9.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.3.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [Compiler executable checksum: bbf13931d8de1abe14040c9909cb6969] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o /tmp/ccL2lXYU.s] + ignore line: [GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'] + ignore line: [[2/2] Linking C executable cmTC_4ec92] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) ] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_4ec92' '-mtune=generic' '-march=x86-64'] + link line: [ /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/cczqceAf.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_4ec92 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/9/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/cczqceAf.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-export-dynamic] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_4ec92] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o] ==> ignore + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../..] + arg [CMakeFiles/cmTC_4ec92.dir/CMakeCCompilerABI.c.o] ==> ignore + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [-lc] ==> lib [c] + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o] ==> ignore + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9] ==> [/usr/lib/gcc/x86_64-linux-gnu/9] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../..] ==> [/usr/lib] + implicit libs: [gcc;gcc_s;c;gcc;gcc_s] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + +Determining if the CXX compiler works passed with the following output: +Change Dir: /home/steffen/scaladis/schrank_ant_pcb/main/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/ninja cmTC_a89a3 && [1/2] Building CXX object CMakeFiles/cmTC_a89a3.dir/testCXXCompiler.cxx.o +[2/2] Linking CXX executable cmTC_a89a3 + + + +Detecting CXX compiler ABI info compiled with the following output: +Change Dir: /home/steffen/scaladis/schrank_ant_pcb/main/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/ninja cmTC_5523e && [1/2] Building CXX object CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +OFFLOAD_TARGET_NAMES=nvptx-none:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/9/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccPwHizr.s +GNU C++14 (Ubuntu 9.3.0-17ubuntu1~20.04) version 9.3.0 (x86_64-linux-gnu) + compiled by GNU C version 9.3.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/9" +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/include/c++/9 + /usr/include/x86_64-linux-gnu/c++/9 + /usr/include/c++/9/backward + /usr/lib/gcc/x86_64-linux-gnu/9/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +GNU C++14 (Ubuntu 9.3.0-17ubuntu1~20.04) version 9.3.0 (x86_64-linux-gnu) + compiled by GNU C version 9.3.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: 466f818abe2f30ba03783f22bd12d815 +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + as -v --64 -o CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccPwHizr.s +GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34 +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' +[2/2] Linking CXX executable cmTC_5523e +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_5523e' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/cc6pbjaI.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_5523e /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_5523e' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + + + +Parsed CXX implicit include dir info from above output: rv=done + found start of include info + found start of implicit include info + add: [/usr/include/c++/9] + add: [/usr/include/x86_64-linux-gnu/c++/9] + add: [/usr/include/c++/9/backward] + add: [/usr/lib/gcc/x86_64-linux-gnu/9/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/include/c++/9] ==> [/usr/include/c++/9] + collapse include dir [/usr/include/x86_64-linux-gnu/c++/9] ==> [/usr/include/x86_64-linux-gnu/c++/9] + collapse include dir [/usr/include/c++/9/backward] ==> [/usr/include/c++/9/backward] + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/9/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/9/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/include/c++/9;/usr/include/x86_64-linux-gnu/c++/9;/usr/include/c++/9/backward;/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + +Parsed CXX implicit link information from above output: + link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] + ignore line: [Change Dir: /home/steffen/scaladis/schrank_ant_pcb/main/build/CMakeFiles/CMakeTmp] + ignore line: [] + ignore line: [Run Build Command(s):/usr/bin/ninja cmTC_5523e && [1/2] Building CXX object CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/9/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccPwHizr.s] + ignore line: [GNU C++14 (Ubuntu 9.3.0-17ubuntu1~20.04) version 9.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.3.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/9"] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/include/c++/9] + ignore line: [ /usr/include/x86_64-linux-gnu/c++/9] + ignore line: [ /usr/include/c++/9/backward] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/9/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [GNU C++14 (Ubuntu 9.3.0-17ubuntu1~20.04) version 9.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.3.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [Compiler executable checksum: 466f818abe2f30ba03783f22bd12d815] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccPwHizr.s] + ignore line: [GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + ignore line: [[2/2] Linking CXX executable cmTC_5523e] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) ] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_5523e' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + link line: [ /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/cc6pbjaI.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_5523e /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/9/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/cc6pbjaI.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-export-dynamic] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_5523e] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o] ==> ignore + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../..] + arg [CMakeFiles/cmTC_5523e.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore + arg [-lstdc++] ==> lib [stdc++] + arg [-lm] ==> lib [m] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [-lc] ==> lib [c] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [/usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o] ==> ignore + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9] ==> [/usr/lib/gcc/x86_64-linux-gnu/9] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../..] ==> [/usr/lib] + implicit libs: [stdc++;m;gcc_s;gcc;c;gcc_s;gcc] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + diff --git a/software/main/build/CMakeFiles/cmake.check_cache b/software/main/build/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000..3dccd73 --- /dev/null +++ b/software/main/build/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/software/main/component.mk b/software/main/component.mk new file mode 100644 index 0000000..a98f634 --- /dev/null +++ b/software/main/component.mk @@ -0,0 +1,4 @@ +# +# "main" pseudo-component makefile. +# +# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) diff --git a/software/main/config.cpp b/software/main/config.cpp new file mode 100644 index 0000000..6421bf8 --- /dev/null +++ b/software/main/config.cpp @@ -0,0 +1,265 @@ +/* + * config.cpp + * + * Created on: 26.02.2022 + * Author: steffen + */ + +#include "config.h" + +int ReadConfig() { + ESP_LOGI(TAG, "Initializing SPIFFS"); + esp_vfs_spiffs_conf_t conf = { .base_path = "/spiffs", .partition_label = NULL, .max_files = 5, .format_if_mount_failed = false }; + + // Use settings defined above to initialize and mount SPIFFS filesystem. + // Note: esp_vfs_spiffs_register is an all-in-one convenience function. + esp_err_t ret = esp_vfs_spiffs_register(&conf); + if (ret != ESP_OK) { + if (ret == ESP_FAIL) { + ESP_LOGE(TAG, "Failed to mount or format filesystem"); + } else if (ret == ESP_ERR_NOT_FOUND) { + ESP_LOGE(TAG, "Failed to find SPIFFS partition"); + } else { + ESP_LOGE(TAG, "Failed to initialize SPIFFS (%s)", esp_err_to_name(ret)); + } + return -1; + } + + size_t total = 0, used = 0; + ret = esp_spiffs_info(conf.partition_label, &total, &used); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to get SPIFFS partition information (%s)", esp_err_to_name(ret)); + } else { + ESP_LOGI(TAG, "Partition size: total: %d, used: %d", total, used); + } + + // Use POSIX and C standard library functions to work with files. + // First create a file. + ESP_LOGI(TAG, "Opening config file"); + + // Open renamed file for reading + ESP_LOGI(TAG, "Reading file"); + FILE *f = fopen("/spiffs/parameter.dat", "r"); + if (f == NULL) { + ESP_LOGE(TAG, "Failed to open file for reading"); + return -2; + } + char line[64]; + while (fgets(line, sizeof(line), f) > NULL) { + // strip newline + char *pos = strchr(line, '\n'); + if (pos) { + *pos = '\0'; + } + if (strlen(line) > 6) { + if (strncmp(line, "netip", 5) == 0) { + strncpy(netip, &line[6], 15); + } else if (strncmp(line, "netma", 5) == 0) { + strncpy(netma, &line[6], 15); + } else if (strncmp(line, "netgw", 5) == 0) { + strncpy(netgw, &line[6], 15); + } else if (strncmp(line, "srvip", 5) == 0) { + strncpy(srvip, &line[6], 15); + } else if (strncmp(line, "srvpo", 5) == 0) { + srvpo = atoi(&line[6]); + } else if (strncmp(line, "boxid", 5) == 0) { + boxid = atoi(&line[6]); + } else if (strncmp(line, "subbx", 5) == 0) { + subbx = atoi(&line[6]); + } else if (strncmp(line, "dbnam", 5) == 0) { + strncpy(dbnam, &line[6], 15); + } else if (strncmp(line, "xxxxx", 5) == 0) { + + } + } + ESP_LOGI(TAG, "Read from file: '%s'", line); + } + fclose(f); + // All done, unmount partition and disable SPIFFS + esp_vfs_spiffs_unregister(conf.partition_label); + ESP_LOGI(TAG, "SPIFFS unmounted"); + + return 1; +} +int WriteConfig(char *buff) { + ESP_LOGI(TAG, "Initializing SPIFFS"); + esp_vfs_spiffs_conf_t conf = { .base_path = "/spiffs", .partition_label = NULL, .max_files = 5, .format_if_mount_failed = false }; + + // Use settings defined above to initialize and mount SPIFFS filesystem. + // Note: esp_vfs_spiffs_register is an all-in-one convenience function. + esp_err_t ret = esp_vfs_spiffs_register(&conf); + if (ret != ESP_OK) { + if (ret == ESP_FAIL) { + ESP_LOGE(TAG, "Failed to mount or format filesystem"); + } else if (ret == ESP_ERR_NOT_FOUND) { + ESP_LOGE(TAG, "Failed to find SPIFFS partition"); + } else { + ESP_LOGE(TAG, "Failed to initialize SPIFFS (%s)", esp_err_to_name(ret)); + } + return -1; + } + + size_t total = 0, used = 0; + ret = esp_spiffs_info(conf.partition_label, &total, &used); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to get SPIFFS partition information (%s)", esp_err_to_name(ret)); + } else { + ESP_LOGI(TAG, "Partition size: total: %d, used: %d", total, used); + } + + ESP_LOGI(TAG, "Opening config file"); + ESP_LOGI(TAG, "Writing file"); + FILE *f = fopen("/spiffs/parameter.dat", "w"); + if (f == NULL) { + ESP_LOGE(TAG, "Failed to open file for writing"); + return -2; + } + + fprintf(f, "%s", buff); + + fclose(f); + // All done, unmount partition and disable SPIFFS + esp_vfs_spiffs_unregister(conf.partition_label); + ESP_LOGI(TAG, "SPIFFS unmounted"); + + return 1; +} +int SaveConfig(void) { // saves the config from settings screen + uint8_t ip1 = 0, ip2 = 0, ip3 = 0, ip4 = 0; + char buff[32]; + int i = 0; + ESP_LOGI(TAG, "Initializing SPIFFS"); + esp_vfs_spiffs_conf_t conf = { .base_path = "/spiffs", .partition_label = NULL, .max_files = 5, .format_if_mount_failed = false }; + + esp_err_t ret = esp_vfs_spiffs_register(&conf); + if (ret != ESP_OK) { + if (ret == ESP_FAIL) { + ESP_LOGE(TAG, "Failed to mount or format filesystem"); + } else if (ret == ESP_ERR_NOT_FOUND) { + ESP_LOGE(TAG, "Failed to find SPIFFS partition"); + } else { + ESP_LOGE(TAG, "Failed to initialize SPIFFS (%s)", esp_err_to_name(ret)); + } + return -1; + } + + size_t total = 0, used = 0; + ret = esp_spiffs_info(conf.partition_label, &total, &used); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to get SPIFFS partition information (%s)", esp_err_to_name(ret)); + } else { + ESP_LOGI(TAG, "Partition size: total: %d, used: %d", total, used); + } + + ESP_LOGI(TAG, "Opening config file"); + FILE *f = fopen("/spiffs/parameter.dat", "w"); + if (f == NULL) { + ESP_LOGE(TAG, "Failed to open file for writing"); + return -2; + } + + LCD->iReadValue((char *)"ip1",buff); + ip1=atoi(buff); + LCD->iReadValue((char *)"ip2",buff); + ip2=atoi(buff); + LCD->iReadValue((char *)"ip3",buff); + ip3=atoi(buff); + LCD->iReadValue((char *)"ip4",buff); + ip4=atoi(buff); + fprintf(f, "netip=%d.%d.%d.%d\n", ip1, ip2, ip3, ip4); + + LCD->iReadValue((char *)"ma1",buff); + ip1=atoi(buff); + LCD->iReadValue((char *)"ma2",buff); + ip2=atoi(buff); + LCD->iReadValue((char *)"ma3",buff); + ip3=atoi(buff); + LCD->iReadValue((char *)"ma4",buff); + ip4=atoi(buff); + fprintf(f, "netma=%d.%d.%d.%d\n", ip1, ip2, ip3, ip4); + + LCD->iReadValue((char *)"gw1",buff); + ip1=atoi(buff); + LCD->iReadValue((char *)"gw2",buff); + ip2=atoi(buff); + LCD->iReadValue((char *)"gw3",buff); + ip3=atoi(buff); + LCD->iReadValue((char *)"gw4",buff); + ip4=atoi(buff); + fprintf(f, "netgw=%d.%d.%d.%d\n", ip1, ip2, ip3, ip4); + + LCD->iReadValue((char *)"sip1",buff); + ip1=atoi(buff); + LCD->iReadValue((char *)"sip2",buff); + ip2=atoi(buff); + LCD->iReadValue((char *)"sip3",buff); + ip3=atoi(buff); + LCD->iReadValue((char *)"sip4",buff); + ip4=atoi(buff); + fprintf(f, "srvip=%d.%d.%d.%d\n", ip1, ip2, ip3, ip4); + + LCD->iReadValue((char *)"srvpo1",buff); + i=atoi(buff); + fprintf(f, "srvpo=%d\n", i); + + LCD->iReadValue((char *)"boxid1",buff); + i=atoi(buff); + fprintf(f, "boxid=%d\n", i); + + LCD->iReadValue((char *)"subbx1",buff); + i=atoi(buff); + fprintf(f, "subbx=%d\n", i); + + LCD->iReadValue((char *)"dbnam1",buff); + fprintf(f, "dbnam=%s\n", buff); + + fclose(f); + // All done, unmount partition and disable SPIFFS + esp_vfs_spiffs_unregister(conf.partition_label); + ESP_LOGI(TAG, "SPIFFS unmounted"); + + return 0; +} +void WriteVals(char *name, char *strvals) { + uint8_t ipp = 0; + uint32_t ip; + int i; + char nm[32]; + ip = esp_ip4addr_aton(strvals); + for (i = 1; i < 5; i++) { + ipp = ip & 0xFF; + sprintf(nm, "%s%d", name, i); + LCD->iWriteValue(nm, ipp); + ip = ip >> 8; + } +} +int HandleEdit(void) { + int sl=1; + int res; + while (sl) { + res=LCD->iReadProt(1); + printf("HE Res:%d\n",res);fflush(stdout); + if (res==HMIResultOK) { + vTaskDelay(1); + res=LCD->iReadProt(1); + vTaskDelay(1); + SaveConfig(); + sl=0; + LCD->iSendProt(6, (char*) "page 0"); + } else vTaskDelay(50); + } + return res; +} +int EditConfig() { + LCD->iSendProt(6, (char*) "page 3"); + WriteVals((char *)"ip",netip); + WriteVals((char *)"gw",netgw); + WriteVals((char *)"ma",netma); + WriteVals((char *)"ma",netma); + WriteVals((char *)"sip",srvip); + LCD->iWriteValue((char*) "srvpo1", srvpo); + LCD->iWriteValue((char*) "boxid1", boxid); + LCD->iWriteValue((char*) "subbx1", subbx); + LCD->iWriteValue((char*) "dbnam1", dbnam); + return HandleEdit(); +} diff --git a/software/main/config.h b/software/main/config.h new file mode 100644 index 0000000..fe5c896 --- /dev/null +++ b/software/main/config.h @@ -0,0 +1,33 @@ +/* + * config.h + * + * Created on: 26.02.2022 + * Author: steffen + */ + +#ifndef MAIN_CONFIG_H_ +#define MAIN_CONFIG_H_ +#include "main.h" +#include "HMI.h" + +extern const char *TAG; +extern HMI* LCD; + +static char netip[16]; +static char netma[16]; +static char netgw[16]; +static char srvip[16]; +static char dbnam[16]; +static int srvpo; +static int boxid; +static int subbx; + +int EditConfig(); +int HandleEdit(void); +int ReadConfig(); +int SaveConfig(void); +int WriteConfig(char *buff); +void WriteVals(char *name, char *strvals); + + +#endif /* MAIN_CONFIG_H_ */ diff --git a/software/main/etc.cpp b/software/main/etc.cpp new file mode 100644 index 0000000..a240398 --- /dev/null +++ b/software/main/etc.cpp @@ -0,0 +1,17 @@ +/* + * etc.cpp + * + * Created on: 26.02.2022 + * Author: steffen + */ +#include "etc.h" + +void DumpBuf(void *buf, int len) { + int i, c; + char *lb = (char*) buf; + for (i = 0; i < len; i++) { + c = (char) *lb++; + printf("%02X ", c); + } + printf("\n"); +} diff --git a/software/main/etc.h b/software/main/etc.h new file mode 100644 index 0000000..b5fc1f0 --- /dev/null +++ b/software/main/etc.h @@ -0,0 +1,14 @@ +/* + * etc.h + * + * Created on: 26.02.2022 + * Author: steffen + */ + +#ifndef MAIN_ETC_H_ +#define MAIN_ETC_H_ +#include "main.h" + +void DumpBuf(void *buf, int len); + +#endif /* MAIN_ETC_H_ */ diff --git a/software/main/iic.cpp b/software/main/iic.cpp new file mode 100644 index 0000000..ac74818 --- /dev/null +++ b/software/main/iic.cpp @@ -0,0 +1,174 @@ +/* + * iic.cpp + * + * Created on: 26.02.2022 + * Author: steffen + */ + +#include "iic.h" + +esp_err_t I2C_read(uint8_t slave_addr, uint8_t reg_addr, uint8_t *data, uint8_t len) { + return i2c_master_write_read_device(I2C_MASTER_NUM, slave_addr, ®_addr, 1, data, 2, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); +} +esp_err_t I2C_register_write_byte(uint8_t slave_addr, uint8_t reg_addr, uint8_t data) { + uint8_t write_buf[2] = { reg_addr, data }; + return i2c_master_write_to_device(I2C_MASTER_NUM, slave_addr, write_buf, sizeof(write_buf), I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); +} +esp_err_t I2C_init(void) { + int res1,res2; + int I2C_master_port = I2C_MASTER_NUM; + i2c_config_t I2C_conf = { .mode = I2C_MODE_MASTER, .sda_io_num = I2C_MASTER_SDA_IO, .scl_io_num = I2C_MASTER_SCL_IO, .sda_pullup_en = GPIO_PULLUP_ENABLE, .scl_pullup_en = GPIO_PULLUP_ENABLE, .master { .clk_speed = I2C_MASTER_FREQ_HZ, } }; + i2c_param_config(I2C_master_port, &I2C_conf); + res1=i2c_driver_install(I2C_master_port, I2C_conf.mode, + I2C_MASTER_RX_BUF_DISABLE, I2C_MASTER_TX_BUF_DISABLE, 0); + + I2C_buf[0] = 0x7F; // write data to output port 1 + I2C_buf[1] = 0x00; // write data to output port 1 + res1 = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP1, I2C_buf, 2, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + res2 = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP2, I2C_buf, 2, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + printf("\nMaster wrote %d %d %02X\n", res1,res2,I2C_buf[0]); + + I2C_buf[0] = 0x02; // write data to output port 1 + I2C_buf[1] = 0xFF; // write data to output port 1 + I2C_buf[2] = 0xFF; // write data to output port 1 + I2C_buf[3] = 0x00; // write data to output port 1 + I2C_buf[4] = 0x00; // write data to output port 1 + res1 = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP1, I2C_buf, 5, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + res2 = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP2, I2C_buf, 5, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + printf("\nMaster wrote %d %d %02X\n", res1,res2,I2C_buf[0]); + + I2C_buf[0] = 0x11; // write data to output port 1 + I2C_buf[1] = 0x10; // write data to output port 1 + res1 = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP1, I2C_buf, 2, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + res2 = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP2, I2C_buf, 2, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + printf("\nMaster wrote %d %d %02X\n", res1,res2,I2C_buf[0]); + + + + // printf("\nI2C wrote 0x%02X%02X: %d\n", I2C_buf[0], I2C_buf[1], res1); +// I2C_buf[0] = 0x00; // lese 3 bytes +// res2 = i2c_master_read_from_device(I2C_MASTER_NUM, I2C_PORTEXP1, I2C_buf, 1, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + + + /* + I2C_buf[0] = 0x8C; // write config port 0 with auto inc + I2C_buf[1] = 0xFF; // Port 0 Input + I2C_buf[2] = 0x00; // Port 1 Output + I2C_buf[3] = 0xFF; // Port 2 Input + res = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP1, I2C_buf, 4, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + printf("\nMaster wrote %02X %02X: %d\n", I2C_buf[0], I2C_buf[1], res); + + I2C_buf[0] = 0x05; // write data to output port 1 + I2C_buf[1] = 0x00; + res = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP1, I2C_buf, 2, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + printf("\nMaster wrote %02X %02X: %d\n", I2C_buf[0], I2C_buf[1], res); +*/ + return res1; +} +esp_err_t ADC_init(void) { + int res; + + I2C_buf[0] = 0x01; // -> config register + I2C_buf[1] = 0x40; // 0 100 000 0 A0-GND +-6.144 CONT + I2C_buf[2] = 0x0; // O00 0 0 0 11 8 SPS no comp + res = i2c_master_write_to_device(I2C_MASTER_NUM, ADC_DEFAULT_IIC_ADDR, I2C_buf, 3, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + printf("\nMaster wrote %02X %02X: %d\n", I2C_buf[0], I2C_buf[1], res); + return res; +} +int ADCReadAll(void) { +// for i in range(ADC_CHAN_NUM): +// data=self.bus.read_i2c_block_data(self.addr,REG_RAW_DATA_START+i,2) +// val=data[1]<<8|data[0] +// array.append(val) + int res1=0,res2,i; + I2C_buf[0] = 0x00; // conversion register + I2C_buf[1] = 0x00; + I2C_buf[2] = 0x00; + res1 = i2c_master_write_to_device(I2C_MASTER_NUM, ADC_DEFAULT_IIC_ADDR, I2C_buf, 1, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); +// printf("\nI2C wrote 0x%02X: %d\n", I2C_buf[0], res1); + + for (i=0;i<256;i++) { + res2 = i2c_master_read_from_device(I2C_MASTER_NUM, ADC_DEFAULT_IIC_ADDR, I2C_buf, 2, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + printf("I2C read %02x -> ",i); +// for (i=0;i<4;i++) { + printf(" %02X %02X ",I2C_buf[0],I2C_buf[1]); +// } + printf(" %d\n", res2); + } +// printf(" #:S%d R:%d ", res1, res2); + fflush(stdout); + + return res1; +} +int DoorIsClosed(int doormask) { + int res1,res2; + I2C_buf[0] = 0x80; // Setze CMD read port 0 + I2C_buf[1] = 0x00; + I2C_buf[2] = 0x00; + res1 = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP1, I2C_buf, 1, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); +// printf("\nI2C wrote 0x%02X%02X: %d\n", I2C_buf[0], I2C_buf[1], res1); + I2C_buf[0] = 0x00; // lese 3 bytes + res2 = i2c_master_read_from_device(I2C_MASTER_NUM, I2C_PORTEXP1, I2C_buf, 3, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); +// printf("\nI2C read 0x %02X %02X %02X: %d\n", I2C_buf[0], I2C_buf[1], I2C_buf[2], res2); + printf(" #:S%d R:%d ", res1, res2); + fflush(stdout); + // Open 0x0F = 0000 1111 + // 1 closed 0x0B = 0000 1011 + // 2 closed 0x0E = 0000 1110 + // 3 closed 0x0D = 0000 1101 + // 4 closed 0x07 = 0000 0111 + if ((I2C_buf[LOCKR_PORT] & doormask)==0) { + return 1; + } else { + return 0; + } + +} +int DoorOpen(int door) { + int mask=0; + int maskr=0; + int res; + int to=10; + switch (door) { // we allow only one door to open + case 1: { + mask = LOCK1; + maskr= LOCK1R; + } break; + case 2: { + mask = LOCK2; + maskr= LOCK2R; + } break; + case 3: { + mask = LOCK3; + maskr= LOCK3R; + } break; + default: { + mask = LOCK4; + maskr= LOCK4R; + } + } + + I2C_buf[0] = 0x05; + I2C_buf[1] = mask; + printf("\nMASTER wrote %02X %02X\n", I2C_buf[0], I2C_buf[1]);fflush(stdout); + res = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP1, I2C_buf, 2, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + printf("\nI2C wrote 0x%02X%02X: %d\n", I2C_buf[0], I2C_buf[1], res);fflush(stdout); + while (to>0) { + if (DoorIsClosed(maskr)==0) { + to=0; + } else { + to--; + vTaskDelay(1); + } + } + I2C_buf[0] = 0x05; + I2C_buf[1] = 0x00; + printf("\nMASTER wrote 0x%02X%02X\n", I2C_buf[0], I2C_buf[1]);fflush(stdout); + res = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP1, I2C_buf, 2, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + printf("\nI2C wrote 0x%02X%02X: %d\n", I2C_buf[0], I2C_buf[1], res); + + return 0; +} + + + diff --git a/software/main/iic.h b/software/main/iic.h new file mode 100644 index 0000000..9e1954e --- /dev/null +++ b/software/main/iic.h @@ -0,0 +1,25 @@ +/* + * iic.h + * + * Created on: 26.02.2022 + * Author: steffen + */ + +#ifndef MAIN_IIC_H_ +#define MAIN_IIC_H_ +#include "main.h" + +static uint8_t I2C_buf[16]; + +esp_err_t I2C_read(uint8_t slave_addr, uint8_t reg_addr, uint8_t *data, uint8_t len) ; +esp_err_t I2C_register_write_byte(uint8_t slave_addr, uint8_t reg_addr, uint8_t data); +//uint8_t write_buf[2] = { reg_addr, data }; +// return i2c_master_write_to_device(I2C_MASTER_NUM, slave_addr, write_buf, sizeof(write_buf), I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); +//} +esp_err_t I2C_init(void); +esp_err_t ADC_init(void); +int ADCReadAll(void); +int DoorIsClosed(int doormask); +int DoorOpen(int door); + +#endif /* MAIN_IIC_H_ */ diff --git a/software/main/main.cpp b/software/main/main.cpp new file mode 100644 index 0000000..632fc96 --- /dev/null +++ b/software/main/main.cpp @@ -0,0 +1,413 @@ + +#include "main.h" +#include "sdkconfig.h" + +#include "SimplePgSQL.h" +#include "MU80X.h" +#include "HMI.h" +#include "etc.h" +#include "uart.h" +#include "iic.h" +#include "config.h" + +// PGSQL +#define PGBufferSize 16384 +#define PGCharset "utf-8" +#define PGUser "mega" +#define PGPassword "osteoglossum" +static PGconnection *PGconn; +static unsigned char PGbuffer[PGBufferSize]; + +// ETC +const char *TAG = "SCALADIS"; +//static int cnt = 0; +//static int protcnt = 0; +static int serlen; +static int network_connected = 0; +MU80X *UHF; +HMI *LCD; + + +unsigned long long ReadAuth(void); + +/** ETH */ +static void eth_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) { + uint8_t mac_addr[6] = { 0 }; + /* we can get the ethernet driver handle from event data */ + esp_eth_handle_t eth_handle = *(esp_eth_handle_t*) event_data; + + switch (event_id) { + case ETHERNET_EVENT_CONNECTED: + esp_eth_ioctl(eth_handle, ETH_CMD_G_MAC_ADDR, mac_addr); + ESP_LOGI(TAG, "Eth Link Up"); + ESP_LOGI(TAG, "Eth MAC %02x:%02x:%02x:%02x:%02x:%02x", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); + break; + case ETHERNET_EVENT_DISCONNECTED: + ESP_LOGI(TAG, "Eth Link Down"); + break; + case ETHERNET_EVENT_START: + ESP_LOGI(TAG, "Eth Started"); + break; + case ETHERNET_EVENT_STOP: + ESP_LOGI(TAG, "Eth Stopped"); + break; + default: + break; + } +} +static void got_ip_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) { + ip_event_got_ip_t *event = (ip_event_got_ip_t*) event_data; + const esp_netif_ip_info_t *ip_info = &event->ip_info; + + ESP_LOGI(TAG, "Ethernet Got IP Address"); + ESP_LOGI(TAG, "~~~~~~~~~~~"); + ESP_LOGI(TAG, "ETHIP :" IPSTR, IP2STR(&ip_info->ip)); + ESP_LOGI(TAG, "ETHMASK:" IPSTR, IP2STR(&ip_info->netmask)); + ESP_LOGI(TAG, "ETHGW :" IPSTR, IP2STR(&ip_info->gw)); + ESP_LOGI(TAG, "~~~~~~~~~~~"); + network_connected = 1; +} +static void ETH_init(int dhcp) { + ESP_ERROR_CHECK(esp_netif_init()); + ESP_ERROR_CHECK(esp_event_loop_create_default()); + + // Create new default instance of esp-netif for Ethernet + esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH(); + esp_netif_t *eth_netif = esp_netif_new(&cfg); + + // Init MAC and PHY configs to default + eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); + eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); + + phy_config.phy_addr = CONFIG_EXAMPLE_ETH_PHY_ADDR; + phy_config.reset_gpio_num = CONFIG_EXAMPLE_ETH_PHY_RST_GPIO; + mac_config.smi_mdc_gpio_num = CONFIG_EXAMPLE_ETH_MDC_GPIO; + mac_config.smi_mdio_gpio_num = CONFIG_EXAMPLE_ETH_MDIO_GPIO; + esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config); + esp_eth_phy_t *phy = esp_eth_phy_new_lan87xx(&phy_config); + esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy); + esp_eth_handle_t eth_handle = NULL; + ESP_ERROR_CHECK(esp_eth_driver_install(&config, ð_handle)); + ESP_ERROR_CHECK(esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handle))); + + if (dhcp == 0) { + strcpy(netip, (char*) "192.168.178.32"); + strcpy(netgw, (char*) "192.168.178.1"); + strcpy(netma, (char*) "255.255.255.0"); + strcpy(srvip, (char*) "192.168.178.32"); + srvpo = 5432; + boxid = 1; + subbx = 1; + ReadConfig(); + + esp_netif_ip_info_t ip_info; + memset(&ip_info, 0, sizeof(esp_netif_ip_info_t)); + esp_netif_str_to_ip4((const char*) netip, &ip_info.ip); + esp_netif_str_to_ip4((const char*) netgw, &ip_info.gw); + esp_netif_str_to_ip4((const char*) netma, &ip_info.netmask); + esp_netif_set_ip_info(eth_netif, &ip_info); + } + ESP_ERROR_CHECK(esp_eth_start(eth_handle)); +} + +/** UHF */ +void UHF_init(void) { + int res; + UHF = new MU80X(UHF_UART_CHANNEL); + res = UHF->iSetRFRegion(); + res = UHF->iSetPower(30); + UHF->DumpBuffer(UHF->RecvBuf, res); + UHF->iClearBuffer(); +} +void UHF_loop(void) { + int i; + unsigned long long ID; + for (i = 0; i < 1000; i++) { + if ((ID=ReadAuth())>0) { + printf("ID:%lld",ID);fflush(stdout); + } + UHF->iBufferInventory(7, 0, 10); + printf("%d -> Tags in Buffer:%d Tags seen:%d\n", i, UHF->TagsInBuffer,UHF->TagsSeen); + fflush(stdout); + vTaskDelay(10); + }; + while (0) { + vTaskDelay(100); + }; +} + +unsigned long long ReadAuth(void) { + char authbuff[1024]; + char *pos; + int received = 0; + int timeout = 60; + serlen = uart_read_bytes(RDR_UART_CHANNEL, authbuff, 256, 1); + if (serlen > 0) { + + pos = strchr(authbuff, '\n'); + if (pos) { + *pos = '\0'; + } + + if (strncmp(authbuff, "CONFIG", 6) == 0) { // we have to receive the init file + printf("Ready to receive config file !\n"); + fflush(stdout); + while ((received == 0) & (timeout > 0)) { + serlen = uart_read_bytes(RDR_UART_CHANNEL, authbuff, 1023, 100); + if (serlen) { + authbuff[serlen] = 0; + WriteConfig(authbuff); + received = 1; + } else { + vTaskDelay(100); + timeout--; + printf("TO:%d\n", timeout); + fflush(stdout); + } + } + } + } + authbuff[serlen]=0; + printf("SERLEN:%d->%s\n", serlen,authbuff); + fflush(stdout); + return sscanf("%X",authbuff); +} + +/** GPIO **/ +void IO_init(void) { + // outputs + +#define GPO_BIT_MASK (1ULL << PHY_PWR) + gpio_config_t o_conf; + o_conf.intr_type = GPIO_INTR_DISABLE; + o_conf.mode = GPIO_MODE_OUTPUT; + o_conf.pin_bit_mask = GPO_BIT_MASK; + o_conf.pull_down_en = GPIO_PULLDOWN_ENABLE; + o_conf.pull_up_en = GPIO_PULLUP_DISABLE; + gpio_config(&o_conf); + gpio_set_level((gpio_num_t) PHY_PWR, 1); + + // inputs + /* + #define GPI_BIT_MASK ((1ULL << SWITCH)|(1ULL << SWITCH)) + gpio_config_t i_conf; + i_conf.intr_type = GPIO_INTR_DISABLE; + i_conf.mode = GPIO_MODE_INPUT; + i_conf.pin_bit_mask = GPI_BIT_MASK; + i_conf.pull_down_en = GPIO_PULLDOWN_DISABLE; + i_conf.pull_up_en = GPIO_PULLUP_DISABLE; + gpio_config(&i_conf); + */ +} +void HMI_init(void) { + LCD = new HMI(LCD_UART_CHANNEL); +} + +/** PGSQL **/ +void PGInit(void) { + PGconn = new PGconnection(0,PGbuffer,PGBufferSize); +} +int getInfo(char *info) { + int rc, i; + int pgstat = 0; + int cnt = 1000; + char *msg; + char lbuf[1024]; + rc = PGconn->PGsetDbLogin(srvip, srvpo, dbnam, PGUser, PGPassword, PGCharset); + printf("Login result:%d\n", rc); + if (rc < 1) + return -1; + pgstat = 1; + while (cnt > 0) { + + if (pgstat == 1) { // we are connected to srv/db, now we need to rcv the msgs from srv + rc = PGconn->PGstatus(); + printf("Status:%d\n", rc); + fflush(stdout); + if (rc == CONNECTION_BAD || rc == CONNECTION_NEEDED) { + printf("ERROR: %s", PGconn->PGgetMessage()); + pgstat = -1; + } else if (rc == CONNECTION_OK) { + pgstat = 2; + printf("Ready to submit qry\n"); + } + } + + if (pgstat == 2) { + sprintf(lbuf, "SELECT name,gname FROM accounts WHERE id=(cast(x'%s' AS int));", info); + rc = PGconn->PGexecute(lbuf); + printf("EXEC result:%d\n", rc); +// vTaskDelay(1); + if (rc == 0) { + pgstat = 3; + } else { + cnt = 0; + } + } + if (pgstat == 3) { + rc = PGconn->PGgetData(); + // printf("RC:%d\n",rc);fflush(stdout); + if (rc < 0) { + printf("Get Data Error:%d\n", rc); + fflush(stdout); + } else if (rc > 0) { + if (rc & PG_RSTAT_HAVE_COLUMNS) { + printf("We got columns !\n"); + fflush(stdout); + int cols = PGconn->PGnfields(); + printf("Cols: %d\n", cols); + fflush(stdout); + /* + for (i = 0; i < cols; i++) { + if (i) printf(" | "); + printf(" %s ",PGconn->PGgetColumn(i)); + } + */ + printf("\n==========\n"); + fflush(stdout); + } else if (rc & PG_RSTAT_HAVE_ROW) { + // printf("We got rows !\n");fflush (stdout); + for (i = 0; i < PGconn->PGnfields(); i++) { + // if (i) printf(" | "); + // msg = PGconn->PGgetValue(i); + sprintf(lbuf, "Info:\r\n%s\r\n%s", PGconn->PGgetValue(1), PGconn->PGgetValue(0)); + // if (!msg) msg = (char *) "NULL"; + // printf(" %s", msg);fflush(stdout); + } + // printf("\n");fflush(stdout); + } else if (rc & PG_RSTAT_HAVE_SUMMARY) { + printf("Rows affected: "); + printf("%d\n", PGconn->PGntuples()); + } else if (rc & PG_RSTAT_HAVE_MESSAGE) { + printf("We got msg !\n"); + fflush(stdout); + msg = PGconn->PGgetMessage(); + if (!msg) + msg = (char*) "NULL"; + printf("MSG: %s\n", msg); + fflush(stdout); + } + if (rc & PG_RSTAT_READY) { + printf("We made it !\n"); + fflush(stdout); + cnt = 0; + break; + } + } + } // pgstat==3 + vTaskDelay(1); + cnt--; + } // while (cnt>0) + PGconn->PGclose(); + return rc; +} + +static void init(void) { +// int res; +// printf("UART-Init:\n\n"); +// UART_init(); +// printf("IO-Init:\n\n"); +// IO_init(); +// printf("ETH-Init:\n\n"); +// ETH_init(0); +// printf("UHF-Init:\n\n"); +// UHF_init(); +// printf("HMI-Init:\n\n"); +// HMI_init(); + printf("I2C-Init:\n\n"); + ESP_ERROR_CHECK(I2C_init()); +// printf("ADC-Init:\n\n"); +// ESP_ERROR_CHECK(ADC_init()); + ESP_LOGI(TAG, "I2C initialized successfully"); + +} +static void main_loop() { + int res1 = 0, res2 = 0; + printf("Main loop\n"); + fflush(stdout); +// res1 = LCD->iSendProt(6, (char*) "page 0", 1); + printf("res:%d\n", res1); + fflush(stdout); +// int door=1; + +// UHF_loop(); +// EditConfig(); +// UHF_loop(); + + while (1) { +// ADCReadAll(); + + I2C_buf[0] = 0x02; // write data to output port 1 + I2C_buf[1] = 0x55; // write data to output port 1 + I2C_buf[2] = 0xAA; // write data to output port 1 + res1 = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP1, I2C_buf, 3, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + // printf("\nI2C wrote 0x%02X%02X: %d\n", I2C_buf[0], I2C_buf[1], res1); +// I2C_buf[0] = 0x00; // lese 3 bytes +// res2 = i2c_master_read_from_device(I2C_MASTER_NUM, I2C_PORTEXP1, I2C_buf, 1, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + + printf("\nMaster wrote %d %d %02X\n", res1,res2,I2C_buf[0]); + + + vTaskDelay(500 / portTICK_PERIOD_MS); + I2C_buf[0] = 0x02; // write data to output port 1 + I2C_buf[1] = 0xAA; // write data to output port 1 + I2C_buf[2] = 0x55; // write data to output port 1 + res1 = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP1, I2C_buf, 3, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + // printf("\nI2C wrote 0x%02X%02X: %d\n", I2C_buf[0], I2C_buf[1], res1); +// I2C_buf[0] = 0x00; // lese 3 bytes +// res2 = i2c_master_read_from_device(I2C_MASTER_NUM, I2C_PORTEXP1, I2C_buf, 1, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + + printf("\nMaster wrote %d %d %02X\n", res1,res2,I2C_buf[0]); + + + vTaskDelay(500 / portTICK_PERIOD_MS); + } + + while (0) { + printf("Closed 1:%d\n",DoorIsClosed(LOCK1R));fflush(stdout); + printf("Closed 2:%d\n",DoorIsClosed(LOCK2R));fflush(stdout); + printf("Closed 3:%d\n",DoorIsClosed(LOCK3R));fflush(stdout); + printf("Closed 4:%d\n",DoorIsClosed(LOCK4R));fflush(stdout); + /* + res1 = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP, I2C_buf, 2, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + printf("\nI2C wrote 0x%02X%02X: %d\n", I2C_buf[0], I2C_buf[1], res1); + + vTaskDelay(1); + + I2C_buf[0] = 0x05; + I2C_buf[1] = 0x00; + res1 = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP, I2C_buf, 2, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + printf("\nI2C wrote 0x%02X%02X: %d\n", I2C_buf[0], I2C_buf[1], res1); + + I2C_buf[0] = 0x80; // Setze CMD read port 0 + I2C_buf[1] = 0x00; + I2C_buf[2] = 0x00; + res1 = i2c_master_write_to_device(I2C_MASTER_NUM, I2C_PORTEXP, I2C_buf, 1, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + printf("\nI2C wrote 0x%02X%02X: %d\n", I2C_buf[0], I2C_buf[1], res1); + I2C_buf[0] = 0x00; // lese 3 bytes + res2 = i2c_master_read_from_device(I2C_MASTER_NUM, I2C_PORTEXP, I2C_buf, 3, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); + printf("\nI2C read 0x %02X %02X %02X: %d\n", I2C_buf[0], I2C_buf[1], I2C_buf[2], res2); + vTaskDelay(2000 / portTICK_PERIOD_MS); + printf(" #:S%d R:%d ", res1, res2); + fflush(stdout); + */ + + vTaskDelay(10000 / portTICK_PERIOD_MS); + DoorOpen(1); +// vTaskDelay(10); + DoorOpen(2); + vTaskDelay(10); + DoorOpen(3); + vTaskDelay(10); + DoorOpen(4); + vTaskDelay(10); + printf("\n\n\n");fflush(stdout); + } +} + +extern "C" { +void app_main(void) { + init(); + main_loop(); +} +} diff --git a/software/main/main.h b/software/main/main.h new file mode 100644 index 0000000..cd7d9ec --- /dev/null +++ b/software/main/main.h @@ -0,0 +1,130 @@ +/* + * main.h + * + * Created on: 26.02.2022 + * Author: steffen + */ +#ifndef MAIN_MAIN_H_ +#define MAIN_MAIN_H_ +#include <sys/types.h> +#include <stdio.h> +#include <string.h> +#include <stdint.h> +#include <freertos/FreeRTOS.h> +#include <freertos/task.h> +#include <esp_netif.h> +#include <esp_eth.h> +#include <esp_log.h> +#include <esp_spiffs.h> +#include <esp_err.h> +#include <driver/uart.h> +#include <driver/gpio.h> +#include <driver/i2c.h> +#include <lwip/err.h> +#include <lwip/sockets.h> + + +// +3,3V // Pin 1 +// GND // Pin 2 +// ESP_EN // Pin 3 +#define UHF_RXD_MISO 36 // pin 4 UART +#define LCD_RXD_MISO 39 // pin 5 UART +// NC pin 6 +#define I2Cint 35 // pin 7 EXP +#define SCL 32 // pin 8 EXP +#define SDA 33 // pin 9 EXP +#define EMAC_RXD0_RMII 25 // pin 10 ETH +#define EMAC_RXD1_RMII 26 // pin 11 ETH +#define EMAC_RX_CRS_DV 27 // pin 12 ETH +#define HS2_CLK 14 // pin 13 ETH +#define PHY_PWR 12 // pin 14 ETH +// // pin 15 GND +#define I2C_SDA_40p 13 // pin 16 40p +// NC pin 17 bis 22 +#define HS2_CMD 15 // pin 23 ETH +#define HS2_DATA0 02 // pin 24 ETH +#define ETH_CLKREF 0 // pin 25 ETH +#define UHF_TXD_MOSI 04 // pin 26 UART +#define LCD_TXD_MOSI 16 // pin 27 UART +#define EMAC_CLK_OUT_180 17 // pin 28 ETH +#define SPI_CS 05 // pin 29 40p +#define MDIO_RMII 18 // pin 30 ETH +#define EMAC_TXD0_RMII 19 // pin 31 ETH +//NC pin 32 +#define EMAC_TX_EN_RMII 21 // pin 33 ETH +#define RDR_RXD_MISO 03 // pin 34 UART +#define RDR_TXD_MOSI 01 // pin 35 UART +#define EMAC_TXD1_RMII 22 // pin 36 ETH +#define MDC_RMII 23 // pin 37 ETH +//GND pin 38, 39 +#define RDR_UART_CHANNEL 0 +#define RDR_UART_BAUD_RATE 9600 +//#define RDR_UART_BAUD_RATE 115200 +#define RDR_UART_RX_PIN RDR_RXD_MISO +#define RDR_UART_TX_PIN RDR_TXD_MOSI + +#define LCD_UART_CHANNEL 1 +#define LCD_UART_BAUD_RATE 115200 +#define LCD_UART_RX_PIN LCD_RXD_MISO +#define LCD_UART_TX_PIN LCD_TXD_MOSI + +#define UHF_UART_CHANNEL 2 // for easy adaptation in the future +#define UHF_UART_BAUD_RATE 115200 +#define UHF_UART_RX_PIN UHF_RXD_MISO +#define UHF_UART_TX_PIN UHF_TXD_MOSI + +#define I2C_MASTER_SCL_IO SCL +#define I2C_MASTER_SDA_IO SDA +#define I2C_MASTER_NUM 0 /*!< I2C master i2c port number, the number of i2c peripheral interfaces available will depend on the chip */ +#define I2C_MASTER_FREQ_HZ 100000 /*!< I2C master clock frequency */ +#define I2C_MASTER_TX_BUF_DISABLE 0 /*!< I2C master doesn't need buffer */ +#define I2C_MASTER_RX_BUF_DISABLE 0 /*!< I2C master doesn't need buffer */ +#define I2C_MASTER_TIMEOUT_MS 1000 + +#define I2C_PORTEXP1 0x58 +#define I2C_PORTEXP2 0x5A + +#define ADC_DEFAULT_IIC_ADDR 0x48 +#define ADC_CHAN_NUM 8 +#define ADC_REG_RAW_DATA_START 0x10 +#define ADC_REG_VOL_START 0x20 +#define ADC_REG_RTO_START 0x30 +#define ADC_REG_SET_ADDR 0xC0 + +// GPA Output +// GPB Input + +#define LOCK1 0x40 +#define LOCK2 0x10 +#define LOCK3 0x20 +#define LOCK4 0x80 +#define LOCK_MASK LOCK1+LOCK2+LOCK3+LOCK4 +#define LOCKPORT 0x01 + +#define LOCK1R 0x04 +#define LOCK2R 0x01 +#define LOCK3R 0x02 +#define LOCK4R 0x08 +#define LOCKR_MASK LOCK1R+LOCK2R+LOCK3R+LOCK4R +#define LOCKR_PORT 0x02 + +#define TASK_STACK_SIZE 2048 +#define READ_BUF_SIZE 1024 + +#define STX 0x02 +#define ETX 0x03 +#define EOT 0x04 + +#define MAX_TAGS 256 + +typedef struct { + unsigned char b[12]; + unsigned char ant; + unsigned char rssi; + unsigned char count; +} Tag_t; + + + + +#endif /* MAIN_MAIN_H_ */ diff --git a/software/main/uart.cpp b/software/main/uart.cpp new file mode 100644 index 0000000..c764ba2 --- /dev/null +++ b/software/main/uart.cpp @@ -0,0 +1,57 @@ +/* + * uart.cpp + * + * Created on: 26.02.2022 + * Author: steffen + */ +#include "uart.h" + +void UART_init(void) { + int intr_alloc_flags = ESP_INTR_FLAG_IRAM; + + vTaskDelay(100); +#ifdef DEBUG + printf("LCD\n"); + fflush(stdout); +#endif + uart_config_t lcd_uart_config = { + .baud_rate = LCD_UART_BAUD_RATE, + .data_bits = UART_DATA_8_BITS, + .parity = UART_PARITY_DISABLE, + .stop_bits = UART_STOP_BITS_1, + .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, + .source_clk = UART_SCLK_APB, + }; + + ESP_ERROR_CHECK(uart_driver_install(LCD_UART_CHANNEL, READ_BUF_SIZE * 2, 0, 0, NULL, intr_alloc_flags)); + ESP_ERROR_CHECK(uart_param_config(LCD_UART_CHANNEL, &lcd_uart_config)); + ESP_ERROR_CHECK(uart_set_pin(LCD_UART_CHANNEL, LCD_UART_TX_PIN, LCD_UART_RX_PIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE)); + +#ifdef DEBUG + printf("UHF\n"); + fflush(stdout); +#endif + uart_config_t uhf_uart_config = { + .baud_rate = UHF_UART_BAUD_RATE, + .data_bits = UART_DATA_8_BITS, + .parity = UART_PARITY_DISABLE, + .stop_bits = UART_STOP_BITS_1, + .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, + .source_clk = UART_SCLK_APB, + }; + + ESP_ERROR_CHECK(uart_driver_install(UHF_UART_CHANNEL, READ_BUF_SIZE * 2, 0, 0, NULL, intr_alloc_flags)); + ESP_ERROR_CHECK(uart_param_config(UHF_UART_CHANNEL, &uhf_uart_config)); + ESP_ERROR_CHECK(uart_set_pin(UHF_UART_CHANNEL, UHF_UART_TX_PIN, UHF_UART_RX_PIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE)); +} +int UART_read(int channel, void *buf, int len = READ_BUF_SIZE) { + return (uart_read_bytes(channel, buf, len, 1)); +} +int UART_write(int channel, void *buf, int len) { + return (uart_write_bytes(channel, serout, len)); +} +void UART_debug(char *buf, int len) { + UART_write(0, (void*) buf, len); +} + + diff --git a/software/main/uart.h b/software/main/uart.h new file mode 100644 index 0000000..14389a6 --- /dev/null +++ b/software/main/uart.h @@ -0,0 +1,22 @@ +/* + * uart.h + * + * Created on: 26.02.2022 + * Author: steffen + */ +#ifndef MAIN_UART_H_ +#define MAIN_UART_H_ +#include "main.h" + +//static char serin[READ_BUF_SIZE + 16]; +static char serout[READ_BUF_SIZE + 16]; + +void UART_init(void); +void UART_debug(char *buf, int len); +int UART_read(int channel, void *buf, int len); +int UART_write(int channel, void *buf, int len); + + + + +#endif /* MAIN_UART_H_ */ |
