Is the USB connected to an host?
Giovanni
strange behavior of the scheduler on STM32F070 Topic is solved
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: strange behavior of the scheduler on STM32F070
Then it is likely related to USB, probably the simple code you shown is not relevant to the problem.
Giovanni
Giovanni
Re: strange behavior of the scheduler on STM32F070
yes, it seems to USB-related, but the chThdSleepMillisecond() also has an impact
for example, this code works fine
moreover, commands are correctly received and sent over USB-serial.
more complex code works fine (with SPI and PWM blocks enabled)
but as soon as I insert chThdSleepMillisecond(), I get a system crash
for example, this code works fine
Code: Select all
while (true)
{
uint8_t rxbyte = streamGet(&SDU1);
}
moreover, commands are correctly received and sent over USB-serial.
more complex code works fine (with SPI and PWM blocks enabled)
but as soon as I insert chThdSleepMillisecond(), I get a system crash
Re: strange behavior of the scheduler on STM32F070
arm-none-eabi-gcc.exe (GNU Tools for Arm Embedded Processors 7-2018-q2-update) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
btw, with disabled optimizations (-O0) it works
Now I will find a module that is incorrectly compiled
Re: strange behavior of the scheduler on STM32F070
I haven't looked at this issue in detail sorry. But have you considered placing a hardware memory watchpoint in a strategic location to catch the culprit in action?
Re: strange behavior of the scheduler on STM32F070
disabling of optimization for the os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.c seems to have completely solved the problem.
hmm... faisal, I don't know where is this strategic location. empty readylist is normal situation, but chSchDoReschedule() call should be blocked by chSchIsPreemptionRequired()
in this case chSchDoReschedule() is in some fantastic way called bypassing conditions
besides, I don't really understand how context switching happens
in addition, the cortex-m0 has very limited debugging facilities. I could not even set a memory breakpoint with write condition
hmm... faisal, I don't know where is this strategic location. empty readylist is normal situation, but chSchDoReschedule() call should be blocked by chSchIsPreemptionRequired()
in this case chSchDoReschedule() is in some fantastic way called bypassing conditions
besides, I don't really understand how context switching happens
in addition, the cortex-m0 has very limited debugging facilities. I could not even set a memory breakpoint with write condition
Re: strange behavior of the scheduler on STM32F070
as I expected, the function ST_HANDLER is incorrectly optimized. Unfortunately, gcc does not allow switching the optimization inside the function.
going to deeply learn ARM assembler
going to deeply learn ARM assembler
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: strange behavior of the scheduler on STM32F070
Yes, GCC allows to optimize the single function, look into the manual, it is one of the __attribute__ of functions.
Strange anyway, I never experienced it, you could return to one of the 6.x versions, it would also be a good idea to report it.
Could you explain the problem? just to make sure it is not a problem in OUR code.
Giovanni
Strange anyway, I never experienced it, you could return to one of the 6.x versions, it would also be a good idea to report it.
Could you explain the problem? just to make sure it is not a problem in OUR code.
Giovanni
Who is online
Users browsing this forum: No registered users and 36 guests