tsandmann / freertos-teensy

FreeRTOS port with C++ std::thread support for ARM boards Teensy 3.5, 3.6, 4.0 and 4.1 (cortex-m4f and cortex-m7f)
92 stars 15 forks source link

Volatile Error On Compilation Fix #20

Closed Stevenlawrencehoriba closed 1 year ago

Stevenlawrencehoriba commented 1 year ago

HI can you apply this mod to your freeRTOS implementation, as the warning messages become a bit annoying , when trying to find your own issues and warning when compiling,. The following small change just sorts this out, with the compiler you are using. There are also a few other warnings that need to be addressed

class CrashReportClass: public Printable { public: virtual size_t printTo(Print& p) const; void clear(); operator bool(); void breadcrumb(unsigned int num, unsigned int value) { // crashreport_breadcrumbs_struct occupies exactly 1 cache row volatile struct crashreport_breadcrumbs_struct bc = (struct crashreport_breadcrumbs_struct )0x2027FFC0; if (num >= 1 && num <= 6) { num--; bc->value[num] = value; // volatile depreciation fix, suggestion is to not use |= // doing it this way cleans up the compilation errors, and makes it easier to read // or find your own errors in your owen projects bc->bitmask = (bc->bitmask | (1 << num)); // bc->bitmask |= (1 << num); arm_dcache_flush((void *)bc, sizeof(struct crashreport_breadcrumbs_struct)); } } };

tsandmann commented 1 year ago

Hi, the CrashReportClass is part of the teensy core library, not the FreeRTOS library. As there are many warnings of volatile compound operations with C++20, I would recommend to add -Wno-volatile as compiler option to deactivate them. The warnings will also be removed with C++23.