ThingSet / thingset-device-library

ThingSet library for resource-constrained devices written in C/C++
https://thingset.io/thingset-device-library/
Apache License 2.0
14 stars 6 forks source link

Issue with cstdint header(after fixes #27) #30

Open ZanderCai opened 2 years ago

ZanderCai commented 2 years ago

Hello Martin,

We are at Columbia MPlab and tried to use the recent version of the library(before the version of Fixes #27 ), and faced an issue with #cstdint header. (The mcu what we use is Texas Instructment C2000, TMS320F28377S LaunchPad with IDE Code Composer Studio and newest version of C2000 Compiler V21.12.0.) #include <cstdint> Here is the related error message: >> Compilation failure subdir_rules.mk:16: recipe for target 'DataObjectNew.obj' failed "C:/ti/thingset_device_library/src/thingset.h", line 18: fatal error #1965: cannot open source file "cstdint" 1 catastrophic error detected in the compilation of "../DataObjectNew.cpp". Compilation terminated.

At first , we believed this is a smilar issue as Fixes #27 , so we applied the Fixes. After that, the follwing error about "uint8_t" poped out: >> Compilation failure subdir_rules.mk:16: recipe for target 'DataObjectNew.obj' failed "C:\ti\thingset_device_library\src\cbor.h", line 73: error #20: identifier "uint8_t" is undefined "C:\ti\thingset_device_library\src\cbor.h", line 73: error #20: identifier "data" is undefined "C:\ti\thingset_device_library\src\cbor.h", line 73: error #18: expected a ")" "C:\ti\thingset_device_library\src\cbor.h", line 88: error #18: expected a ")" "C:\ti\thingset_device_library\src\cbor.h", line 101: error #18: expected a ")" "C:\ti\thingset_device_library\src\cbor.h", line 112: error #18: expected a ")" "C:\ti\thingset_device_library\src\cbor.h", line 123: error #18: expected a ")" "C:\ti\thingset_device_library\src\cbor.h", line 134: error #18: expected a ")" "C:\ti\thingset_device_library\src\cbor.h", line 146: error #18: expected a ")" "C:\ti\thingset_device_library\src\cbor.h", line 159: error #18: expected a ")" "C:\ti\thingset_device_library\src\cbor.h", line 172: error #18: expected a ")" "C:\ti\thingset_device_library\src\cbor.h", line 186: error #760: "uint8_t" is not a type name "C:\ti\thingset_device_library\src\cbor.h", line 196: error #760: "uint8_t" is not a type name "C:\ti\thingset_device_library\src\cbor.h", line 206: error #760: "uint8_t" is not a type name "C:\ti\thingset_device_library\src\cbor.h", line 216: error #760: "uint8_t" is not a type name "C:\ti\thingset_device_library\src\cbor.h", line 226: error #760: "uint8_t" is not a type name "C:\ti\thingset_device_library\src\cbor.h", line 236: error #760: "uint8_t" is not a type name "C:\ti\thingset_device_library\src\cbor.h", line 249: error #760: "uint8_t" is not a type name "C:\ti\thingset_device_library\src\cbor.h", line 259: error #760: "uint8_t" is not a type name "C:\ti\thingset_device_library\src\cbor.h", line 269: error #760: "uint8_t" is not a type name "C:\ti\thingset_device_library\src\cbor.h", line 280: error #760: "uint8_t" is not a type name "C:\ti\thingset_device_library\src\cbor.h", line 291: error #760: "uint8_t" is not a type name "C:\ti\thingset_device_library\src\cbor.h", line 303: error #760: "uint8_t" is not a type name "C:\ti\thingset_device_library\src\cbor.h", line 303: error #760: "uint8_t" is not a type name "C:\ti\thingset_device_library\src\cbor.h", line 314: error #760: "uint8_t" is not a type name "C:\ti\thingset_device_library\src\cbor.h", line 323: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 184: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 195: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 408: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 451: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 461: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 512: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 513: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 606: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 621: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 634: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 647: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 666: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 667: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 683: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 757: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 757: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 792: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 797: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 802: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 807: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 812: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 817: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 818: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 869: error #760: "uint8_t" is not a type name "C:/ti/thingset_device_library/src/thingset.h", line 887: error #760: "uint8_t" is not a type name "../DataObjectNew.cpp", line 33: error #20: identifier "LL_GetFlashSize" is undefined "../DataObjectNew.cpp", line 34: error #20: identifier "FLASH_PAGE_SIZE" is undefined "../DataObjectNew.cpp", line 37: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 38: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 39: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 40: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 44: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 45: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 47: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 48: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 51: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 52: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 53: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 55: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 58: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 61: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 65: error #20: identifier "float32_t" is undefined "../DataObjectNew.cpp", line 68: error #20: identifier "CONFIG_THINGSET_SERIAL_PUB_DEFAULT" is undefined "../DataObjectNew.cpp", line 68: error #20: identifier "IS_ENABLED" is undefined

C2000 Compiler V21.12.0 compiler should compile C and C++. Our code has both C and C++ with main function file as .C file. Do you have any idea about how to fix this issue?

Thanks so much for help,

MPlab Columbia University

martinjaeger commented 2 years ago

That looks strange, as uint8_t should be defined in stdint.h: https://en.cppreference.com/w/c/types/integer

Maybe it's a problem of the C2000 compiler. So I'm sorry that I don't have a good idea for a fix right now.

jalinei commented 2 years ago

Maybe you can replace all uint8_t with uint16_t ? Would it mess everything up ?

ZanderCai commented 2 years ago

Hello, everyone, just quick update from our side. We tried #define uint8_t uint16_t, and those "uint8_t" is not a type name error was gone. Pls don't close the case right now. We still need to work on it and not sure whether any future error will be encountted base on the fix what we do so far. We'll keep updating. Thanks!

martinjaeger commented 2 years ago

Luiz shared this link with me: https://software-dl.ti.com/ccs/esd/documents/c2000_byte-accesses-with-the-c28x-cpu.html

At first I thought that must be a joke, but it really seems that TI defines a byte with 16 bit. This reminded me of this funny talk I recently watched where they suggest to define integers as 17-bit (leaving remaining 15 bits unused) to increase revenue of memory companies.

So, yeah, this library probably only works for ISO C compliant compilers / platforms. If the hack with #define uint8_t uint16_t works properly, that would be surprising. Let me know your testing result.