Skip to content

Commit b4a9707

Browse files
vishwamarturaggarg
andauthored
Fix RISC-V configMTIMECMP_BASE_ADDRESS (64-bit) stored in 32-bit int (#1176)
Related to #189 Update `configMTIMECMP_BASE_ADDRESS` to be stored in a 64-bit integer. * Change the type of `ullMachineTimerCompareRegisterBase` to `uint64_t` in `portable/GCC/RISC-V/port.c`. * Change the type of `ullMachineTimerCompareRegisterBase` to `uint64_t` in `portable/IAR/RISC-V/port.c`. * Update the initialization of `ullMachineTimerCompareRegisterBase` to use `configMTIMECMP_BASE_ADDRESS` in both files. Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
1 parent a27d665 commit b4a9707

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

portable/GCC/RISC-V/port.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
*/
2828

2929
/*-----------------------------------------------------------
30-
* Implementation of functions defined in portable.h for the RISC-V port.
31-
*----------------------------------------------------------*/
30+
* Implementation of functions defined in portable.h for the RISC-V port.
31+
*----------------------------------------------------------*/
3232

3333
/* Scheduler includes. */
3434
#include "FreeRTOS.h"
@@ -90,7 +90,7 @@ void vPortSetupTimerInterrupt( void ) __attribute__( ( weak ) );
9090
uint64_t ullNextTime = 0ULL;
9191
const uint64_t * pullNextTime = &ullNextTime;
9292
const size_t uxTimerIncrementsForOneTick = ( size_t ) ( ( configCPU_CLOCK_HZ ) / ( configTICK_RATE_HZ ) ); /* Assumes increment won't go over 32-bits. */
93-
uint32_t const ullMachineTimerCompareRegisterBase = configMTIMECMP_BASE_ADDRESS;
93+
uint64_t const ullMachineTimerCompareRegisterBase = configMTIMECMP_BASE_ADDRESS;
9494
volatile uint64_t * pullMachineTimerCompareRegister = NULL;
9595

9696
/* Holds the critical nesting value - deliberately non-zero at start up to

portable/IAR/RISC-V/port.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
*/
2828

2929
/*-----------------------------------------------------------
30-
* Implementation of functions defined in portable.h for the RISC-V port.
31-
*----------------------------------------------------------*/
30+
* Implementation of functions defined in portable.h for the RISC-V port.
31+
*----------------------------------------------------------*/
3232

3333
/* Scheduler includes. */
3434
#include "FreeRTOS.h"
@@ -98,7 +98,7 @@ void vPortSetupTimerInterrupt( void ) __attribute__( ( weak ) );
9898
uint64_t ullNextTime = 0ULL;
9999
const uint64_t * pullNextTime = &ullNextTime;
100100
const size_t uxTimerIncrementsForOneTick = ( size_t ) ( ( configCPU_CLOCK_HZ ) / ( configTICK_RATE_HZ ) ); /* Assumes increment won't go over 32-bits. */
101-
uint32_t const ullMachineTimerCompareRegisterBase = configMTIMECMP_BASE_ADDRESS;
101+
uint64_t const ullMachineTimerCompareRegisterBase = configMTIMECMP_BASE_ADDRESS;
102102
volatile uint64_t * pullMachineTimerCompareRegister = NULL;
103103

104104
/* Holds the critical nesting value - deliberately non-zero at start up to

0 commit comments

Comments
 (0)