I don't speak any Russian so I will stick to English (or swissGerman :b ) apologizes in advance for any inconvenience. Google/~N~s~A~ (automatic translation) was a big help for navigating/reading through this forum.
I started to play around with scmRTOS, I like the cleanness of the source and the liberal licences, it may be possible to use it in future commercial projects. But right now it is more a private side project to get in touch with C++ bare metal microcontroller programming.
I "ported" scmRTOS to the STM32F3 Discovery Board (based on F4, no fancy Template/Bitband GPIO handling yet) but it didn't work at the beginning, so I switched to the F4 and used the provided sample code (EventFlag). This worked very well as long as I used the included Makefile, but my one configuration (GCC ARM Embedded 4.7 update 2 https://launchpad.net/gcc-arm-embedded, Eclipse 4.3, CDT, GDB HW Debug, OpenOCD 0.7) always made problems. I compared compiler/linker flags and Include paths and so on until I found the problem. The code doesn't work if you set optimization to zero with the -O0 flag.
If you disable the compiler optimization (OPTIMIZE = -O0 Flag) follow errors occur:
1) Error during linking (tested with my own configuration and the makefile provided with scmRTOS)
CODE
--- linking...
./obj/main.o: In function `Pin<(char)68, 15, (char)72, (PinSpeed)3>::SetMode(PinMode)':
C:\xyz\scmrtos-code-581-trunk\Samples\CortexM4F\GCC\STM32F4XX\1-EventFlag/../SamplesCommon/pin_stm32F4xx.h:485: undefined reference to `Pin<(char)68, 15, (char)72, (PinSpeed)3>::BBBits'
C:\xyz\scmrtos-code-581-trunk\Samples\CortexM4F\GCC\STM32F4XX\1-EventFlag/../SamplesCommon/pin_stm32F4xx.h:485: undefined reference to `Pin<(char)68, 15, (char)72, (PinSpeed)3>::BBBits'
C:\xyz\scmrtos-code-581-trunk\Samples\CortexM4F\GCC\STM32F4XX\1-EventFlag/../SamplesCommon/pin_stm32F4xx.h:486: undefined reference to `Pin<(char)68, 15, (char)72, (PinSpeed)3>::BBBits'
C:\xyz\scmrtos-code-581-trunk\Samples\CortexM4F\GCC\STM32F4XX\1-EventFlag/../SamplesCommon/pin_stm32F4xx.h:486: undefined reference to `Pin<(char)68, 15, (char)72, (PinSpeed)3>::BBBits'
./obj/main.o: In function `Pin<(char)68, 15, (char)72, (PinSpeed)3>::SetMode(PinMode)':
C:\xyz\scmrtos-code-581-trunk\Samples\CortexM4F\GCC\STM32F4XX\1-EventFlag/../SamplesCommon/pin_stm32F4xx.h:485: undefined reference to `Pin<(char)68, 15, (char)72, (PinSpeed)3>::BBBits'
C:\xyz\scmrtos-code-581-trunk\Samples\CortexM4F\GCC\STM32F4XX\1-EventFlag/../SamplesCommon/pin_stm32F4xx.h:485: undefined reference to `Pin<(char)68, 15, (char)72, (PinSpeed)3>::BBBits'
C:\xyz\scmrtos-code-581-trunk\Samples\CortexM4F\GCC\STM32F4XX\1-EventFlag/../SamplesCommon/pin_stm32F4xx.h:486: undefined reference to `Pin<(char)68, 15, (char)72, (PinSpeed)3>::BBBits'
C:\xyz\scmrtos-code-581-trunk\Samples\CortexM4F\GCC\STM32F4XX\1-EventFlag/../SamplesCommon/pin_stm32F4xx.h:486: undefined reference to `Pin<(char)68, 15, (char)72, (PinSpeed)3>::BBBits'
This one of multiple similar errors message block, for Pin D15 and D14. As sone as I increase Optimization -O1 or -O3 the code works
2) Program stays in a infinity loop in TKernel::sched() (teseted only with my own configuration for STM32F4 [I disabled all LEDs and use brake points to test the functionality for the F4] and F3 because I haven't setup the openocd debugger for the original scmRTOS makefile)
CODE
do
{
enable_context_switch();
DUMMY_INSTR();
disable_context_switch();
}
while(CurProcPriority != SchedProcPriority); // until context switch done
{
enable_context_switch();
DUMMY_INSTR();
disable_context_switch();
}
while(CurProcPriority != SchedProcPriority); // until context switch done
The program is calling each Process once and than stops to make any context switches. I couldn't nail down the source of the problem

CODE
.bss._ZN2OS6KernelE
0x20002f14 0x14 ./scmRTOS/Common/OS_Kernel.o
0x20002f14 OS::Kernel
0x20002f14 0x14 ./scmRTOS/Common/OS_Kernel.o
0x20002f14 OS::Kernel
As soon as I increase the Optimization Level back to -O3 both errors as gone and scmRTOS is working with my configuration and the original scmRTOS makefile.
I know I'm not a big help here. First -O0 optimization level is more a theoretical setting but it may point to a time critical code section which may can be triggered by a bad cache flushing/interrupt occurrence. Any suggestion is highly appreciated.
Second I need to go back to school to get my C programming brain ready for Object Oriented Programming. Implementations like TCritSect cs; is just neat, no room for errors, simple to understand.
Greetings
Jonathan
PS:
My configuration: Windows 7, Eclipse Kepler with CDT, GDB HW Debug, GNU ARM CDT support and EmbSys Register View Plugin, OpenOCD 0.7 as gdb server, GCC ARM Embedded 4.7 update 2 (4.7 2013q2) from launchpad, STM32F3/F4 Development board, EventFlag Sample Code, FPU activated in HW and sometimes in SW (#define PROC1_FPA)