This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PRU Compiler CLPRU 2.3.3" bug in intrinsic function __delay_cycles

I have a work around for the problem using multiple delay calls. Just FYI. Document is wrong or it's a bug.

according to table 5-4 in SPRUHV7C – July 2014 – Revised July 2018

void __delay_cycles( unsigned int cycles );  varies Delays PRU execution for the specified number of cycles.

                                                                     The number of cycles must be a constant.

any value exceeding INT32_MAX  (signed int) results in a 64 bit rollover error.

WARNING! at line 106: [W0001] Constant value out of range,
                                                  will be truncated to 32 bits
            LDI32    r0, 9223372035781033983

after truncation this results in an incorrect wait time.

tool chain Version numbers

PRU C/C++ Compiler v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D

PRU EABI C/C++ Parser v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU C/C++ File Merge v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU C/C++ Optimizer v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU C/C++ Codegen v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU Assembler v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU Embed Utility v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU C Source Interlister v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU Linker v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU Absolute Lister v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU Strip Utility v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU XREF Utility v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU C++ Demangler v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU Hex Converter v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU Name Utility v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU Object File Display v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D
PRU Archiver v2.3.3
Build Number 1TKVO-2LI-UASAR-TAR-C08D

sample code to reproduce

#include <stdint.h>

const uint32_t MAX_CYCLES_WITHOUT_ERROR = INT32_MAX;
void main(void)
{
  __delay_cycles(MAX_CYCLES_WITHOUT_ERROR);                                                                                                                                        
  __delay_cycles(MAX_CYCLES_WITHOUT_ERROR+1);
}