реклама на сайте
подробности

 
 
> STM32F4/F3 Discovery getting started problems, compilation error and dead end
devnow
сообщение Sep 14 2013, 19:01
Сообщение #1





Группа: Новичок
Сообщений: 2
Регистрация: 14-09-13
Пользователь №: 78 317



First of all hi all together,
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'

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

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 sad.gif, I increased the Stack size for each Process (including Idle) to 2KByte but the problem remains. SchedProcPriority is in Register r3 for comparing with r2 (CurProcPriority). r2 has a value of 0 and r3 has a value of 0x20002f14 which looks more like a address to the RAM. Checking the map file it is indeed in the OS::Kernel Object.
CODE
.bss._ZN2OS6KernelE
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)
Go to the top of the page
 
+Quote Post
 
Start new topic
Ответов
devnow
сообщение Sep 15 2013, 10:08
Сообщение #2





Группа: Новичок
Сообщений: 2
Регистрация: 14-09-13
Пользователь №: 78 317



Thanks for the information Anton, I need to dig a little deeper into the GNU GCC optimization and the scmRTOS inline code.

In brief for other users:
Don't use Optimization Level None -O0
I successfully run scmRTOS on STM32F3 and F4 (both Cortex M4F) with Optimization Level -O1 to -O3

Link to the same problem for other ports (AVR):
http://electronix.ru/forum/lofiversion/index.php/t47036.html

Is it possible to change the name of the Topic to Solved/отвя́занный? sm.gif : ... I haven't found the Edit Button for the Topic.

Thanks
Go to the top of the page
 
+Quote Post

Сообщений в этой теме


Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 18th June 2025 - 22:33
Рейтинг@Mail.ru


Страница сгенерированна за 0.01373 секунд с 7
ELECTRONIX ©2004-2016