cancel
Showing results for 
Search instead for 
Did you mean: 

strange STVD behaviour

danielfischer9
Associate II
Posted on June 30, 2010 at 05:59

Just to save you some wasted time, I have discouvered a strange STVD behaviour I would like to share with you.

I have compiled and run the ADC application (uses timer and A/D).  I managed to do this using both the Cosmic, and Raisonance toolsets.  I have then made a copy, and started to modify the ADC application.  The original application contains a file called main.c.  For some strange reason, STVD would compile each file, but then decide that the main function in main.c cannot be reached, and create its own infinite loop main.c file, which it would call MAIN.C.  Straingely, my main.c would be in the project, but its MAIN.C would seem to be the one used.  Unless I compile the original application ADC, STVD would always refuse to use my main.c.  Of course, my application, and the original ADC seemed to be IDENTICAL.  Finally, to fix what seems to be a STVD bug, I had to rename main.c to something else, say mainFile.c, and now this mainFile.c is NOT replaced by STVD with the empty main.c

Anyone else has had this experience?

Daniel

2 REPLIES 2
stephane serre_O
Associate II
Posted on June 30, 2010 at 17:32

Hello Daniel,

When you create a workspace/project with STVD, a empty main.c file is created in the Cosmic (or Raisonance) directory. For Cosmic only, the stm8_interrupt_vector.c is also created at this same location. Regarding STM8S-Discovery examples , both these files have been moved to the project src directory (Project/ADC/src). Then you have to specify this new location in STVD. Considering Cosmic compiler,  follow the procedure :

Clic Project>Settings...

Clic the ''Linker'' tab

Change ''Category'' from ''General'' to ''Input''

Check that ''Vector File Name'' point the stm8_interrupt_vector.c file which is at the same location as the right main.c file (..\..\src\stm8_interrupt_vector.c) . if not,  browse it and clic OK. Now your run link your application code instead of main.c file automatically created by the tool.

Hope this help

Best Regards

danielfischer9
Associate II
Posted on June 30, 2010 at 21:29

Hello Stefast,

Thank you for your reply.

I understand that a new workspace results in the creation of a default main.c, however, I used the example and simply created a new project in the same workspace.  I have copied the files from the ADC project, into my new project, and added more code of my own.  STVD started now to complain about the first line in my main function (located in main.c, just as the main function of ADC was), being unreachable, and the editor showed me the default MAIN.C created file.  Strangely, when I enabled show file path in the workspace window, my main.c was being used...  Anyway, I commented out all my added instructions from main.c, until the new project because the same (I think...) as the ADC project, but still, STVD did not like my main.c.  Renaming main.c to mainFile.c solved the problem; I have added back my code, and things seemed to be ok...

I have started to use the Raisonance toolset rather than Cosmic, because interrupts did not seem to be serviced anymore (in my project); I will try to see that Vector File Name option you are suggesting; it was not clear to me how the Cosmic linker would know which handler should be linked to which interrupt vector, the Raisonance code at least has some numbering for handlers (don't know if that is the way it does the linking).

Regards,

Daniel

Daniel