Setting up the Arduino IDE
Step 1: If you are completely new to the Arduino Environment, Download Arduino based on your operating system and install it.
https://www.arduino.cc/en/software

Step 2: Follow File -> Preferences to open the preferences window and paste the link given below into the additional boards manage URL text box and click on OK.
https://github.com/tenbaht/sduino/raw/master/package_sduino_stm8_index.json


Step 3: Follow Tools -> Board -> Board manager to open the board manager dialog box and search for “stm”. Click on install and close the dialog box after the installation is completed.


Step 4: Restart the IDE and then follow Tools -> Board -> STM8S105C6. You can select other boards if you have a different development board

I am having the below board with me (for this board you don’t require separate programmer ) but you need to follow below steps carefully else you will get below error !
‘could not open USB device’


Install Zadig

If you have not installed zadig, you need to install this.
You can download from here.
Zadig allows you to mix and match your hardware with a particullar driver: WinUSB, libusb, libusb-win32 or libusbK. If you used RTL SDR or any other open sourced project involving USB driver which need a special driver that has API supported by your USB hardware, you might already have this utility on your PC or Laptop. You can skip this step if you have done so.
you should look into device manager in universal serial bus devices(USB)

Click on the options and select as below:

Now as we have seen in device manager in USB (STM32 STLink) select the same option and install driver.

Now select example you want to execute

Click on upload button and It should compile and upload:

For others STM Boards you may follow below steps:
Now for programming other stm board e.g. STM8S103F3 Development Board. we need to set up the board, connect it to the computer, and program for a simple LED blink.
Setting up the STM8S103F3 board for Arduino IDE Programming
Connect the ST-Link V2 with the development board as shown below.

The connections are pretty straight forward and the best part is you need no external components. My hardware setup for programming is shown below, I have just used the female header wires to make my connection. However, do note that the pinout of your ST-Link might differ from mine, make sure to follow the pinout on the device before making the connections.

Make the connection and connect the device to your computer, the driver installation should begin automatically. You can use the device manager to ensure if your computer has discovered ST-LINK V2 correctly. You will also notice the test LED on the board blinking if this is the first time powering the board.
LED Blinking on STM8S103F3 using Arduino
Now for a simple LED blinking, we can use the blink program from the example section. Follow File -> Example -> Generic_Example -> Basics -> Blink.

To upload the program, make sure your board is connected via st-link v2 as discussed above and select the programmer as “ST-Link/V2” as shown below.

Note: Unlike Arduino boards, you do not have to select the right COM port for programming the board. You will use the COM port only for serial communication.
Once the COM port is selected, uploading the code is also very simple. Just press the upload button (encircled in red below) and the code will get compiled and uploaded to our board automatically.

That is it, the program is uploaded directly to the board and you should see the on-board LED blinking. No external uploading software, no nothing. As easy as that.
Led should blink like below