chtime assert bug Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
mmccoo
Posts: 3
Joined: Wed Apr 25, 2018 8:50 am

chtime assert bug  Topic is solved

Postby mmccoo » Wed Jun 06, 2018 4:06 pm

note that I also reported a different issue here:
http://www.chibios.com/forum/viewtopic.php?t=4621
with no reponse. Perhaps this is cause I didn't report in this forum.

also this one:
http://www.chibios.com/forum/viewtopic.php?f=16&t=4622
suggesting documentation additions. The chibios code is very excellent. The documentation... I've had a lot of trouble with it.


Anyway, the new bug.

I'm running testhal/STM32/STM32F1xx/USB_CDC using an stm32f103c8t6 (aka the cheap blue pill board)

In my build, I get these types:

typedef uint16_t systime_t;
typedef uint32_t sysinterval_t;
#define TIME_INFINITE ((sysinterval_t)-1)


chTimeAddX has
chDbgCheck(interval <= (sysinterval_t)((systime_t)-1));

where interval = TIME_INFINITE

since systime is unsigned, it won't be sign extended when cast to sysinterval

4294967295 is not <= 65535 so this check fails.

when I change it to this:
chDbgCheck((interval == TIME_INFINITE) || (interval <= (sysinterval_t)((systime_t)-1)));

the usb test works, giving me a shell.


The above is probably not the correct fix but it does the job at the moment.



additional info:
stuff from makefile
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f1xx.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/platform.mk
include $(CHIBIOS)/os/hal/boards/STM32F103C8_MINIMAL//board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk


ChibiOS_18.2.0

using gcc toolchain on arch

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: chtime assert bug

Postby Giovanni » Wed Jun 06, 2018 5:30 pm

Hi,

Will look into this. I also moved the other topic in this forum, missed it, sorry.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: chtime assert bug

Postby Giovanni » Sun Jun 10, 2018 11:12 am

Hi,

I believe that is not an error, it is meant to not sign extend because the test is: do not allow addition of intervals larger than systime_t, it is meant to fail. Passing TIME_INFINITE is illegal, this should be probably documented. Is this done elsewhere in the kernel? that would be a bug.

About the makefile part, what are you pointing out there?

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 62 guests