Re: SMT32G474- i2cAcquireBus not getting Mutex when built with -O0 compiler option
Posted: Wed Nov 16, 2022 12:55 pm
Thank you Giovanni,
I increased the process stack size to 0xD00 and the code managed to proceed much further.
After that I started seeing a stack overflow in dbg_panic_msg. At that point an LED blinker thread was reporting 0 StkUnused. After doubling it's working area to 256 things seemed to start working again.
I'm not sure that I have gone through the process of checking for stack overflows properly. Is there a guide to this somewhere in the documentation?
All I have done is run the .elf executable and paused it to check the chibios debug view and make sure StkUnused was greater than 0 for all threads.
I'm not sure though how much spare room I have on the stacks after increasing the stack sizes, Is StkUnused in the Chibios debug view the best way to monitor this?
From what I can see all the remaining ram after the stacks are allocated is allocated to the heap but is it possible to work out how much of the allocated heap space is actually used or available when chibios is running?
Finally in the STM32CubeIDE build analyzer the used memory for ram0 shows 128KB which corresponds with 100% for the STM32G474. The same used memory of 128KB appears for both ram1 and ram2 although only 96KB and 80KB are available for those spaces. All usages of 100%, 133.33% and 160% are highlighted red. I imagine this is because ram1 & ram2 are sub-parts of ram0 as all have a start address of 0x20000000. I just wanted to check that this is OK because it is somewhat confusing when you might expect all reported usage %'s to be less than or equal to 100%?
I increased the process stack size to 0xD00 and the code managed to proceed much further.
After that I started seeing a stack overflow in dbg_panic_msg. At that point an LED blinker thread was reporting 0 StkUnused. After doubling it's working area to 256 things seemed to start working again.
I'm not sure that I have gone through the process of checking for stack overflows properly. Is there a guide to this somewhere in the documentation?
All I have done is run the .elf executable and paused it to check the chibios debug view and make sure StkUnused was greater than 0 for all threads.
I'm not sure though how much spare room I have on the stacks after increasing the stack sizes, Is StkUnused in the Chibios debug view the best way to monitor this?
From what I can see all the remaining ram after the stacks are allocated is allocated to the heap but is it possible to work out how much of the allocated heap space is actually used or available when chibios is running?
Finally in the STM32CubeIDE build analyzer the used memory for ram0 shows 128KB which corresponds with 100% for the STM32G474. The same used memory of 128KB appears for both ram1 and ram2 although only 96KB and 80KB are available for those spaces. All usages of 100%, 133.33% and 160% are highlighted red. I imagine this is because ram1 & ram2 are sub-parts of ram0 as all have a start address of 0x20000000. I just wanted to check that this is OK because it is somewhat confusing when you might expect all reported usage %'s to be less than or equal to 100%?