Skip to main content
Visitor II
February 15, 2010
Question

ST Link Command Line Programming

  • February 15, 2010
  • 2 replies
  • 2500 views
Posted on February 15, 2010 at 02:23

ST Link Command Line Programming

    This topic has been closed for replies.

    2 replies

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:07

    In the absence of any ST documentation, I've been digging around in the ST tools installation to find some way of programming and running applications built by Makefiles. The best I can come up with so far is:

    * Launch STVP and reprogram device

    * Launch GDB7 and start the program running

    Unfortunately the act of running GDB7 and connecting via Swim breaks the USB connection in STVP. To run another application you therefore have to close down and reopen STVP. This is a pretty slow development workflow, but I can't see any other way of working with makefile-built applications.

    For those interested, the steps required to start the device running using GDB are as follows (applies to STM8S-Discovery):

    gdb7.exe --command=gdbswim_stlink.ini

    emulator-reset-port-mcu usb://usb stm8s105c6

    run

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:07

    Hi Kelvin,

    you can use STVP programming toolkit to programm mcu from command line.

    http://www.st.com/stonline/products/support/micro/files/um0151.exe

    http://www.st.com/stonline/books/pdf/docs/11472.pdf

    Command line for STM8S-Discovery:

    APISample.exe -BoardName=ST-LINK -Device=STM8S105x6 -Port=USB -ProgMode=SWIM -no_loop -no_log -FileProg=myProg.s19 -FileOption=myOption.hex

    To restart mcu after programming type

    gdb7.exe --quiet --command=restart_mcu.ini

    Content of restart_mcu.ini

    <-----------schnipp------------->

    #

    # define emulator reset port and MCU

    #

    define emulator-reset-port-mcu

    target gdi -dll swim\stm_swim.dll -stlink3 -port $arg0 -mcuname $arg1

    mcuname -set $arg1

    end

    #

    # reset command and quit

    #

    emulator-reset-port-mcu usb://usb stm8s105c6

    quit

    <-----------schnapp------------->

    Regards,

    Stefan