2013-10-24 12:18 PM
Hello,
I am new to developing on an STM32L. I'm using IAR Workbench to compile for it using FreeRTOS. I don't seem to be able to be able to get it running using any of the C/C++ functions. I can build a simple task and it runs fine, but if I simply include <string.h> without even declaring any variables, the software compiles, but it hang before reaching main. Do I have to supply a CRT of my own, or is there something else I may be doing wrong? #stm322013-10-25 12:28 AM
I think you could help us by posting an example. Include string.h does not bring anything new so compiler should not generate anything more in binary code than without that include.
2013-10-25 02:53 AM
Do I have to supply a CRT of my own, or is there something else I may be doing wrong?
The IDE usually does link in an appropriate startup file automatically, mostly in the form of a asm file. Don't know how IAR does it, just check your project settings. You may configure the debugger to stop at the reset vector, and not at main when debugging. You can then step through your init process. But be aware that C++ projects usually need other startup code than C projects. One important point here is the additional ctor/dtor initialization code. Thus, adding C++ files to a project wizard-generated as ''C'' will not work.2013-10-25 04:48 AM
Thanks. Here's what I can reduce it to:
#include ''FreeRTOS_Kernel.h''
#include ''do_something.h'' void main(void) { xTaskCreate( do_something, (signed char*)''do_something'', configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, NULL ); vTaskStartScheduler(); for( ;; ); } #ifndef do_something_h_included #define do_something_h_included void do_something( void* p ); #endif #include ''do_something.h'' #include <string.h> void do_something( void* p ) { for ( ;; ); } If I compile and link do_something.o and main.o, main never gets called.2013-10-25 04:50 AM
Thanks! I am linking in a file called startup_stm32l1xx_md.s. I assume that contains the basic C runtime as well?
2013-10-25 05:06 AM
I am linking in a file called startup_stm32l1xx_md.s. I assume that contains the basic C runtime as well?
It does not, it calls __iar_program_start, at least the IAR variant should.