From 93a7cc2523f1af8f17aeb0c5872ae8944c38e7eb Mon Sep 17 00:00:00 2001 From: Denis Ryndine Date: Tue, 13 Feb 2024 21:56:06 +0000 Subject: [PATCH] cmd_bios.c: Fix wrong byte size of uptime in uptime_handler. - It's a 64bit not 32bit unsigned and it caused overflow/negative cycles display. --- litex/soc/software/bios/cmds/cmd_bios.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/litex/soc/software/bios/cmds/cmd_bios.c b/litex/soc/software/bios/cmds/cmd_bios.c index 5acf67140..db6d1cbf0 100644 --- a/litex/soc/software/bios/cmds/cmd_bios.c +++ b/litex/soc/software/bios/cmds/cmd_bios.c @@ -73,13 +73,13 @@ define_command(ident, ident_handler, "Identifier of the system", SYSTEM_CMDS); #ifdef CSR_TIMER0_UPTIME_CYCLES_ADDR static void uptime_handler(int nb_params, char **params) { - unsigned long uptime; + uint64_t uptime; timer0_uptime_latch_write(1); uptime = timer0_uptime_cycles_read(); - printf("Uptime: %ld sys_clk cycles / %ld seconds", - uptime, - uptime/CONFIG_CLOCK_FREQUENCY + printf("Uptime: %" PRIu64 " sys_clk cycles / %" PRIu64 " seconds\n", + uptime, + uptime / CONFIG_CLOCK_FREQUENCY ); }