Nios V - BSP generation produces incorrect ALT_CPU_MTIME_OFFSET value in system.h
I'm in the process of migrating a Nios II/f processor to a Nios V/g processor. Quartus Pro 23.3 is being used.
In our setup we use an external timer block for the sys_clk_timer. For the timestamp_timer we use none. No OS is being used.
When using a sleep (alt_busy_sleep of the HAL) command in the code, it leads to an exception causing the application to halt.
I tracked it down to the following:
When generating the BSP, the system.h file contains the following define (which indicates that the timer_sw_agent is not connected, and that it correct):
#define ALT_CPU_MTIME_OFFSET 0xffffffff
The alt_busy_sleep method in alt_busy_sleep.c of the BSP checks on if MTIME_SW_AGENT_CONNECTED is defined (it should not be defined, since we want to go into the else statement!). This is defined on the following condition:
// Determine if timer_sw_agent interface is connected in HW #ifdef ALT_CPU_MTIME_OFFSET #if ALT_CPU_MTIME_OFFSET != 0xffffffffffffffff #define MTIME_SW_AGENT_CONNECTED #endif #endif
Since the ALT_CPU_MTIME_OFFSET is defined as 32-bit and the check is done with 64-bit, it seems that the width of ALT_CPU_MTIME_OFFSET or the if condition is incorrect?
How should I fix this?
Hi KennyJoosen,
I have file an internal request regarding the issue last week. Estimated that the changes will take some time for the next release.
Thanks.
Regards,
Aik Eu