debug attempt immediately sends me to HardFaultHandler() even before reaching main()'s first line. But without debugging board works very well. USB interaction works properly. I'd be very much obliged if one could assist me around this issue. CPU is STM32F102C8T6.
May I also clear up a couple of issues related to using Shell. 1) I provide Shell thread with (1024 * 3) bytes. I've no idea how to estimate if it's enough or not. 2) I failed to find any description if chThdTerminated(). After what event/events does shell terminate? If it doesn't could I use shellCreateStatic() instead?
I don't think it is related to that problem. Do you work under windows? if so you could try ChibiStudio which is pre-configured with all required tools.
About your questions:
1) There is a debug plugin for Eclipse that is able to report the used stack size for each thread. There is also an option to fill the thread stacks with a pattern, you can then determine usage by inspecting memory (it is what the debugger plugin does automatically).
2) When a shell terminates it signals the event source "shell_terminated", you can listen for the event. After the event is detected do a chThdWait() on the shell thread reference in order to release the memory allocated to the thread. The Win32/Posix simulators have an example of this in main.c if I remember well.