Page 1 of 1

CH_CFG_ST_RESOLUTION == 64 : compile error  Topic is solved

Posted: Sat Oct 31, 2020 9:51 am
by alex31
Hello,

This is for chibios 20.3, using RT.

From what i see in chconf.h :

Code: Select all

/**
 * @brief   Type of system time.
 * @note    It is selectable in configuration between 16, 32 or 64 bits.
 */
#if (CH_CFG_ST_RESOLUTION == 64) || defined(__DOXYGEN__)
typedef uint64_t systime_t;
#elif CH_CFG_ST_RESOLUTION == 32
typedef uint32_t systime_t;
#elif CH_CFG_ST_RESOLUTION == 16
typedef uint16_t systime_t;
#endif


setting CH_CFG_ST_RESOLUTION to 64 is permitted (and useful when using tickless mode with high frequency).

but osal.h dont permit to do so.

here is a patch that permit 64 bits resolution :

Code: Select all

diff --git a/os/hal/osal/rt-nil/osal.h b/os/hal/osal/rt-nil/osal.h
index 73e8e3fa9..fbeefc296 100644
--- a/os/hal/osal/rt-nil/osal.h
+++ b/os/hal/osal/rt-nil/osal.h
@@ -119,8 +119,8 @@
 #error "invalid OSAL_ST_MODE setting in osal.h"
 #endif
 
-#if (OSAL_ST_RESOLUTION != 16) && (OSAL_ST_RESOLUTION != 32)
-#error "invalid OSAL_ST_RESOLUTION, must be 16 or 32"
+#if (OSAL_ST_RESOLUTION != 16) && (OSAL_ST_RESOLUTION != 32) && (OSAL_ST_RESOLUTION != 64)
+#error "invalid OSAL_ST_RESOLUTION, must be 16 or 32 or 64"
 #endif
 
 /*===========================================================================*/


also, in each chconf.h example file, there is a doxygen note that need to be modified :
@note Allowed values are 16 or 32 bits or 64 bits.

Alexandre

Re: CH_CFG_ST_RESOLUTION == 64 : compile error

Posted: Sat Oct 31, 2020 10:56 am
by Giovanni
Hi,

This would require a 64 bits timer, anyway, it makes sense.

Giovanni

Re: CH_CFG_ST_RESOLUTION == 64 : compile error

Posted: Sat Oct 31, 2020 11:23 am
by alex31
Giovanni wrote:Hi,

This would require a 64 bits timer, anyway, it makes sense.

Giovanni


Internally, RT don't manage the wrapping of the 32 bits timer ?

Re: CH_CFG_ST_RESOLUTION == 64 : compile error

Posted: Sat Oct 31, 2020 11:40 am
by Giovanni
It does but it is no more "tick-less" it is "much-less-ticks-than-usual mode" ;)

Fixed as bug #1128.

Giovanni