stm32f103vct6 freeze after chThdSleepMilliseconds() - IAR
Moderators: RoccoMarco, lbednarz, tfAteba
-
DrunkenDonkey
- Posts: 124
- Joined: Sun Aug 28, 2011 5:16 pm
Re: stm32f103vct6 freeze after chThdSleepMilliseconds() - IA
//on a related note, if you move to Eclipse, you can use Giovanni's great plugin to monitor every thread stack usage to see problems like that, also tweak the stacks size to get the max out of the available memory.
- DeusExMachina
- Posts: 223
- Joined: Tue Apr 03, 2012 5:08 am
- Has thanked: 3 times
- Been thanked: 3 times
Re: stm32f103vct6 freeze after chThdSleepMilliseconds() - IA
I changed all options to TRUE in chconf.h but and recompiled project. But this doesn't help. There were not any warnings or panic messages. chDbgCheckClassS() in debugger executes successfully.
Also I take original project ARMCM3-STM32F103 for IAR without any modifications (only select ST-link in options) - and there was the same problem (with enabled debugging options too). So, I think it's time to move to Eclipse
Also I take original project ARMCM3-STM32F103 for IAR without any modifications (only select ST-link in options) - and there was the same problem (with enabled debugging options too). So, I think it's time to move to Eclipse
- DeusExMachina
- Posts: 223
- Joined: Tue Apr 03, 2012 5:08 am
- Has thanked: 3 times
- Been thanked: 3 times
Re: stm32f103vct6 freeze after chThdSleepMilliseconds() - IA
After all i moved to eclipse cdt + code sourcery + atolic gdb + chibios plugin.
Demo STM32-Discovery works well. Debuggung is OK.
Unfortunatelly STM32F103 demo doesn't work. Even before execution debugger stops at
more over, after this ST-LINK_gdbserver.exe crashes
changes i've made in project files:
1. in makefile changed STM32F103xB.ld to LDSCRIPT= $(PORTLD)/STM32F103xC.ld
2 in board.h i've changed STM32F10X_MD to STM32F10X_HD
Demo STM32-Discovery works well. Debuggung is OK.
Unfortunatelly STM32F103 demo doesn't work. Even before execution debugger stops at
Code: Select all
2 __main_stack_base__() 0x20000004
__main_stack_base__:
20000000: andcs r4, r0, r0
20000004: andcs r0, r0, r5, lsr #2 << exectution cursormore over, after this ST-LINK_gdbserver.exe crashes
changes i've made in project files:
1. in makefile changed STM32F103xB.ld to LDSCRIPT= $(PORTLD)/STM32F103xC.ld
2 in board.h i've changed STM32F10X_MD to STM32F10X_HD
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: stm32f103vct6 freeze after chThdSleepMilliseconds() - IA
I think you forgot "jump ResetHandler" in the debug configuration:
http://www.chibios.org/dokuwiki/doku.ph ... figuration
Giovanni
http://www.chibios.org/dokuwiki/doku.ph ... figuration
Giovanni
- DeusExMachina
- Posts: 223
- Joined: Tue Apr 03, 2012 5:08 am
- Has thanked: 3 times
- Been thanked: 3 times
Re: stm32f103vct6 freeze after chThdSleepMilliseconds() - IA
I configured Eclipse right according this article. Jump is in place 
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: stm32f103vct6 freeze after chThdSleepMilliseconds() - IA
No idea, it works for me.
Verify that STM32F103xC.ld does not contain any errors, it is not provided with the OS so I assume you added it.
Giovanni
Verify that STM32F103xC.ld does not contain any errors, it is not provided with the OS so I assume you added it.
Giovanni
- DeusExMachina
- Posts: 223
- Joined: Tue Apr 03, 2012 5:08 am
- Has thanked: 3 times
- Been thanked: 3 times
Re: stm32f103vct6 freeze after chThdSleepMilliseconds() - IA
Finally i got overflow in main thread:

After all i can flash and debug MCU using stm32F100-Discovery demo. I changed MCU type to STM32F10X_HD in board.h
I have created ST32F103xC.ld using ST32F107xC.ld
Where I should enlarge stack size? In linker script?

After all i can flash and debug MCU using stm32F100-Discovery demo. I changed MCU type to STM32F10X_HD in board.h
I have created ST32F103xC.ld using ST32F107xC.ld
Code: Select all
/*
* ST32F103xC memory setup.
*/
__main_stack_size__ = 0x0400;
__process_stack_size__ = 0x0400;
MEMORY
{
flash : org = 0x08000000, len = 256k
ram : org = 0x20000000, len = 48k
}Where I should enlarge stack size? In linker script?
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: stm32f103vct6 freeze after chThdSleepMilliseconds() - IA
The stack of the main() thread is defined by __process_stack_size__ but the default is 1KB, I don't think it can't overflow in the standard demo unless you added something in the main().
Giovanni
Giovanni
- DeusExMachina
- Posts: 223
- Joined: Tue Apr 03, 2012 5:08 am
- Has thanked: 3 times
- Been thanked: 3 times
Re: stm32f103vct6 freeze after chThdSleepMilliseconds() - IA
contents of main() is stripped.
http://pastebin.ru/kzVYsEhg
I found that main stack overflows just after chSysInit() function call.
Even when i comment halInit() i got the same problem on chSysInit()
http://pastebin.ru/kzVYsEhg
I found that main stack overflows just after chSysInit() function call.
Even when i comment halInit() i got the same problem on chSysInit()
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: stm32f103vct6 freeze after chThdSleepMilliseconds() - IA
It is possible it is an HW problem, is the STM32 configured to run from Flash? it looks like it jumps on RAM after reset.
Giovanni
Giovanni