cancel
Showing results for 
Search instead for 
Did you mean: 

RUN command in STVD doesn`t work

Ivan Berton
Associate II
Posted on February 26, 2017 at 10:17

Hi

I`m new with the STM8S-Discovery and the STM8S105.

I usually write my code in assembler so I get a deeper touch on the micros hardware.

But I encountered an issue with the STVD tool.

When I`m entering the debug mode and push the RUN button I can see

the red LED next to the USB connector blinking. But the simple code does not work.

The code should make the green LED blinking, but it doesn`t.

I can`t see any error message or other info.

But when I set the cursor on the first command(bset) of the code with SET PC(Debug menu)

and then select CONTINUE(Debug menu) the programm works. The green LED flashes correctly

until I stop the programm.

I can read out the code with STVP, so the micro is flashed.

But the programm does not work after unplug and replug the USB connector.

What I use:

ST Visual Develop 4.3.10

Windows 10

STM8S-Discovery (STM8S105C6)

Debeug instrument: SWIM ST-Link

The code looks like this:

--------------------------------------------------------

stm8/

               segment 'rom'

start

               bset         $5011,#0

loop_forever

               ldw           X,#$FFFF

loop_delay

               nop

               decw X

               jrne         loop_delay

               bcpl        $500F,#0

               jra           loop_forever

               end

--------------------------------------------------------

Something wrong with my handling of the STVD or micro initialising?

Thanks for any help

Ivan

4 REPLIES 4
Max
ST Employee
Posted on February 27, 2017 at 08:17

Hello,

Did you setup you interrupt vector table correctly?

I am talking specifically about the reset vector: it should be pointing to your start label.

BR

Max

Posted on February 28, 2017 at 13:02

 ,

 ,

Hi Max

Thanks for reply. I used legacy ST62 micros until now. Like I said I write my code in assembler. With the ST62 I used a text file mycode.asm and compiled it with ast6.exe to get the mycode.hex which I sent to the ST62 with the programmer.

Set up the reset vector for ST62 usually looks like this

-----------------------------------------------------------------------------------------------------------

.org 0080h

start , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,,main prog

.org 0ff0h

 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,,some other vectors

.org 0ffch

jp , , ,nmi_int  , , , , , , , , , , , , , , , , , , , , , ,,interrupt vector

jp , , ,start , , , , , , , , , , , , , , , , , , , , , , , , , , ,,reset vector pointed to the start of the program

.end

-----------------------------------------------------------------------------------------------------------

Now I use STVD and I`m not familiar with.

There is an automatic generated mapping.asm file which contains the info where to place the reset vector.

-----------------------------------------------------------------------------------------------------------

stm8/

,------------------------------------------------------

 ,

, SEGMENT MAPPING FILE AUTOMATICALLY GENERATED BY STVD

 ,

, SHOULD NOT BE MANUALLY MODIFIED.

 ,

, CHANGES WILL BE LOST WHEN FILE IS REGENERATED.

 ,

,------------------------------------------------------

 ,

♯ include 'mapping.inc'

BYTES , The following addresses are 8 bits long

 ,

segment byte at ram0_segment_start-ram0_segment_end 'ram0'

WORDS , The following addresses are 16 bits long

 ,

segment byte at ram1_segment_start-ram1_segment_end 'ram1'

WORDS , The following addresses are 16 bits long

 ,

segment byte at stack_segment_start-stack_segment_end 'stack'

WORDS , The following addresses are 16 bits long

 ,

segment byte at 4000-43FF 'eeprom'

WORDS , The following addresses are 16 bits long

 ,

segment byte at 8080-FFFF 'rom'

WORDS , The following addresses are 16 bits long

 ,

segment byte at 8000-807F 'vectit'

END

-----------------------------------------------------------------------------------------------------------

So what I have to do now? Place

 , , ,

 , , ,segment , , ,

'vectit'

 , , , , , , , , ,jp , , ,start

into my main program?

I found in the documentation INT as command to use instead of JP , but INT it`s not recognized as a valid comand by STVD.

Thanks for any help.

Max
ST Employee
Posted on March 01, 2017 at 07:50

Can you understand C language?

STM8 has many examples and libraries written in C, but not much in assembly.

If you can understand C, it will probably simplify your life a lot...

This was not the case with ST6: its core was not good for C compiler efficiency and most development work was done in assembler.

If C is an option for you,

http://cosmicsoftware.com/download_stm8_free.php

as a version free of charge for STM8 and use the

http://www.st.com/en/embedded-software/stsw-stm8069.html

either in your application or as example.

Otherwise, look at this site 

http://stm8sdiscovery.nano-age.co.uk/home

 : it shows a very simple start using the assembler.

Look at the Revenge of the blinking LED, it includes the interrupt vectors the way they should be for STM8

Posted on March 01, 2017 at 13:08

Thanks for the info. I used the vector table from 'the blinking led' page. It works now.