Menu

OpenOCD reset and flash issues w/ STM8L Discovery

Logan
2017-08-17
2017-08-20
  • Logan

    Logan - 2017-08-17

    It looks like I'm having some trouble using my STM8L Discovery board with OpenOCD. Note that I am using the onboard ST-Link that is built into the development board.

    Environment is running in Cygwin64.

    Issue #1: Problems with reset

    Starting up with "reset halt" fails:

    $ openocd -f interface/stlink-v2.cfg -f target/stm8l152.cfg -c "init" -c "reset halt"
    Open On-Chip Debugger 0.10.0
    Licensed under GNU GPL v2
    For bug reports, read
            http://openocd.org/doc/doxygen/bugs.html
    adapter speed: RCLK - adaptive
    srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
    Info : Unable to match requested speed 0 kHz, using 5 kHz
    Info : Unable to match requested speed 0 kHz, using 5 kHz
    Info : RCLK (adaptive clock speed) not supported - fallback to 5 kHz
    Info : STLINK v2 JTAG v0 API v1 SWIM v6 VID 0x0483 PID 0x3748
    Info : using stlink api v1
    TARGET: stm8.cpu - Not halted
    in procedure 'reset'
    in procedure 'ocd_bouncer'
    

    However, I can make a connection if I omit "reset halt":

    $ openocd -f interface/stlink-v2.cfg -f target/stm8l152.cfg -c "init"
    Open On-Chip Debugger 0.10.0
    Licensed under GNU GPL v2
    For bug reports, read
            http://openocd.org/doc/doxygen/bugs.html
    adapter speed: RCLK - adaptive
    srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
    Info : Unable to match requested speed 0 kHz, using 5 kHz
    Info : Unable to match requested speed 0 kHz, using 5 kHz
    Info : RCLK (adaptive clock speed) not supported - fallback to 5 kHz
    Info : STLINK v2 JTAG v0 API v1 SWIM v6 VID 0x0483 PID 0x3748
    Info : using stlink api v1
    

    Upon connecting via telnet, this is the result of attempting a "reset" and a "reset halt":

    $ telnet localhost 4444
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    Open On-Chip Debugger
    > targets
        TargetName         Type       Endian TapName            State
    --  ------------------ ---------- ------ ------------------ ------------
     0* stm8.cpu           stm8       big    stm8.cpu           halted
    > reset
    Polling target stm8.cpu failed, trying to reexamine
    trying to reconnect
    target halted due to undefined, pc: 0x00006000
    > reset halt
    TARGET: stm8.cpu - Not halted
    in procedure 'reset'
    in procedure 'ocd_bouncer'
    
    Polling target stm8.cpu failed, trying to reexamine
    trying to reconnect
    target halted due to debug-request, pc: 0x00006000
    >
    

    It looks like the board is physically resetting every time reset is called, so that part is working at least.

    Issue 2: Problems with flash

    All flash commands fail:

    >
    >
    > flash info 0
    invalid subcommand "info 0"
    in procedure 'flash'
    > flash probe
    invalid subcommand "probe"
    in procedure 'flash'
    > flash
    flash
      flash bank bank_id driver_name base_address size_bytes chip_width_bytes
                bus_width_bytes target [driver_options ...]
      flash banks
      flash init
      flash list
    gdb_flash_program ('enable'|'disable')
    mflash
      mflash bank soc_type base_addr pin_id target
      mflash init
    nand
    program <filename> [address] [verify] [reset] [exit]
      stm8 enable_stm8l [1/0]
        stm8.cpu stm8 enable_stm8l [1/0]
    flash : command requires more arguments
    in procedure 'flash'
    > program blinky.ihx
    TARGET: stm8.cpu - Not halted
    in procedure 'program'
    in procedure 'reset' called at file "embedded:startup.tcl", line 500
    in procedure 'ocd_bouncer'
    
    embedded:startup.tcl:476: Error: ** Unable to reset target **
    in procedure 'program'
    in procedure 'program_error' called at file "embedded:startup.tcl", line 501
    at file "embedded:startup.tcl", line 476
    Polling target stm8.cpu failed, trying to reexamine
    trying to reconnect
    target halted due to debug-request, pc: 0x00006000
    

    Any suggestions?

     

    Last edit: Logan 2017-08-17
    • akre

      akre - 2017-08-18

      Hello and thanks for your interest in the stm8 binutils project.

      For the first issue I just ran the same command line on my stm8l152 discovery board with built in stlink without problems. I would need a debug log (i.e. use -d3 flag on command line) to be able to do further analysis. I do how ever know if you already have some code on the chip running it could prevent proper swim entry. Try change your stm8.cfg file and remove the last comment to enable "connect under reset" : reset_config srst_nogate connect_assert_srst

      For the second issue, the stm8 openocd target driver does not have the regular "flash" commands. Just download or flash with openocd command "load_image" or with gdb command "load"

       
      • akre

        akre - 2017-08-18

        I meant of course uncomment the last line in stm8.cfg to enable connect under reset.

         
  • Logan

    Logan - 2017-08-18

    Result of running command again with -d3 flag added:

    $ openocd -f interface/stlink-v2.cfg -f target/stm8l152.cfg -c "init" -c "reset halt" -d3
    Open On-Chip Debugger 0.10.0
    Licensed under GNU GPL v2
    For bug reports, read
            http://openocd.org/doc/doxygen/bugs.html
    User : 13 1 command.c:544 command_print(): debug_level: 3
    Debug: 14 1 options.c:181 add_default_dirs(): bindir=/usr/local/bin
    Debug: 15 1 options.c:182 add_default_dirs(): pkgdatadir=/usr/local/share/openocd
    Debug: 16 1 options.c:183 add_default_dirs(): exepath=/usr/local/bin
    Debug: 17 1 options.c:184 add_default_dirs(): bin2data=../share/openocd
    Debug: 18 1 configuration.c:42 add_script_search_dir(): adding /home/Logan/.openocd
    Debug: 19 1 configuration.c:42 add_script_search_dir(): adding /usr/local/bin/../share/openocd/site
    Debug: 20 1 configuration.c:42 add_script_search_dir(): adding /usr/local/bin/../share/openocd/scripts
    Debug: 21 2 configuration.c:82 find_file(): found /usr/local/bin/../share/openocd/scripts/interface/stlink-v2.cfg
    Debug: 22 2 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_interface hla
    Debug: 23 2 command.c:143 script_debug(): command - interface ocd_interface hla
    Debug: 25 2 command.c:364 register_command_handler(): registering 'ocd_hla_device_desc'...
    Debug: 26 2 command.c:364 register_command_handler(): registering 'ocd_hla_serial'...
    Debug: 27 2 command.c:364 register_command_handler(): registering 'ocd_hla_layout'...
    Debug: 28 2 command.c:364 register_command_handler(): registering 'ocd_hla_vid_pid'...
    Debug: 29 2 command.c:364 register_command_handler(): registering 'ocd_hla_command'...
    Debug: 30 2 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla_layout stlink
    Debug: 31 2 command.c:143 script_debug(): command - hla_layout ocd_hla_layout stlink
    Debug: 33 3 hla_interface.c:239 hl_interface_handle_layout_command(): hl_interface_handle_layout_command
    Debug: 34 3 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla_device_desc ST-LINK/V2
    Debug: 35 3 command.c:143 script_debug(): command - hla_device_desc ocd_hla_device_desc ST-LINK/V2
    Debug: 37 3 hla_interface.c:213 hl_interface_handle_device_desc_command(): hl_interface_handle_device_desc_command
    Debug: 38 3 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla_vid_pid 0x0483 0x3748
    Debug: 39 3 command.c:143 script_debug(): command - hla_vid_pid ocd_hla_vid_pid 0x0483 0x3748
    Debug: 41 3 hla_interface.c:267 hl_interface_handle_vid_pid_command(): hl_interface_handle_vid_pid_command
    Debug: 42 3 configuration.c:82 find_file(): found /usr/local/bin/../share/openocd/scripts/target/stm8l152.cfg
    Debug: 43 4 configuration.c:82 find_file(): found /usr/local/bin/../share/openocd/scripts/target/stm8.cfg
    Debug: 44 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select stlink_swim
    Debug: 45 4 command.c:143 script_debug(): command - ocd_transport ocd_transport select stlink_swim
    Debug: 46 4 hla_transport.c:191 hl_transport_select(): hl_transport_select
    Debug: 47 4 command.c:364 register_command_handler(): registering 'ocd_hla'...
    Debug: 48 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 49 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 50 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 51 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 52 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 53 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 54 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 55 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 56 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 57 4 command.c:364 register_command_handler(): registering 'ocd_jtag_ntrst_delay'...
    Debug: 58 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla newtap stm8 cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0
    Debug: 59 5 command.c:143 script_debug(): command - ocd_hla ocd_hla newtap stm8 cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0
    Debug: 60 5 hla_tcl.c:116 jim_hl_newtap_cmd(): Creating New Tap, Chip: stm8, Tap: cpu, Dotted: stm8.cpu, 8 params
    Debug: 61 5 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -irlen
    Debug: 62 5 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -ircapture
    Debug: 63 5 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -irmask
    Debug: 64 5 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -expected-id
    Debug: 65 5 core.c:1304 jtag_tap_init(): Created Tap: stm8.cpu @ abs position 0, irlen 0, capture: 0x0 mask: 0x0
    Debug: 66 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target create stm8.cpu stm8 -chain-position stm8.cpu
    Debug: 67 5 command.c:143 script_debug(): command - ocd_target ocd_target create stm8.cpu stm8 -chain-position stm8.cpu
    Debug: 68 5 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 69 5 command.c:364 register_command_handler(): registering 'ocd_stm8'...
    Debug: 70 5 command.c:364 register_command_handler(): registering 'ocd_stm8'...
    Debug: 71 5 stm8.c:1115 stm8_target_create(): stm8_target_create
    Debug: 72 5 stm8.c:440 stm8_configure_break_unit(): hw breakpoints: numinst 2 numdata 2
    Debug: 73 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 74 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 75 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 76 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 77 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 78 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 79 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 80 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 81 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 82 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 83 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 84 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 85 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 86 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 87 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 88 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 89 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 90 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 91 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 92 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 93 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 94 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 95 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 96 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 97 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -work-area-phys 0x0 -work-area-size 0x400 -work-area-backup 1
    Debug: 98 6 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -work-area-phys 0x0 -work-area-size 0x400 -work-area-backup 1
    Debug: 99 6 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 100 6 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 101 6 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 102 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -flashstart 0x8000 -flashend 0xffff -eepromstart 0x1000 -eepromend 0x13ff -optionstart 0x4800 -optionend 0x487f -blocksize 0x80
    Debug: 103 6 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -flashstart 0x8000 -flashend 0xffff -eepromstart 0x1000 -eepromend 0x13ff -optionstart 0x4800 -optionend 0x487f -blocksize 0x80
    Debug: 104 6 stm8.c:1945 stm8_jim_configure(): stm8_jim_configure flashstart=00008000
    Debug: 105 6 stm8.c:1964 stm8_jim_configure(): stm8_jim_configure flashend=0000ffff
    Debug: 106 6 stm8.c:1983 stm8_jim_configure(): stm8_jim_configure eepromstart=00001000
    Debug: 107 6 stm8.c:2002 stm8_jim_configure(): stm8_jim_configure eepromend=000013ff
    Debug: 108 6 stm8.c:2021 stm8_jim_configure(): stm8_jim_configure optionstart=00004800
    Debug: 109 6 stm8.c:2040 stm8_jim_configure(): stm8_jim_configure optionend=0000487f
    Debug: 110 6 stm8.c:1926 stm8_jim_configure(): stm8_jim_configure blocksize=00000080
    Debug: 111 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -enable_stm8l
    Debug: 112 6 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -enable_stm8l
    Debug: 113 6 stm8.c:2058 stm8_jim_configure(): stm8_jim_configure enable_stm8l=00000001
    Debug: 114 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_adapter_khz 0
    Debug: 115 6 command.c:143 script_debug(): command - adapter_khz ocd_adapter_khz 0
    Debug: 117 6 core.c:1631 jtag_config_khz(): handle jtag khz
    Debug: 118 6 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    Debug: 119 6 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    User : 120 6 command.c:544 command_print(): adapter speed: RCLK - adaptive
    Debug: 121 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_reset_config srst_only
    Debug: 122 6 command.c:143 script_debug(): command - reset_config ocd_reset_config srst_only
    User : 124 6 command.c:544 command_print(): srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
    Debug: 125 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_init
    Debug: 126 6 command.c:143 script_debug(): command - init ocd_init
    Debug: 128 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target init
    Debug: 129 6 command.c:143 script_debug(): command - ocd_target ocd_target init
    Debug: 131 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target names
    Debug: 132 7 command.c:143 script_debug(): command - ocd_target ocd_target names
    Debug: 133 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu cget -event gdb-flash-erase-start
    Debug: 134 7 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu cget -event gdb-flash-erase-start
    Debug: 135 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -event gdb-flash-erase-start reset init
    Debug: 136 7 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -event gdb-flash-erase-start reset init
    Debug: 137 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu cget -event gdb-flash-write-end
    Debug: 138 7 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu cget -event gdb-flash-write-end
    Debug: 139 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -event gdb-flash-write-end reset halt
    Debug: 140 7 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -event gdb-flash-write-end reset halt
    Debug: 141 7 target.c:1326 handle_target_init_command(): Initializing targets...
    Debug: 142 7 stm8.c:804 stm8_init(): stm8_init
    Debug: 143 7 command.c:364 register_command_handler(): registering 'ocd_target_request'...
    Debug: 144 7 command.c:364 register_command_handler(): registering 'ocd_trace'...
    Debug: 145 7 command.c:364 register_command_handler(): registering 'ocd_trace'...
    Debug: 146 7 command.c:364 register_command_handler(): registering 'ocd_fast_load_image'...
    Debug: 147 7 command.c:364 register_command_handler(): registering 'ocd_fast_load'...
    Debug: 148 7 command.c:364 register_command_handler(): registering 'ocd_profile'...
    Debug: 149 7 command.c:364 register_command_handler(): registering 'ocd_virt2phys'...
    Debug: 150 7 command.c:364 register_command_handler(): registering 'ocd_reg'...
    Debug: 151 7 command.c:364 register_command_handler(): registering 'ocd_poll'...
    Debug: 152 7 command.c:364 register_command_handler(): registering 'ocd_wait_halt'...
    Debug: 153 7 command.c:364 register_command_handler(): registering 'ocd_halt'...
    Debug: 154 7 command.c:364 register_command_handler(): registering 'ocd_resume'...
    Debug: 155 7 command.c:364 register_command_handler(): registering 'ocd_reset'...
    Debug: 156 7 command.c:364 register_command_handler(): registering 'ocd_soft_reset_halt'...
    Debug: 157 7 command.c:364 register_command_handler(): registering 'ocd_step'...
    Debug: 158 7 command.c:364 register_command_handler(): registering 'ocd_mdw'...
    Debug: 159 7 command.c:364 register_command_handler(): registering 'ocd_mdh'...
    Debug: 160 7 command.c:364 register_command_handler(): registering 'ocd_mdb'...
    Debug: 161 7 command.c:364 register_command_handler(): registering 'ocd_mww'...
    Debug: 162 8 command.c:364 register_command_handler(): registering 'ocd_mwh'...
    Debug: 163 8 command.c:364 register_command_handler(): registering 'ocd_mwb'...
    Debug: 164 8 command.c:364 register_command_handler(): registering 'ocd_bp'...
    Debug: 165 8 command.c:364 register_command_handler(): registering 'ocd_rbp'...
    Debug: 166 8 command.c:364 register_command_handler(): registering 'ocd_wp'...
    Debug: 167 8 command.c:364 register_command_handler(): registering 'ocd_rwp'...
    Debug: 168 8 command.c:364 register_command_handler(): registering 'ocd_load_image'...
    Debug: 169 8 command.c:364 register_command_handler(): registering 'ocd_dump_image'...
    Debug: 170 8 command.c:364 register_command_handler(): registering 'ocd_verify_image_checksum'...
    Debug: 171 8 command.c:364 register_command_handler(): registering 'ocd_verify_image'...
    Debug: 172 8 command.c:364 register_command_handler(): registering 'ocd_test_image'...
    Debug: 173 8 command.c:364 register_command_handler(): registering 'ocd_reset_nag'...
    Debug: 174 8 command.c:364 register_command_handler(): registering 'ocd_ps'...
    Debug: 175 8 command.c:364 register_command_handler(): registering 'ocd_test_mem_access'...
    Debug: 176 8 hla_interface.c:109 hl_interface_init(): hl_interface_init
    Debug: 177 8 hla_layout.c:83 hl_layout_init(): hl_layout_init
    Debug: 178 8 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    Debug: 179 8 core.c:1601 adapter_khz_to_speed(): have interface set up
    Info : 180 8 stlink_usb.c:1937 stlink_speed(): Unable to match requested speed 0 kHz, using 5 kHz
    Debug: 181 8 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    Debug: 182 8 core.c:1601 adapter_khz_to_speed(): have interface set up
    Info : 183 8 stlink_usb.c:1937 stlink_speed(): Unable to match requested speed 0 kHz, using 5 kHz
    Info : 184 8 core.c:1384 adapter_init(): RCLK (adaptive clock speed) not supported - fallback to 5 kHz
    Debug: 185 8 openocd.c:140 handle_init_command(): Debug Adapter init complete
    Debug: 186 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport init
    Debug: 187 8 command.c:143 script_debug(): command - ocd_transport ocd_transport init
    Debug: 189 8 transport.c:239 handle_transport_init(): handle_transport_init
    Debug: 190 8 hla_transport.c:152 hl_transport_init(): hl_transport_init
    Debug: 191 8 hla_transport.c:169 hl_transport_init(): current transport stlink_swim
    Debug: 192 8 hla_interface.c:42 hl_interface_open(): hl_interface_open
    Debug: 193 8 hla_layout.c:40 hl_layout_open(): hl_layout_open
    Debug: 194 8 stlink_usb.c:1971 stlink_usb_open(): stlink_usb_open
    Debug: 195 8 stlink_usb.c:1988 stlink_usb_open(): transport: 3 vid: 0x0483 pid: 0x3748 serial:
    Info : 196 17 stlink_usb.c:658 stlink_usb_version(): STLINK v2 JTAG v0 API v1 SWIM v6 VID 0x0483 PID 0x3748
    Info : 197 17 stlink_usb.c:2099 stlink_usb_open(): using stlink api v1
    Debug: 198 18 stlink_usb.c:859 stlink_usb_init_mode(): MODE: 0x03
    Debug: 199 18 stlink_usb.c:914 stlink_usb_init_mode(): MODE: 0x01
    Debug: 200 18 stlink_usb.c:934 stlink_usb_init_mode(): MODE: 0x03
    Debug: 201 30 hla_interface.c:127 hl_interface_execute_queue(): hl_interface_execute_queue: ignored
    Debug: 202 30 core.c:729 jtag_add_reset(): SRST line released
    Debug: 203 30 core.c:753 jtag_add_reset(): TRST line released
    Debug: 204 30 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
    Debug: 205 30 hla_interface.c:67 hl_interface_init_target(): hl_interface_init_target
    Debug: 206 30 openocd.c:153 handle_init_command(): Examining targets...
    Debug: 207 30 target.c:1519 target_call_event_callbacks(): target event 21 (examine-start)
    Debug: 208 30 stm8.c:1645 stm8_examine(): stm8_examine
    Debug: 209 30 stm8.c:1650 stm8_examine(): writing A0 to SWIM_CSR
    Debug: 210 33 stm8.c:1655 stm8_examine(): writing B0 to SWIM_CSR
    Debug: 211 34 target.c:1519 target_call_event_callbacks(): target event 22 (examine-end)
    Debug: 212 34 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_flash init
    Debug: 213 34 command.c:143 script_debug(): command - ocd_flash ocd_flash init
    Debug: 214 36 stm8.c:833 stm8_poll(): DM_CSR2_STALL already set during server startup.
    Debug: 215 37 stm8.c:1141 stm8_read_core_reg(): read core reg 0 value 0x6000
    Debug: 216 37 stm8.c:1141 stm8_read_core_reg(): read core reg 1 value 0x0
    Debug: 217 37 stm8.c:1141 stm8_read_core_reg(): read core reg 2 value 0x0
    Debug: 218 37 stm8.c:1141 stm8_read_core_reg(): read core reg 3 value 0x0
    Debug: 219 37 stm8.c:1141 stm8_read_core_reg(): read core reg 4 value 0x7ff
    Debug: 220 37 stm8.c:1141 stm8_read_core_reg(): read core reg 5 value 0x28
    Debug: 221 40 stm8.c:453 stm8_examine_debug_reason(): stm8_examine_debug_reason csr1 = 0x10 csr2 = 0x08
    Debug: 222 40 stm8.c:493 stm8_debug_entry(): entered debug state at PC 0x6000, target->state: halted
    Debug: 223 40 target.c:1519 target_call_event_callbacks(): target event 0 (gdb-halt)
    Debug: 224 40 target.c:1519 target_call_event_callbacks(): target event 1 (halted)
    Debug: 226 40 tcl.c:1099 handle_flash_init_command(): Initializing flash devices...
    Debug: 227 40 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_mflash init
    Debug: 228 40 command.c:143 script_debug(): command - ocd_mflash ocd_mflash init
    Debug: 230 41 mflash.c:1377 handle_mflash_init_command(): Initializing mflash devices...
    Debug: 231 41 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_nand init
    Debug: 232 41 command.c:143 script_debug(): command - ocd_nand ocd_nand init
    Debug: 234 42 tcl.c:497 handle_nand_init_command(): Initializing NAND devices...
    Debug: 235 42 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_pld init
    Debug: 236 42 command.c:143 script_debug(): command - ocd_pld ocd_pld init
    Debug: 238 43 pld.c:205 handle_pld_init_command(): Initializing PLDs...
    Debug: 239 45 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_reset halt
    Debug: 240 45 command.c:143 script_debug(): command - reset ocd_reset halt
    Debug: 242 46 target.c:1537 target_call_reset_callbacks(): target reset 2 (halt)
    Debug: 243 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target names
    Debug: 244 46 command.c:143 script_debug(): command - ocd_target ocd_target names
    Debug: 245 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-start
    Debug: 246 46 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-start
    Debug: 247 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 248 46 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 249 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 250 46 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 251 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event examine-start
    Debug: 252 46 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event examine-start
    Debug: 253 47 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_examine allow-defer
    Debug: 254 47 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_examine allow-defer
    Debug: 255 47 stm8.c:1645 stm8_examine(): stm8_examine
    Debug: 256 47 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event examine-end
    Debug: 257 47 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event examine-end
    Debug: 258 47 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-assert-pre
    Debug: 259 47 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-assert-pre
    Debug: 260 47 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 261 47 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 262 47 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_reset assert 1
    Debug: 263 47 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_reset assert 1
    Debug: 264 47 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 265 48 stm8.c:901 stm8_reset_assert(): stm8_reset_assert
    Debug: 266 48 hla_interface.c:127 hl_interface_execute_queue(): hl_interface_execute_queue: ignored
    Debug: 267 48 core.c:725 jtag_add_reset(): SRST line asserted
    Debug: 268 48 stlink_usb.c:1310 stlink_usb_assert_srst(): **************stlink_usb_assert_srst, srst=0
    Debug: 269 48 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-assert-post
    Debug: 270 48 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-assert-post
    Debug: 271 48 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-deassert-pre
    Debug: 272 48 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-deassert-pre
    Debug: 273 48 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 274 48 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 275 48 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_reset deassert 1
    Debug: 276 48 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_reset deassert 1
    Debug: 277 48 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 278 48 stm8.c:953 stm8_reset_deassert(): stm8_reset_deassert
    Debug: 279 49 stlink_usb.c:1310 stlink_usb_assert_srst(): **************stlink_usb_assert_srst, srst=1
    Debug: 280 49 hla_interface.c:127 hl_interface_execute_queue(): hl_interface_execute_queue: ignored
    Debug: 281 49 core.c:729 jtag_add_reset(): SRST line released
    Debug: 282 49 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-deassert-post
    Debug: 283 49 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-deassert-post
    Debug: 284 49 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 285 49 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 286 49 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu was_examined
    Debug: 287 49 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu was_examined
    Debug: 288 49 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_waitstate halted 1000
    Debug: 289 49 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_waitstate halted 1000
    Debug: 290 52 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu curstate
    Debug: 291 52 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu curstate
    User : 292 52 command.c:544 command_print(): TARGET: stm8.cpu - Not halted
    in procedure 'reset'
    in procedure 'ocd_bouncer'
    
    Debug: 293 52 command.c:626 run_command(): Command failed with error code -4
    User : 294 52 command.c:687 command_run_line():
    Debug: 295 52 hla_interface.c:117 hl_interface_quit(): hl_interface_quit
    

    Same thing, but with the last line of stm8.cfg uncommented:

    $ openocd -f interface/stlink-v2.cfg -f target/stm8l152.cfg -c "init" -c "reset halt" -d3
    Open On-Chip Debugger 0.10.0
    Licensed under GNU GPL v2
    For bug reports, read
            http://openocd.org/doc/doxygen/bugs.html
    User : 13 1 command.c:544 command_print(): debug_level: 3
    Debug: 14 1 options.c:181 add_default_dirs(): bindir=/usr/local/bin
    Debug: 15 2 options.c:182 add_default_dirs(): pkgdatadir=/usr/local/share/openocd
    Debug: 16 2 options.c:183 add_default_dirs(): exepath=/usr/local/bin
    Debug: 17 2 options.c:184 add_default_dirs(): bin2data=../share/openocd
    Debug: 18 2 configuration.c:42 add_script_search_dir(): adding /home/Logan/.openocd
    Debug: 19 2 configuration.c:42 add_script_search_dir(): adding /usr/local/bin/../share/openocd/site
    Debug: 20 2 configuration.c:42 add_script_search_dir(): adding /usr/local/bin/../share/openocd/scripts
    Debug: 21 2 configuration.c:82 find_file(): found /usr/local/bin/../share/openocd/scripts/interface/stlink-v2.cfg
    Debug: 22 2 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_interface hla
    Debug: 23 3 command.c:143 script_debug(): command - interface ocd_interface hla
    Debug: 25 3 command.c:364 register_command_handler(): registering 'ocd_hla_device_desc'...
    Debug: 26 3 command.c:364 register_command_handler(): registering 'ocd_hla_serial'...
    Debug: 27 3 command.c:364 register_command_handler(): registering 'ocd_hla_layout'...
    Debug: 28 3 command.c:364 register_command_handler(): registering 'ocd_hla_vid_pid'...
    Debug: 29 3 command.c:364 register_command_handler(): registering 'ocd_hla_command'...
    Debug: 30 3 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla_layout stlink
    Debug: 31 3 command.c:143 script_debug(): command - hla_layout ocd_hla_layout stlink
    Debug: 33 3 hla_interface.c:239 hl_interface_handle_layout_command(): hl_interface_handle_layout_command
    Debug: 34 3 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla_device_desc ST-LINK/V2
    Debug: 35 3 command.c:143 script_debug(): command - hla_device_desc ocd_hla_device_desc ST-LINK/V2
    Debug: 37 3 hla_interface.c:213 hl_interface_handle_device_desc_command(): hl_interface_handle_device_desc_command
    Debug: 38 3 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla_vid_pid 0x0483 0x3748
    Debug: 39 3 command.c:143 script_debug(): command - hla_vid_pid ocd_hla_vid_pid 0x0483 0x3748
    Debug: 41 3 hla_interface.c:267 hl_interface_handle_vid_pid_command(): hl_interface_handle_vid_pid_command
    Debug: 42 4 configuration.c:82 find_file(): found /usr/local/bin/../share/openocd/scripts/target/stm8l152.cfg
    Debug: 43 4 configuration.c:82 find_file(): found /usr/local/bin/../share/openocd/scripts/target/stm8.cfg
    Debug: 44 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select stlink_swim
    Debug: 45 5 command.c:143 script_debug(): command - ocd_transport ocd_transport select stlink_swim
    Debug: 46 5 hla_transport.c:191 hl_transport_select(): hl_transport_select
    Debug: 47 5 command.c:364 register_command_handler(): registering 'ocd_hla'...
    Debug: 48 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 49 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 50 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 51 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 52 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 53 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 54 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 55 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 56 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 57 5 command.c:364 register_command_handler(): registering 'ocd_jtag_ntrst_delay'...
    Debug: 58 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla newtap stm8 cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0
    Debug: 59 5 command.c:143 script_debug(): command - ocd_hla ocd_hla newtap stm8 cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0
    Debug: 60 5 hla_tcl.c:116 jim_hl_newtap_cmd(): Creating New Tap, Chip: stm8, Tap: cpu, Dotted: stm8.cpu, 8 params
    Debug: 61 5 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -irlen
    Debug: 62 5 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -ircapture
    Debug: 63 5 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -irmask
    Debug: 64 5 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -expected-id
    Debug: 65 5 core.c:1304 jtag_tap_init(): Created Tap: stm8.cpu @ abs position 0, irlen 0, capture: 0x0 mask: 0x0
    Debug: 66 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target create stm8.cpu stm8 -chain-position stm8.cpu
    Debug: 67 5 command.c:143 script_debug(): command - ocd_target ocd_target create stm8.cpu stm8 -chain-position stm8.cpu
    Debug: 68 5 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 69 5 command.c:364 register_command_handler(): registering 'ocd_stm8'...
    Debug: 70 5 command.c:364 register_command_handler(): registering 'ocd_stm8'...
    Debug: 71 5 stm8.c:1115 stm8_target_create(): stm8_target_create
    Debug: 72 5 stm8.c:440 stm8_configure_break_unit(): hw breakpoints: numinst 2 numdata 2
    Debug: 73 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 74 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 75 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 76 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 77 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 78 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 79 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 80 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 81 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 82 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 83 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 84 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 85 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 86 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 87 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 88 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 89 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 90 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 91 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 92 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 93 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 94 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 95 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 96 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 97 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -work-area-phys 0x0 -work-area-size 0x400 -work-area-backup 1
    Debug: 98 6 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -work-area-phys 0x0 -work-area-size 0x400 -work-area-backup 1
    Debug: 99 6 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 100 6 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 101 6 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 102 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -flashstart 0x8000 -flashend 0xffff -eepromstart 0x1000 -eepromend 0x13ff -optionstart 0x4800 -optionend 0x487f -blocksize 0x80
    Debug: 103 6 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -flashstart 0x8000 -flashend 0xffff -eepromstart 0x1000 -eepromend 0x13ff -optionstart 0x4800 -optionend 0x487f -blocksize 0x80
    Debug: 104 6 stm8.c:1945 stm8_jim_configure(): stm8_jim_configure flashstart=00008000
    Debug: 105 6 stm8.c:1964 stm8_jim_configure(): stm8_jim_configure flashend=0000ffff
    Debug: 106 6 stm8.c:1983 stm8_jim_configure(): stm8_jim_configure eepromstart=00001000
    Debug: 107 6 stm8.c:2002 stm8_jim_configure(): stm8_jim_configure eepromend=000013ff
    Debug: 108 6 stm8.c:2021 stm8_jim_configure(): stm8_jim_configure optionstart=00004800
    Debug: 109 7 stm8.c:2040 stm8_jim_configure(): stm8_jim_configure optionend=0000487f
    Debug: 110 7 stm8.c:1926 stm8_jim_configure(): stm8_jim_configure blocksize=00000080
    Debug: 111 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -enable_stm8l
    Debug: 112 7 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -enable_stm8l
    Debug: 113 7 stm8.c:2058 stm8_jim_configure(): stm8_jim_configure enable_stm8l=00000001
    Debug: 114 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_adapter_khz 0
    Debug: 115 7 command.c:143 script_debug(): command - adapter_khz ocd_adapter_khz 0
    Debug: 117 7 core.c:1631 jtag_config_khz(): handle jtag khz
    Debug: 118 7 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    Debug: 119 7 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    User : 120 7 command.c:544 command_print(): adapter speed: RCLK - adaptive
    Debug: 121 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_reset_config srst_only
    Debug: 122 7 command.c:143 script_debug(): command - reset_config ocd_reset_config srst_only
    User : 124 7 command.c:544 command_print(): srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
    Debug: 125 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_reset_config srst_nogate connect_assert_srst
    Debug: 126 7 command.c:143 script_debug(): command - reset_config ocd_reset_config srst_nogate connect_assert_srst
    User : 128 7 command.c:544 command_print(): srst_only separate srst_nogate srst_open_drain connect_assert_srst
    Debug: 129 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_init
    Debug: 130 7 command.c:143 script_debug(): command - init ocd_init
    Debug: 132 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target init
    Debug: 133 7 command.c:143 script_debug(): command - ocd_target ocd_target init
    Debug: 135 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target names
    Debug: 136 7 command.c:143 script_debug(): command - ocd_target ocd_target names
    Debug: 137 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu cget -event gdb-flash-erase-start
    Debug: 138 7 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu cget -event gdb-flash-erase-start
    Debug: 139 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -event gdb-flash-erase-start reset init
    Debug: 140 8 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -event gdb-flash-erase-start reset init
    Debug: 141 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu cget -event gdb-flash-write-end
    Debug: 142 8 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu cget -event gdb-flash-write-end
    Debug: 143 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -event gdb-flash-write-end reset halt
    Debug: 144 8 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -event gdb-flash-write-end reset halt
    Debug: 145 8 target.c:1326 handle_target_init_command(): Initializing targets...
    Debug: 146 8 stm8.c:804 stm8_init(): stm8_init
    Debug: 147 8 command.c:364 register_command_handler(): registering 'ocd_target_request'...
    Debug: 148 8 command.c:364 register_command_handler(): registering 'ocd_trace'...
    Debug: 149 8 command.c:364 register_command_handler(): registering 'ocd_trace'...
    Debug: 150 8 command.c:364 register_command_handler(): registering 'ocd_fast_load_image'...
    Debug: 151 8 command.c:364 register_command_handler(): registering 'ocd_fast_load'...
    Debug: 152 8 command.c:364 register_command_handler(): registering 'ocd_profile'...
    Debug: 153 8 command.c:364 register_command_handler(): registering 'ocd_virt2phys'...
    Debug: 154 8 command.c:364 register_command_handler(): registering 'ocd_reg'...
    Debug: 155 8 command.c:364 register_command_handler(): registering 'ocd_poll'...
    Debug: 156 8 command.c:364 register_command_handler(): registering 'ocd_wait_halt'...
    Debug: 157 8 command.c:364 register_command_handler(): registering 'ocd_halt'...
    Debug: 158 8 command.c:364 register_command_handler(): registering 'ocd_resume'...
    Debug: 159 8 command.c:364 register_command_handler(): registering 'ocd_reset'...
    Debug: 160 8 command.c:364 register_command_handler(): registering 'ocd_soft_reset_halt'...
    Debug: 161 8 command.c:364 register_command_handler(): registering 'ocd_step'...
    Debug: 162 8 command.c:364 register_command_handler(): registering 'ocd_mdw'...
    Debug: 163 9 command.c:364 register_command_handler(): registering 'ocd_mdh'...
    Debug: 164 9 command.c:364 register_command_handler(): registering 'ocd_mdb'...
    Debug: 165 9 command.c:364 register_command_handler(): registering 'ocd_mww'...
    Debug: 166 9 command.c:364 register_command_handler(): registering 'ocd_mwh'...
    Debug: 167 9 command.c:364 register_command_handler(): registering 'ocd_mwb'...
    Debug: 168 9 command.c:364 register_command_handler(): registering 'ocd_bp'...
    Debug: 169 9 command.c:364 register_command_handler(): registering 'ocd_rbp'...
    Debug: 170 9 command.c:364 register_command_handler(): registering 'ocd_wp'...
    Debug: 171 9 command.c:364 register_command_handler(): registering 'ocd_rwp'...
    Debug: 172 9 command.c:364 register_command_handler(): registering 'ocd_load_image'...
    Debug: 173 9 command.c:364 register_command_handler(): registering 'ocd_dump_image'...
    Debug: 174 9 command.c:364 register_command_handler(): registering 'ocd_verify_image_checksum'...
    Debug: 175 9 command.c:364 register_command_handler(): registering 'ocd_verify_image'...
    Debug: 176 9 command.c:364 register_command_handler(): registering 'ocd_test_image'...
    Debug: 177 9 command.c:364 register_command_handler(): registering 'ocd_reset_nag'...
    Debug: 178 9 command.c:364 register_command_handler(): registering 'ocd_ps'...
    Debug: 179 9 command.c:364 register_command_handler(): registering 'ocd_test_mem_access'...
    Debug: 180 9 hla_interface.c:109 hl_interface_init(): hl_interface_init
    Debug: 181 10 hla_layout.c:83 hl_layout_init(): hl_layout_init
    Debug: 182 10 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    Debug: 183 10 core.c:1601 adapter_khz_to_speed(): have interface set up
    Info : 184 10 stlink_usb.c:1937 stlink_speed(): Unable to match requested speed 0 kHz, using 5 kHz
    Debug: 185 10 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    Debug: 186 10 core.c:1601 adapter_khz_to_speed(): have interface set up
    Info : 187 10 stlink_usb.c:1937 stlink_speed(): Unable to match requested speed 0 kHz, using 5 kHz
    Info : 188 10 core.c:1384 adapter_init(): RCLK (adaptive clock speed) not supported - fallback to 5 kHz
    Debug: 189 10 openocd.c:140 handle_init_command(): Debug Adapter init complete
    Debug: 190 10 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport init
    Debug: 191 10 command.c:143 script_debug(): command - ocd_transport ocd_transport init
    Debug: 193 10 transport.c:239 handle_transport_init(): handle_transport_init
    Debug: 194 10 hla_transport.c:152 hl_transport_init(): hl_transport_init
    Debug: 195 10 hla_transport.c:169 hl_transport_init(): current transport stlink_swim
    Debug: 196 10 hla_interface.c:42 hl_interface_open(): hl_interface_open
    Debug: 197 10 hla_layout.c:40 hl_layout_open(): hl_layout_open
    Debug: 198 10 stlink_usb.c:1971 stlink_usb_open(): stlink_usb_open
    Debug: 199 10 stlink_usb.c:1988 stlink_usb_open(): transport: 3 vid: 0x0483 pid: 0x3748 serial:
    Info : 200 17 stlink_usb.c:658 stlink_usb_version(): STLINK v2 JTAG v0 API v1 SWIM v6 VID 0x0483 PID 0x3748
    Info : 201 17 stlink_usb.c:2099 stlink_usb_open(): using stlink api v1
    Debug: 202 18 stlink_usb.c:859 stlink_usb_init_mode(): MODE: 0x03
    Debug: 203 18 stlink_usb.c:914 stlink_usb_init_mode(): MODE: 0x01
    Debug: 204 18 stlink_usb.c:934 stlink_usb_init_mode(): MODE: 0x03
    Debug: 205 18 stlink_usb.c:1310 stlink_usb_assert_srst(): **************stlink_usb_assert_srst, srst=0
    Debug: 206 32 hla_interface.c:127 hl_interface_execute_queue(): hl_interface_execute_queue: ignored
    Debug: 207 32 core.c:725 jtag_add_reset(): SRST line asserted
    Debug: 208 32 core.c:753 jtag_add_reset(): TRST line released
    Debug: 209 32 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
    Debug: 210 32 stlink_usb.c:1310 stlink_usb_assert_srst(): **************stlink_usb_assert_srst, srst=0
    Debug: 211 32 hla_interface.c:67 hl_interface_init_target(): hl_interface_init_target
    Debug: 212 32 openocd.c:153 handle_init_command(): Examining targets...
    Debug: 213 32 target.c:1519 target_call_event_callbacks(): target event 21 (examine-start)
    Debug: 214 32 stm8.c:1645 stm8_examine(): stm8_examine
    Debug: 215 33 stm8.c:1650 stm8_examine(): writing A0 to SWIM_CSR
    Debug: 216 34 stm8.c:1655 stm8_examine(): writing B0 to SWIM_CSR
    Debug: 217 35 stm8.c:953 stm8_reset_deassert(): stm8_reset_deassert
    Debug: 218 36 stlink_usb.c:1310 stlink_usb_assert_srst(): **************stlink_usb_assert_srst, srst=1
    Debug: 219 36 hla_interface.c:127 hl_interface_execute_queue(): hl_interface_execute_queue: ignored
    Debug: 220 36 core.c:729 jtag_add_reset(): SRST line released
    Error: 221 36 target.c:608 target_resume(): Target not examined yet
    Debug: 222 36 target.c:1519 target_call_event_callbacks(): target event 22 (examine-end)
    Debug: 223 36 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_flash init
    Debug: 224 36 command.c:143 script_debug(): command - ocd_flash ocd_flash init
    Debug: 225 39 target.c:1519 target_call_event_callbacks(): target event 0 (gdb-halt)
    User : 226 39 target.c:2595 handle_target(): Polling target stm8.cpu failed, trying to reexamine
    Debug: 227 39 target.c:1519 target_call_event_callbacks(): target event 21 (examine-start)
    Debug: 228 39 stm8.c:1645 stm8_examine(): stm8_examine
    Info : 229 39 stm8.c:1666 stm8_examine(): trying to reconnect
    Debug: 230 41 target.c:1519 target_call_event_callbacks(): target event 22 (examine-end)
    Debug: 232 42 tcl.c:1099 handle_flash_init_command(): Initializing flash devices...
    Debug: 233 42 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_mflash init
    Debug: 234 42 command.c:143 script_debug(): command - ocd_mflash ocd_mflash init
    Debug: 235 43 stm8.c:833 stm8_poll(): DM_CSR2_STALL already set during server startup.
    Debug: 236 46 stm8.c:1141 stm8_read_core_reg(): read core reg 0 value 0x6000
    Debug: 237 46 stm8.c:1141 stm8_read_core_reg(): read core reg 1 value 0x0
    Debug: 238 46 stm8.c:1141 stm8_read_core_reg(): read core reg 2 value 0x0
    Debug: 239 46 stm8.c:1141 stm8_read_core_reg(): read core reg 3 value 0x0
    Debug: 240 46 stm8.c:1141 stm8_read_core_reg(): read core reg 4 value 0x7ff
    Debug: 241 46 stm8.c:1141 stm8_read_core_reg(): read core reg 5 value 0x28
    Debug: 242 50 stm8.c:453 stm8_examine_debug_reason(): stm8_examine_debug_reason csr1 = 0x10 csr2 = 0x08
    Debug: 243 51 stm8.c:493 stm8_debug_entry(): entered debug state at PC 0x6000, target->state: halted
    Debug: 244 51 target.c:1519 target_call_event_callbacks(): target event 0 (gdb-halt)
    Debug: 245 51 target.c:1519 target_call_event_callbacks(): target event 1 (halted)
    Debug: 247 51 mflash.c:1377 handle_mflash_init_command(): Initializing mflash devices...
    Debug: 248 51 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_nand init
    Debug: 249 51 command.c:143 script_debug(): command - ocd_nand ocd_nand init
    Debug: 251 52 tcl.c:497 handle_nand_init_command(): Initializing NAND devices...
    Debug: 252 53 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_pld init
    Debug: 253 53 command.c:143 script_debug(): command - ocd_pld ocd_pld init
    Debug: 255 55 pld.c:205 handle_pld_init_command(): Initializing PLDs...
    Debug: 256 57 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_reset halt
    Debug: 257 57 command.c:143 script_debug(): command - reset ocd_reset halt
    Debug: 259 63 target.c:1537 target_call_reset_callbacks(): target reset 2 (halt)
    Debug: 260 63 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target names
    Debug: 261 63 command.c:143 script_debug(): command - ocd_target ocd_target names
    Debug: 262 63 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-start
    Debug: 263 63 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-start
    Debug: 264 63 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 265 63 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 266 63 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 267 63 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 268 63 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event examine-start
    Debug: 269 63 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event examine-start
    Debug: 270 63 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_examine allow-defer
    Debug: 271 63 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_examine allow-defer
    Debug: 272 63 stm8.c:1645 stm8_examine(): stm8_examine
    Debug: 273 63 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event examine-end
    Debug: 274 63 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event examine-end
    Debug: 275 63 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-assert-pre
    Debug: 276 63 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-assert-pre
    Debug: 277 63 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 278 63 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 279 64 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_reset assert 1
    Debug: 280 64 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_reset assert 1
    Debug: 281 64 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 282 64 stm8.c:901 stm8_reset_assert(): stm8_reset_assert
    Debug: 283 64 hla_interface.c:127 hl_interface_execute_queue(): hl_interface_execute_queue: ignored
    Debug: 284 64 core.c:725 jtag_add_reset(): SRST line asserted
    Debug: 285 64 stlink_usb.c:1310 stlink_usb_assert_srst(): **************stlink_usb_assert_srst, srst=0
    Debug: 286 64 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-assert-post
    Debug: 287 64 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-assert-post
    Debug: 288 64 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-deassert-pre
    Debug: 289 64 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-deassert-pre
    Debug: 290 64 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 291 64 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 292 64 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_reset deassert 1
    Debug: 293 64 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_reset deassert 1
    Debug: 294 64 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 295 65 stm8.c:953 stm8_reset_deassert(): stm8_reset_deassert
    Debug: 296 65 stlink_usb.c:1310 stlink_usb_assert_srst(): **************stlink_usb_assert_srst, srst=1
    Debug: 297 65 hla_interface.c:127 hl_interface_execute_queue(): hl_interface_execute_queue: ignored
    Debug: 298 65 core.c:729 jtag_add_reset(): SRST line released
    Debug: 299 65 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-deassert-post
    Debug: 300 65 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-deassert-post
    Debug: 301 65 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 302 65 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 303 65 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu was_examined
    Debug: 304 65 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu was_examined
    Debug: 305 65 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_waitstate halted 1000
    Debug: 306 65 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_waitstate halted 1000
    Debug: 307 68 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu curstate
    Debug: 308 68 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu curstate
    User : 309 68 command.c:544 command_print(): TARGET: stm8.cpu - Not halted
    in procedure 'reset'
    in procedure 'ocd_bouncer'
    
    Debug: 310 68 command.c:626 run_command(): Command failed with error code -4
    User : 311 68 command.c:687 command_run_line():
    Debug: 312 69 hla_interface.c:117 hl_interface_quit(): hl_interface_quit
    

    Just let me know if there is anything else I can provide that might help.

    As far as the flashing issue, I was able to follow your advice and use the load_image command to successfully flash a file. It might be good to add an example of this to the main page so others don't make the same mistakes!

    Thank you for all the work you put into this project. It's been extremely helpful in getting my STM8 development environment up and running!

     

    Last edit: Logan 2017-08-18
  • Logan

    Logan - 2017-08-19
    Post awaiting moderation.
    • akre

      akre - 2017-08-19

      Seems something is going wrong during startup. Perhaps some kind of race condition....

      Just for the sake of it, could you run cygcheck -c openocd

       
  • Logan

    Logan - 2017-08-19

    Result of cygcheck -c openocd:

    $ cygcheck -c openocd
    Cygwin Package Information
    Package              Version             Status
    openocd              0.10.0-20170525     OK
    
     
  • akre

    akre - 2017-08-20

    Try this version with -d3, it has some extra debug logs enabled.

    If you run this from a temporary directory you will have to add search path to the scripts dir.

    $ ./openocd -s /usr/local/share/openocd/scripts -d3 -f interface/stlink-v2.cfg -f target/stm8l152.cfg -c "init" -c "reset halt" 2>&1 | tee /cygdrive/c/temp/openocd.log

     
  • Logan

    Logan - 2017-08-20

    Results below. Seems to get stuck while polling -- had to end the process with Ctrl-C.

    $ ./openocd -s /usr/local/share/openocd/scripts -d3 -f interface/stlink-v2.cfg -f target/stm8l152.cfg -c "init" -c "reset halt" 2>&1 | tee /cygdrive/c/temp/openocd.log
    Open On-Chip Debugger 0.10.0-00003-g0ef19a98-dirty (2017-04-23-22:53)
    Licensed under GNU GPL v2
    For bug reports, read
            http://openocd.org/doc/doxygen/bugs.html
    User : 13 2 command.c:544 command_print(): debug_level: 3
    Debug: 14 2 options.c:181 add_default_dirs(): bindir=/usr/local/bin
    Debug: 15 2 options.c:182 add_default_dirs(): pkgdatadir=/usr/local/share/openocd
    Debug: 16 2 options.c:183 add_default_dirs(): exepath=/tmp
    Debug: 17 2 options.c:184 add_default_dirs(): bin2data=../share/openocd
    Debug: 18 2 configuration.c:42 add_script_search_dir(): adding /home/Logan/.openocd
    Debug: 19 2 configuration.c:42 add_script_search_dir(): adding /tmp/../share/openocd/site
    Debug: 20 2 configuration.c:42 add_script_search_dir(): adding /tmp/../share/openocd/scripts
    Debug: 21 2 configuration.c:82 find_file(): found /usr/local/share/openocd/scripts/interface/stlink-v2.cfg
    Debug: 22 3 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_interface hla
    Debug: 23 3 command.c:143 script_debug(): command - interface ocd_interface hla
    Debug: 25 3 command.c:364 register_command_handler(): registering 'ocd_hla_device_desc'...
    Debug: 26 3 command.c:364 register_command_handler(): registering 'ocd_hla_serial'...
    Debug: 27 3 command.c:364 register_command_handler(): registering 'ocd_hla_layout'...
    Debug: 28 3 command.c:364 register_command_handler(): registering 'ocd_hla_vid_pid'...
    Debug: 29 3 command.c:364 register_command_handler(): registering 'ocd_hla_command'...
    Debug: 30 3 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla_layout stlink
    Debug: 31 3 command.c:143 script_debug(): command - hla_layout ocd_hla_layout stlink
    Debug: 33 3 hla_interface.c:239 hl_interface_handle_layout_command(): hl_interface_handle_layout_command
    Debug: 34 3 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla_device_desc ST-LINK/V2
    Debug: 35 4 command.c:143 script_debug(): command - hla_device_desc ocd_hla_device_desc ST-LINK/V2
    Debug: 37 4 hla_interface.c:213 hl_interface_handle_device_desc_command(): hl_interface_handle_device_desc_command
    Debug: 38 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla_vid_pid 0x0483 0x3748
    Debug: 39 4 command.c:143 script_debug(): command - hla_vid_pid ocd_hla_vid_pid 0x0483 0x3748
    Debug: 41 4 hla_interface.c:267 hl_interface_handle_vid_pid_command(): hl_interface_handle_vid_pid_command
    Debug: 42 4 configuration.c:82 find_file(): found /usr/local/share/openocd/scripts/target/stm8l152.cfg
    Debug: 43 4 configuration.c:82 find_file(): found /usr/local/share/openocd/scripts/target/stm8.cfg
    Debug: 44 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select stlink_swim
    Debug: 45 5 command.c:143 script_debug(): command - ocd_transport ocd_transport select stlink_swim
    Debug: 46 5 hla_transport.c:191 hl_transport_select(): hl_transport_select
    Debug: 47 5 command.c:364 register_command_handler(): registering 'ocd_hla'...
    Debug: 48 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 49 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 50 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 51 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 52 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 53 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 54 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 55 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 56 5 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 57 5 command.c:364 register_command_handler(): registering 'ocd_jtag_ntrst_delay'...
    Debug: 58 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla newtap stm8 cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0
    Debug: 59 6 command.c:143 script_debug(): command - ocd_hla ocd_hla newtap stm8 cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0
    Debug: 60 6 hla_tcl.c:116 jim_hl_newtap_cmd(): Creating New Tap, Chip: stm8, Tap: cpu, Dotted: stm8.cpu, 8 params
    Debug: 61 6 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -irlen
    Debug: 62 6 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -ircapture
    Debug: 63 6 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -irmask
    Debug: 64 6 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -expected-id
    Debug: 65 6 core.c:1304 jtag_tap_init(): Created Tap: stm8.cpu @ abs position 0, irlen 0, capture: 0x0 mask: 0x0
    Debug: 66 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target create stm8.cpu stm8 -chain-position stm8.cpu
    Debug: 67 6 command.c:143 script_debug(): command - ocd_target ocd_target create stm8.cpu stm8 -chain-position stm8.cpu
    Debug: 68 6 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 69 6 command.c:364 register_command_handler(): registering 'ocd_stm8'...
    Debug: 70 6 command.c:364 register_command_handler(): registering 'ocd_stm8'...
    Debug: 71 6 stm8.c:1123 stm8_target_create(): stm8_target_create
    Debug: 72 6 stm8.c:442 stm8_configure_break_unit(): hw breakpoints: numinst 2 numdata 2
    Debug: 73 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 74 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 75 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 76 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 77 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 78 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 79 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 80 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 81 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 82 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 83 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 84 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 85 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 86 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 87 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 88 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 89 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 90 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 91 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 92 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 93 7 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 94 8 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 95 8 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 96 8 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 97 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -work-area-phys 0x0 -work-area-size 0x400 -work-area-backup 1
    Debug: 98 8 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -work-area-phys 0x0 -work-area-size 0x400 -work-area-backup 1
    Debug: 99 8 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 100 8 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 101 8 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 102 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -flashstart 0x8000 -flashend 0xffff -eepromstart 0x1000 -eepromend 0x13ff -optionstart 0x4800 -optionend 0x487f -blocksize 0x80
    Debug: 103 8 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -flashstart 0x8000 -flashend 0xffff -eepromstart 0x1000 -eepromend 0x13ff -optionstart 0x4800 -optionend 0x487f -blocksize 0x80
    Debug: 104 8 stm8.c:1953 stm8_jim_configure(): stm8_jim_configure flashstart=00008000
    Debug: 105 8 stm8.c:1972 stm8_jim_configure(): stm8_jim_configure flashend=0000ffff
    Debug: 106 8 stm8.c:1991 stm8_jim_configure(): stm8_jim_configure eepromstart=00001000
    Debug: 107 8 stm8.c:2010 stm8_jim_configure(): stm8_jim_configure eepromend=000013ff
    Debug: 108 8 stm8.c:2029 stm8_jim_configure(): stm8_jim_configure optionstart=00004800
    Debug: 109 8 stm8.c:2048 stm8_jim_configure(): stm8_jim_configure optionend=0000487f
    Debug: 110 9 stm8.c:1934 stm8_jim_configure(): stm8_jim_configure blocksize=00000080
    Debug: 111 9 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -enable_stm8l
    Debug: 112 9 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -enable_stm8l
    Debug: 113 9 stm8.c:2066 stm8_jim_configure(): stm8_jim_configure enable_stm8l=00000001
    Debug: 114 9 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_adapter_khz 0
    Debug: 115 9 command.c:143 script_debug(): command - adapter_khz ocd_adapter_khz 0
    Debug: 117 9 core.c:1631 jtag_config_khz(): handle jtag khz
    Debug: 118 9 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    Debug: 119 9 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    User : 120 9 command.c:544 command_print(): adapter speed: RCLK - adaptive
    Debug: 121 9 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_reset_config srst_only
    Debug: 122 9 command.c:143 script_debug(): command - reset_config ocd_reset_config srst_only
    User : 124 9 command.c:544 command_print(): srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
    Debug: 125 9 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_init
    Debug: 126 9 command.c:143 script_debug(): command - init ocd_init
    Debug: 128 9 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target init
    Debug: 129 9 command.c:143 script_debug(): command - ocd_target ocd_target init
    Debug: 131 10 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target names
    Debug: 132 10 command.c:143 script_debug(): command - ocd_target ocd_target names
    Debug: 133 10 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu cget -event gdb-flash-erase-start
    Debug: 134 10 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu cget -event gdb-flash-erase-start
    Debug: 135 10 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -event gdb-flash-erase-start reset init
    Debug: 136 10 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -event gdb-flash-erase-start reset init
    Debug: 137 10 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu cget -event gdb-flash-write-end
    Debug: 138 10 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu cget -event gdb-flash-write-end
    Debug: 139 10 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -event gdb-flash-write-end reset halt
    Debug: 140 10 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -event gdb-flash-write-end reset halt
    Debug: 141 10 target.c:1326 handle_target_init_command(): Initializing targets...
    Debug: 142 10 stm8.c:806 stm8_init(): stm8_init
    Debug: 143 10 command.c:364 register_command_handler(): registering 'ocd_target_request'...
    Debug: 144 10 command.c:364 register_command_handler(): registering 'ocd_trace'...
    Debug: 145 10 command.c:364 register_command_handler(): registering 'ocd_trace'...
    Debug: 146 11 command.c:364 register_command_handler(): registering 'ocd_fast_load_image'...
    Debug: 147 11 command.c:364 register_command_handler(): registering 'ocd_fast_load'...
    Debug: 148 11 command.c:364 register_command_handler(): registering 'ocd_profile'...
    Debug: 149 11 command.c:364 register_command_handler(): registering 'ocd_virt2phys'...
    Debug: 150 11 command.c:364 register_command_handler(): registering 'ocd_reg'...
    Debug: 151 11 command.c:364 register_command_handler(): registering 'ocd_poll'...
    Debug: 152 11 command.c:364 register_command_handler(): registering 'ocd_wait_halt'...
    Debug: 153 11 command.c:364 register_command_handler(): registering 'ocd_halt'...
    Debug: 154 11 command.c:364 register_command_handler(): registering 'ocd_resume'...
    Debug: 155 11 command.c:364 register_command_handler(): registering 'ocd_reset'...
    Debug: 156 11 command.c:364 register_command_handler(): registering 'ocd_soft_reset_halt'...
    Debug: 157 11 command.c:364 register_command_handler(): registering 'ocd_step'...
    Debug: 158 11 command.c:364 register_command_handler(): registering 'ocd_mdw'...
    Debug: 159 11 command.c:364 register_command_handler(): registering 'ocd_mdh'...
    Debug: 160 11 command.c:364 register_command_handler(): registering 'ocd_mdb'...
    Debug: 161 11 command.c:364 register_command_handler(): registering 'ocd_mww'...
    Debug: 162 11 command.c:364 register_command_handler(): registering 'ocd_mwh'...
    Debug: 163 11 command.c:364 register_command_handler(): registering 'ocd_mwb'...
    Debug: 164 11 command.c:364 register_command_handler(): registering 'ocd_bp'...
    Debug: 165 12 command.c:364 register_command_handler(): registering 'ocd_rbp'...
    Debug: 166 12 command.c:364 register_command_handler(): registering 'ocd_wp'...
    Debug: 167 12 command.c:364 register_command_handler(): registering 'ocd_rwp'...
    Debug: 168 12 command.c:364 register_command_handler(): registering 'ocd_load_image'...
    Debug: 169 12 command.c:364 register_command_handler(): registering 'ocd_dump_image'...
    Debug: 170 12 command.c:364 register_command_handler(): registering 'ocd_verify_image_checksum'...
    Debug: 171 12 command.c:364 register_command_handler(): registering 'ocd_verify_image'...
    Debug: 172 12 command.c:364 register_command_handler(): registering 'ocd_test_image'...
    Debug: 173 12 command.c:364 register_command_handler(): registering 'ocd_reset_nag'...
    Debug: 174 12 command.c:364 register_command_handler(): registering 'ocd_ps'...
    Debug: 175 12 command.c:364 register_command_handler(): registering 'ocd_test_mem_access'...
    Debug: 176 12 hla_interface.c:109 hl_interface_init(): hl_interface_init
    Debug: 177 12 hla_layout.c:83 hl_layout_init(): hl_layout_init
    Debug: 178 12 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    Debug: 179 12 core.c:1601 adapter_khz_to_speed(): have interface set up
    Info : 180 12 stlink_usb.c:1937 stlink_speed(): Unable to match requested speed 0 kHz, using 5 kHz
    Debug: 181 12 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    Debug: 182 12 core.c:1601 adapter_khz_to_speed(): have interface set up
    Info : 183 12 stlink_usb.c:1937 stlink_speed(): Unable to match requested speed 0 kHz, using 5 kHz
    Info : 184 12 core.c:1384 adapter_init(): RCLK (adaptive clock speed) not supported - fallback to 5 kHz
    Debug: 185 12 openocd.c:140 handle_init_command(): Debug Adapter init complete
    Debug: 186 12 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport init
    Debug: 187 13 command.c:143 script_debug(): command - ocd_transport ocd_transport init
    Debug: 189 13 transport.c:239 handle_transport_init(): handle_transport_init
    Debug: 190 13 hla_transport.c:152 hl_transport_init(): hl_transport_init
    Debug: 191 13 hla_transport.c:169 hl_transport_init(): current transport stlink_swim
    Debug: 192 13 hla_interface.c:42 hl_interface_open(): hl_interface_open
    Debug: 193 13 hla_layout.c:40 hl_layout_open(): hl_layout_open
    Debug: 194 13 stlink_usb.c:1971 stlink_usb_open(): stlink_usb_open
    Debug: 195 13 stlink_usb.c:1988 stlink_usb_open(): transport: 3 vid: 0x0483 pid: 0x3748 serial:
    Info : 196 20 stlink_usb.c:658 stlink_usb_version(): STLINK v2 JTAG v0 API v1 SWIM v6 VID 0x0483 PID 0x3748
    Info : 197 20 stlink_usb.c:2099 stlink_usb_open(): using stlink api v1
    Debug: 198 21 stlink_usb.c:859 stlink_usb_init_mode(): MODE: 0x03
    Debug: 199 21 stlink_usb.c:914 stlink_usb_init_mode(): MODE: 0x01
    Debug: 200 21 stlink_usb.c:934 stlink_usb_init_mode(): MODE: 0x03
    Debug: 201 34 hla_interface.c:127 hl_interface_execute_queue(): hl_interface_execute_queue: ignored
    Debug: 202 34 core.c:729 jtag_add_reset(): SRST line released
    Debug: 203 35 core.c:753 jtag_add_reset(): TRST line released
    Debug: 204 35 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
    Debug: 205 35 hla_interface.c:67 hl_interface_init_target(): hl_interface_init_target
    Debug: 206 35 openocd.c:153 handle_init_command(): Examining targets...
    Debug: 207 35 target.c:1519 target_call_event_callbacks(): target event 21 (examine-start)
    Debug: 208 35 stm8.c:1653 stm8_examine(): stm8_examine
    Debug: 209 35 stm8.c:1658 stm8_examine(): writing A0 to SWIM_CSR
    Debug: 210 54 stm8.c:1663 stm8_examine(): writing B0 to SWIM_CSR
    Debug: 211 66 target.c:1519 target_call_event_callbacks(): target event 22 (examine-end)
    Debug: 212 66 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_flash init
    Debug: 213 66 command.c:143 script_debug(): command - ocd_flash ocd_flash init
    Debug: 214 66 stm8.c:818 stm8_poll(): stm8_poll target->state=0
    Debug: 215 67 stm8.c:837 stm8_poll(): DM_CSR2_STALL already set during server startup.
    Debug: 216 82 stm8.c:1149 stm8_read_core_reg(): read core reg 0 value 0x6000
    Debug: 217 82 stm8.c:1149 stm8_read_core_reg(): read core reg 1 value 0x0
    Debug: 218 82 stm8.c:1149 stm8_read_core_reg(): read core reg 2 value 0x0
    Debug: 219 82 stm8.c:1149 stm8_read_core_reg(): read core reg 3 value 0x0
    Debug: 220 82 stm8.c:1149 stm8_read_core_reg(): read core reg 4 value 0x7ff
    Debug: 221 82 stm8.c:1149 stm8_read_core_reg(): read core reg 5 value 0x28
    Debug: 222 100 stm8.c:455 stm8_examine_debug_reason(): stm8_examine_debug_reason csr1 = 0x10 csr2 = 0x08
    Debug: 223 100 stm8.c:495 stm8_debug_entry(): entered debug state at PC 0x6000, target->state: halted
    Debug: 224 100 target.c:1519 target_call_event_callbacks(): target event 0 (gdb-halt)
    Debug: 225 100 target.c:1519 target_call_event_callbacks(): target event 1 (halted)
    Debug: 226 100 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 228 100 tcl.c:1099 handle_flash_init_command(): Initializing flash devices...
    Debug: 229 100 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_mflash init
    Debug: 230 100 command.c:143 script_debug(): command - ocd_mflash ocd_mflash init
    Debug: 231 100 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 232 101 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 234 101 mflash.c:1377 handle_mflash_init_command(): Initializing mflash devices...
    Debug: 235 101 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_nand init
    Debug: 236 102 command.c:143 script_debug(): command - ocd_nand ocd_nand init
    Debug: 237 102 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 238 113 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 240 113 tcl.c:497 handle_nand_init_command(): Initializing NAND devices...
    Debug: 241 113 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_pld init
    Debug: 242 113 command.c:143 script_debug(): command - ocd_pld ocd_pld init
    Debug: 243 113 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 244 129 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 246 129 pld.c:205 handle_pld_init_command(): Initializing PLDs...
    Debug: 247 131 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_reset halt
    Debug: 248 131 command.c:143 script_debug(): command - reset ocd_reset halt
    Debug: 249 131 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 250 133 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 252 133 target.c:1537 target_call_reset_callbacks(): target reset 2 (halt)
    Debug: 253 133 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target names
    Debug: 254 133 command.c:143 script_debug(): command - ocd_target ocd_target names
    Debug: 255 133 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-start
    Debug: 256 133 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-start
    Debug: 257 133 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 258 133 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 259 134 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 260 134 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 261 134 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event examine-start
    Debug: 262 134 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event examine-start
    Debug: 263 134 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_examine allow-defer
    Debug: 264 134 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_examine allow-defer
    Debug: 265 134 stm8.c:1653 stm8_examine(): stm8_examine
    Debug: 266 134 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event examine-end
    Debug: 267 134 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event examine-end
    Debug: 268 134 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-assert-pre
    Debug: 269 134 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-assert-pre
    Debug: 270 134 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 271 134 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 272 134 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_reset assert 1
    Debug: 273 135 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_reset assert 1
    Debug: 274 135 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 275 135 stm8.c:905 stm8_reset_assert(): stm8_reset_assert
    Debug: 276 135 hla_interface.c:127 hl_interface_execute_queue(): hl_interface_execute_queue: ignored
    Debug: 277 135 core.c:725 jtag_add_reset(): SRST line asserted
    Debug: 278 135 stlink_usb.c:1310 stlink_usb_assert_srst(): **************stlink_usb_assert_srst, srst=0
    Debug: 279 135 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-assert-post
    Debug: 280 136 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-assert-post
    Debug: 281 136 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-deassert-pre
    Debug: 282 136 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-deassert-pre
    Debug: 283 136 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 284 136 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 285 136 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_reset deassert 1
    Debug: 286 136 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_reset deassert 1
    Debug: 287 136 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 288 136 stm8.c:957 stm8_reset_deassert(): stm8_reset_deassert
    Debug: 289 136 stlink_usb.c:1310 stlink_usb_assert_srst(): **************stlink_usb_assert_srst, srst=1
    Debug: 290 137 hla_interface.c:127 hl_interface_execute_queue(): hl_interface_execute_queue: ignored
    Debug: 291 137 core.c:729 jtag_add_reset(): SRST line released
    Debug: 292 137 stm8.c:969 stm8_reset_deassert(): stm8_reset_deassert, target->state=2
    Debug: 293 137 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-deassert-post
    Debug: 294 137 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-deassert-post
    Debug: 295 137 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 296 137 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 297 137 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu was_examined
    Debug: 298 137 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu was_examined
    Debug: 299 138 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_waitstate halted 1000
    Debug: 300 138 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_waitstate halted 1000
    Debug: 301 138 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 302 144 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 303 144 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu curstate
    Debug: 304 144 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu curstate
    Debug: 305 144 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-end
    Debug: 306 144 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-end
    Debug: 307 144 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 308 160 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 309 160 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_init
    Debug: 310 160 command.c:143 script_debug(): command - init ocd_init
    Debug: 311 160 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 312 175 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 314 284 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 315 286 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 316 394 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 317 395 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 318 503 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 319 504 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 320 612 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 321 614 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 322 722 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 323 723 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 324 831 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 325 833 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 326 941 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 327 942 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 328 1050 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 329 1067 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 330 1175 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 331 1191 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 332 1300 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 333 1302 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 334 1409 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 335 1411 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 336 1519 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 337 1521 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 338 1628 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 339 1630 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 340 1738 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 341 1739 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 342 1846 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 343 1847 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 344 1955 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 345 1956 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 346 2064 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 347 2066 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 348 2174 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 349 2176 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 350 2283 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 351 2285 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 352 2393 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 353 2394 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 354 2502 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 355 2504 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 356 2611 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 357 2613 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 358 2721 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 359 2722 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 360 2830 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 361 2846 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 362 2955 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 363 2957 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 364 3065 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 365 3066 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 366 3174 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 367 3175 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 368 3283 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 369 3285 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 370 3393 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 371 3395 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 372 3503 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 373 3505 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 374 3613 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 375 3614 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 376 3722 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 377 3723 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 378 3831 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 379 3832 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 380 3941 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 381 3942 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 382 4050 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 383 4052 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 384 4159 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 385 4161 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 386 4269 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 387 4271 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 388 4378 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 389 4380 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 390 4488 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 391 4504 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 392 4613 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 393 4614 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 394 4722 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 395 4724 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 396 4830 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 397 4832 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 398 4939 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 399 4941 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 400 5049 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 401 5051 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 402 5158 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 403 5160 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 404 5267 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 405 5269 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 406 5377 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 407 5377 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 408 5486 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 409 5488 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 410 5596 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 411 5597 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 412 5705 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 413 5707 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 414 5814 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 415 5816 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 416 5924 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 417 5925 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 418 6033 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 419 6035 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 420 6143 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 421 6144 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 422 6252 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 423 6253 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 424 6361 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 425 6363 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 426 6471 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 427 6473 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 428 6580 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 429 6581 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 430 6690 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 431 6691 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 432 6799 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 433 6801 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 434 6901 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 435 6903 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 436 7014 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 437 7016 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 438 7123 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 439 7125 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 440 7233 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 441 7236 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 442 7342 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 443 7344 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 444 7452 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 445 7453 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 446 7561 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 447 7563 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 448 7670 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 449 7687 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 450 7798 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 451 7800 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 452 7908 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 453 7910 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 454 8017 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 455 8019 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 456 8127 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 457 8128 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 458 8236 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 459 8238 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 460 8345 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 461 8347 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 462 8457 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 463 8459 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 464 8566 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 465 8568 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 466 8676 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 467 8677 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 468 8785 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 469 8787 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 470 8895 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 471 8899 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 472 9004 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 473 9006 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 474 9113 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 475 9115 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 476 9223 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 477 9224 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 478 9332 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 479 9334 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 480 9441 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 481 9443 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 482 9551 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 483 9552 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 484 9660 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 485 9662 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 486 9770 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 487 9772 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 488 9879 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 489 9881 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 490 9988 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 491 9990 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 492 10098 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 493 10100 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 494 10207 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 495 10209 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 496 10316 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 497 10319 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 498 10426 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 499 10428 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 500 10535 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 501 10537 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 502 10645 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 503 10646 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 504 10747 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 505 10749 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 506 10861 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 507 10863 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 508 10971 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 509 10972 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 510 11080 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 511 11082 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 512 11189 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 513 11191 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 514 11299 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 515 11300 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 516 11408 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 517 11410 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 518 11510 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 519 11513 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 520 11615 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 521 11616 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 522 11732 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 523 11733 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 524 11838 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 525 11839 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 526 11947 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 527 11949 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 528 12049 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 529 12051 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 530 12166 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 531 12168 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 532 12269 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 533 12271 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 534 12382 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 535 12384 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 536 12492 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 537 12493 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    Debug: 538 12601 stm8.c:818 stm8_poll(): stm8_poll target->state=2
    Debug: 539 12603 stm8.c:857 stm8_poll(): stm8_poll csr1 = 0x10 csr2 = 0x08
    
     
  • akre

    akre - 2017-08-20

    Yea, it is normal, stm8_poll is called every few 100ms. That's why those msg are disabled not to spam the debug log...

    How ever, did you notice it does not show "TARGET: stm8.cpu - Not halted" anymore?

    Infact, I did make a small change to the code with regard to the target state. The target state variable was not updated to "halted" after reset...

    It could of course still be a race condition issue but I could make you a release version to see if the problem is gone...

     
  • Logan

    Logan - 2017-08-20

    Ah -- that makes sense. Sorry for any dumb questions/statements, I'm still getting up to speed on OpenOCD.

    I would be happy to test out a release version if you can put one together for me.

     
  • akre

    akre - 2017-08-20

    New openocd with improved reset handling (cygwin64).

    The problem is after reset was deasserted it takes some time before cpu comes out of reset. So I added a call to target_poll immediatley after deassert. This will keep openocd call stm8_poll until it is halted or it times out.

    Test and report any issues. If it works will add this patch to the source package.

     
  • Logan

    Logan - 2017-08-20

    Swapped in the patched version of openocd.exe. Looks like it's working as it should:

    $ openocd -f interface/stlink-v2.cfg -f target/stm8l152.cfg -c "init" -c "reset halt"
    Open On-Chip Debugger 0.10.0
    Licensed under GNU GPL v2
    For bug reports, read
            http://openocd.org/doc/doxygen/bugs.html
    adapter speed: RCLK - adaptive
    srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
    Info : Unable to match requested speed 0 kHz, using 5 kHz
    Info : Unable to match requested speed 0 kHz, using 5 kHz
    Info : RCLK (adaptive clock speed) not supported - fallback to 5 kHz
    Info : STLINK v2 JTAG v0 API v1 SWIM v6 VID 0x0483 PID 0x3748
    Info : using stlink api v1
    target halted due to debug-request, pc: 0x00006000
    

    Again, with debug mode enabled:

    $ openocd -f interface/stlink-v2.cfg -f target/stm8l152.cfg -c "init" -c "reset halt" -d3
    Open On-Chip Debugger 0.10.0
    Licensed under GNU GPL v2
    For bug reports, read
            http://openocd.org/doc/doxygen/bugs.html
    User : 13 1 command.c:544 command_print(): debug_level: 3
    Debug: 14 1 options.c:181 add_default_dirs(): bindir=/usr/local/bin
    Debug: 15 1 options.c:182 add_default_dirs(): pkgdatadir=/usr/local/share/openocd
    Debug: 16 2 options.c:183 add_default_dirs(): exepath=/usr/local/bin
    Debug: 17 2 options.c:184 add_default_dirs(): bin2data=../share/openocd
    Debug: 18 2 configuration.c:42 add_script_search_dir(): adding /home/Logan/.openocd
    Debug: 19 2 configuration.c:42 add_script_search_dir(): adding /usr/local/bin/../share/openocd/site
    Debug: 20 2 configuration.c:42 add_script_search_dir(): adding /usr/local/bin/../share/openocd/scripts
    Debug: 21 2 configuration.c:82 find_file(): found /usr/local/bin/../share/openocd/scripts/interface/stlink-v2.cfg
    Debug: 22 2 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_interface hla
    Debug: 23 2 command.c:143 script_debug(): command - interface ocd_interface hla
    Debug: 25 2 command.c:364 register_command_handler(): registering 'ocd_hla_device_desc'...
    Debug: 26 2 command.c:364 register_command_handler(): registering 'ocd_hla_serial'...
    Debug: 27 2 command.c:364 register_command_handler(): registering 'ocd_hla_layout'...
    Debug: 28 2 command.c:364 register_command_handler(): registering 'ocd_hla_vid_pid'...
    Debug: 29 2 command.c:364 register_command_handler(): registering 'ocd_hla_command'...
    Debug: 30 3 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla_layout stlink
    Debug: 31 3 command.c:143 script_debug(): command - hla_layout ocd_hla_layout stlink
    Debug: 33 3 hla_interface.c:239 hl_interface_handle_layout_command(): hl_interface_handle_layout_command
    Debug: 34 3 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla_device_desc ST-LINK/V2
    Debug: 35 3 command.c:143 script_debug(): command - hla_device_desc ocd_hla_device_desc ST-LINK/V2
    Debug: 37 3 hla_interface.c:213 hl_interface_handle_device_desc_command(): hl_interface_handle_device_desc_command
    Debug: 38 3 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla_vid_pid 0x0483 0x3748
    Debug: 39 3 command.c:143 script_debug(): command - hla_vid_pid ocd_hla_vid_pid 0x0483 0x3748
    Debug: 41 3 hla_interface.c:267 hl_interface_handle_vid_pid_command(): hl_interface_handle_vid_pid_command
    Debug: 42 3 configuration.c:82 find_file(): found /usr/local/bin/../share/openocd/scripts/target/stm8l152.cfg
    Debug: 43 4 configuration.c:82 find_file(): found /usr/local/bin/../share/openocd/scripts/target/stm8.cfg
    Debug: 44 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select stlink_swim
    Debug: 45 4 command.c:143 script_debug(): command - ocd_transport ocd_transport select stlink_swim
    Debug: 46 4 hla_transport.c:191 hl_transport_select(): hl_transport_select
    Debug: 47 4 command.c:364 register_command_handler(): registering 'ocd_hla'...
    Debug: 48 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 49 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 50 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 51 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 52 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 53 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 54 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 55 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 56 4 command.c:364 register_command_handler(): registering 'ocd_jtag'...
    Debug: 57 4 command.c:364 register_command_handler(): registering 'ocd_jtag_ntrst_delay'...
    Debug: 58 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_hla newtap stm8 cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0
    Debug: 59 4 command.c:143 script_debug(): command - ocd_hla ocd_hla newtap stm8 cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0
    Debug: 60 5 hla_tcl.c:116 jim_hl_newtap_cmd(): Creating New Tap, Chip: stm8, Tap: cpu, Dotted: stm8.cpu, 8 params
    Debug: 61 5 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -irlen
    Debug: 62 5 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -ircapture
    Debug: 63 5 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -irmask
    Debug: 64 5 hla_tcl.c:126 jim_hl_newtap_cmd(): Processing option: -expected-id
    Debug: 65 5 core.c:1304 jtag_tap_init(): Created Tap: stm8.cpu @ abs position 0, irlen 0, capture: 0x0 mask: 0x0
    Debug: 66 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target create stm8.cpu stm8 -chain-position stm8.cpu
    Debug: 67 5 command.c:143 script_debug(): command - ocd_target ocd_target create stm8.cpu stm8 -chain-position stm8.cpu
    Debug: 68 5 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 69 5 command.c:364 register_command_handler(): registering 'ocd_stm8'...
    Debug: 70 5 command.c:364 register_command_handler(): registering 'ocd_stm8'...
    Debug: 71 5 stm8.c:1143 stm8_target_create(): stm8_target_create
    Debug: 72 5 stm8.c:442 stm8_configure_break_unit(): hw breakpoints: numinst 2 numdata 2
    Debug: 73 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 74 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 75 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 76 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 77 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 78 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 79 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 80 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 81 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 82 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 83 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 84 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 85 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 86 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 87 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 88 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 89 5 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 90 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 91 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 92 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 93 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 94 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 95 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 96 6 command.c:364 register_command_handler(): registering 'ocd_stm8.cpu'...
    Debug: 97 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -work-area-phys 0x0 -work-area-size 0x400 -work-area-backup 1
    Debug: 98 6 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -work-area-phys 0x0 -work-area-size 0x400 -work-area-backup 1
    Debug: 99 6 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 100 6 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 101 6 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 102 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -flashstart 0x8000 -flashend 0xffff -eepromstart 0x1000 -eepromend 0x13ff -optionstart 0x4800 -optionend 0x487f -blocksize 0x80
    Debug: 103 6 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -flashstart 0x8000 -flashend 0xffff -eepromstart 0x1000 -eepromend 0x13ff -optionstart 0x4800 -optionend 0x487f -blocksize 0x80
    Debug: 104 6 stm8.c:1973 stm8_jim_configure(): stm8_jim_configure flashstart=00008000
    Debug: 105 6 stm8.c:1992 stm8_jim_configure(): stm8_jim_configure flashend=0000ffff
    Debug: 106 6 stm8.c:2011 stm8_jim_configure(): stm8_jim_configure eepromstart=00001000
    Debug: 107 6 stm8.c:2030 stm8_jim_configure(): stm8_jim_configure eepromend=000013ff
    Debug: 108 6 stm8.c:2049 stm8_jim_configure(): stm8_jim_configure optionstart=00004800
    Debug: 109 6 stm8.c:2068 stm8_jim_configure(): stm8_jim_configure optionend=0000487f
    Debug: 110 6 stm8.c:1954 stm8_jim_configure(): stm8_jim_configure blocksize=00000080
    Debug: 111 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -enable_stm8l
    Debug: 112 6 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -enable_stm8l
    Debug: 113 6 stm8.c:2086 stm8_jim_configure(): stm8_jim_configure enable_stm8l=00000001
    Debug: 114 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_adapter_khz 0
    Debug: 115 6 command.c:143 script_debug(): command - adapter_khz ocd_adapter_khz 0
    Debug: 117 6 core.c:1631 jtag_config_khz(): handle jtag khz
    Debug: 118 6 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    Debug: 119 6 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    User : 120 6 command.c:544 command_print(): adapter speed: RCLK - adaptive
    Debug: 121 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_reset_config srst_only
    Debug: 122 6 command.c:143 script_debug(): command - reset_config ocd_reset_config srst_only
    User : 124 6 command.c:544 command_print(): srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
    Debug: 125 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_init
    Debug: 126 7 command.c:143 script_debug(): command - init ocd_init
    Debug: 128 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target init
    Debug: 129 7 command.c:143 script_debug(): command - ocd_target ocd_target init
    Debug: 131 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target names
    Debug: 132 7 command.c:143 script_debug(): command - ocd_target ocd_target names
    Debug: 133 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu cget -event gdb-flash-erase-start
    Debug: 134 7 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu cget -event gdb-flash-erase-start
    Debug: 135 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -event gdb-flash-erase-start reset init
    Debug: 136 7 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -event gdb-flash-erase-start reset init
    Debug: 137 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu cget -event gdb-flash-write-end
    Debug: 138 7 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu cget -event gdb-flash-write-end
    Debug: 139 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu configure -event gdb-flash-write-end reset halt
    Debug: 140 7 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu configure -event gdb-flash-write-end reset halt
    Debug: 141 7 target.c:1326 handle_target_init_command(): Initializing targets...
    Debug: 142 7 stm8.c:806 stm8_init(): stm8_init
    Debug: 143 7 command.c:364 register_command_handler(): registering 'ocd_target_request'...
    Debug: 144 7 command.c:364 register_command_handler(): registering 'ocd_trace'...
    Debug: 145 7 command.c:364 register_command_handler(): registering 'ocd_trace'...
    Debug: 146 7 command.c:364 register_command_handler(): registering 'ocd_fast_load_image'...
    Debug: 147 7 command.c:364 register_command_handler(): registering 'ocd_fast_load'...
    Debug: 148 7 command.c:364 register_command_handler(): registering 'ocd_profile'...
    Debug: 149 7 command.c:364 register_command_handler(): registering 'ocd_virt2phys'...
    Debug: 150 7 command.c:364 register_command_handler(): registering 'ocd_reg'...
    Debug: 151 7 command.c:364 register_command_handler(): registering 'ocd_poll'...
    Debug: 152 7 command.c:364 register_command_handler(): registering 'ocd_wait_halt'...
    Debug: 153 8 command.c:364 register_command_handler(): registering 'ocd_halt'...
    Debug: 154 8 command.c:364 register_command_handler(): registering 'ocd_resume'...
    Debug: 155 8 command.c:364 register_command_handler(): registering 'ocd_reset'...
    Debug: 156 8 command.c:364 register_command_handler(): registering 'ocd_soft_reset_halt'...
    Debug: 157 8 command.c:364 register_command_handler(): registering 'ocd_step'...
    Debug: 158 8 command.c:364 register_command_handler(): registering 'ocd_mdw'...
    Debug: 159 8 command.c:364 register_command_handler(): registering 'ocd_mdh'...
    Debug: 160 8 command.c:364 register_command_handler(): registering 'ocd_mdb'...
    Debug: 161 8 command.c:364 register_command_handler(): registering 'ocd_mww'...
    Debug: 162 8 command.c:364 register_command_handler(): registering 'ocd_mwh'...
    Debug: 163 8 command.c:364 register_command_handler(): registering 'ocd_mwb'...
    Debug: 164 8 command.c:364 register_command_handler(): registering 'ocd_bp'...
    Debug: 165 8 command.c:364 register_command_handler(): registering 'ocd_rbp'...
    Debug: 166 8 command.c:364 register_command_handler(): registering 'ocd_wp'...
    Debug: 167 8 command.c:364 register_command_handler(): registering 'ocd_rwp'...
    Debug: 168 8 command.c:364 register_command_handler(): registering 'ocd_load_image'...
    Debug: 169 8 command.c:364 register_command_handler(): registering 'ocd_dump_image'...
    Debug: 170 8 command.c:364 register_command_handler(): registering 'ocd_verify_image_checksum'...
    Debug: 171 8 command.c:364 register_command_handler(): registering 'ocd_verify_image'...
    Debug: 172 8 command.c:364 register_command_handler(): registering 'ocd_test_image'...
    Debug: 173 8 command.c:364 register_command_handler(): registering 'ocd_reset_nag'...
    Debug: 174 8 command.c:364 register_command_handler(): registering 'ocd_ps'...
    Debug: 175 8 command.c:364 register_command_handler(): registering 'ocd_test_mem_access'...
    Debug: 176 8 hla_interface.c:109 hl_interface_init(): hl_interface_init
    Debug: 177 8 hla_layout.c:83 hl_layout_init(): hl_layout_init
    Debug: 178 8 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    Debug: 179 8 core.c:1601 adapter_khz_to_speed(): have interface set up
    Info : 180 8 stlink_usb.c:1937 stlink_speed(): Unable to match requested speed 0 kHz, using 5 kHz
    Debug: 181 8 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
    Debug: 182 8 core.c:1601 adapter_khz_to_speed(): have interface set up
    Info : 183 8 stlink_usb.c:1937 stlink_speed(): Unable to match requested speed 0 kHz, using 5 kHz
    Info : 184 8 core.c:1384 adapter_init(): RCLK (adaptive clock speed) not supported - fallback to 5 kHz
    Debug: 185 8 openocd.c:140 handle_init_command(): Debug Adapter init complete
    Debug: 186 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport init
    Debug: 187 9 command.c:143 script_debug(): command - ocd_transport ocd_transport init
    Debug: 189 9 transport.c:239 handle_transport_init(): handle_transport_init
    Debug: 190 9 hla_transport.c:152 hl_transport_init(): hl_transport_init
    Debug: 191 9 hla_transport.c:169 hl_transport_init(): current transport stlink_swim
    Debug: 192 9 hla_interface.c:42 hl_interface_open(): hl_interface_open
    Debug: 193 9 hla_layout.c:40 hl_layout_open(): hl_layout_open
    Debug: 194 9 stlink_usb.c:1971 stlink_usb_open(): stlink_usb_open
    Debug: 195 9 stlink_usb.c:1988 stlink_usb_open(): transport: 3 vid: 0x0483 pid: 0x3748 serial:
    Info : 196 16 stlink_usb.c:658 stlink_usb_version(): STLINK v2 JTAG v0 API v1 SWIM v6 VID 0x0483 PID 0x3748
    Info : 197 16 stlink_usb.c:2099 stlink_usb_open(): using stlink api v1
    Debug: 198 16 stlink_usb.c:859 stlink_usb_init_mode(): MODE: 0x03
    Debug: 199 17 stlink_usb.c:914 stlink_usb_init_mode(): MODE: 0x01
    Debug: 200 17 stlink_usb.c:934 stlink_usb_init_mode(): MODE: 0x03
    Debug: 201 27 hla_interface.c:127 hl_interface_execute_queue(): hl_interface_execute_queue: ignored
    Debug: 202 27 core.c:729 jtag_add_reset(): SRST line released
    Debug: 203 27 core.c:753 jtag_add_reset(): TRST line released
    Debug: 204 27 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
    Debug: 205 27 hla_interface.c:67 hl_interface_init_target(): hl_interface_init_target
    Debug: 206 28 openocd.c:153 handle_init_command(): Examining targets...
    Debug: 207 28 target.c:1519 target_call_event_callbacks(): target event 21 (examine-start)
    Debug: 208 28 stm8.c:1673 stm8_examine(): stm8_examine
    Debug: 209 28 stm8.c:1678 stm8_examine(): writing A0 to SWIM_CSR
    Debug: 210 29 stm8.c:1683 stm8_examine(): writing B0 to SWIM_CSR
    Debug: 211 31 target.c:1519 target_call_event_callbacks(): target event 22 (examine-end)
    Debug: 212 31 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_flash init
    Debug: 213 31 command.c:143 script_debug(): command - ocd_flash ocd_flash init
    Debug: 214 33 stm8.c:845 stm8_poll(): DM_CSR2_STALL already set during server startup.
    Debug: 215 34 stm8.c:1169 stm8_read_core_reg(): read core reg 0 value 0x6000
    Debug: 216 34 stm8.c:1169 stm8_read_core_reg(): read core reg 1 value 0x0
    Debug: 217 34 stm8.c:1169 stm8_read_core_reg(): read core reg 2 value 0x0
    Debug: 218 34 stm8.c:1169 stm8_read_core_reg(): read core reg 3 value 0x0
    Debug: 219 34 stm8.c:1169 stm8_read_core_reg(): read core reg 4 value 0x7ff
    Debug: 220 34 stm8.c:1169 stm8_read_core_reg(): read core reg 5 value 0x28
    Debug: 221 37 stm8.c:455 stm8_examine_debug_reason(): stm8_examine_debug_reason csr1 = 0x10 csr2 = 0x08
    Debug: 222 37 stm8.c:495 stm8_debug_entry(): entered debug state at PC 0x6000, target->state: halted
    Debug: 223 38 target.c:1519 target_call_event_callbacks(): target event 0 (gdb-halt)
    Debug: 224 38 target.c:1519 target_call_event_callbacks(): target event 1 (halted)
    Debug: 226 38 tcl.c:1099 handle_flash_init_command(): Initializing flash devices...
    Debug: 227 38 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_mflash init
    Debug: 228 38 command.c:143 script_debug(): command - ocd_mflash ocd_mflash init
    Debug: 230 39 mflash.c:1377 handle_mflash_init_command(): Initializing mflash devices...
    Debug: 231 39 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_nand init
    Debug: 232 39 command.c:143 script_debug(): command - ocd_nand ocd_nand init
    Debug: 234 41 tcl.c:497 handle_nand_init_command(): Initializing NAND devices...
    Debug: 235 41 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_pld init
    Debug: 236 41 command.c:143 script_debug(): command - ocd_pld ocd_pld init
    Debug: 238 43 pld.c:205 handle_pld_init_command(): Initializing PLDs...
    Debug: 239 45 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_reset halt
    Debug: 240 45 command.c:143 script_debug(): command - reset ocd_reset halt
    Debug: 242 45 target.c:1537 target_call_reset_callbacks(): target reset 2 (halt)
    Debug: 243 45 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target names
    Debug: 244 45 command.c:143 script_debug(): command - ocd_target ocd_target names
    Debug: 245 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-start
    Debug: 246 46 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-start
    Debug: 247 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 248 46 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 249 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 250 46 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 251 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event examine-start
    Debug: 252 46 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event examine-start
    Debug: 253 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_examine allow-defer
    Debug: 254 46 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_examine allow-defer
    Debug: 255 46 stm8.c:1673 stm8_examine(): stm8_examine
    Debug: 256 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event examine-end
    Debug: 257 46 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event examine-end
    Debug: 258 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-assert-pre
    Debug: 259 46 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-assert-pre
    Debug: 260 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 261 46 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 262 46 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_reset assert 1
    Debug: 263 46 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_reset assert 1
    Debug: 264 46 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 265 46 stm8.c:919 stm8_reset_assert(): stm8_reset_assert
    Debug: 266 46 hla_interface.c:127 hl_interface_execute_queue(): hl_interface_execute_queue: ignored
    Debug: 267 46 core.c:725 jtag_add_reset(): SRST line asserted
    Debug: 268 46 stlink_usb.c:1310 stlink_usb_assert_srst(): **************stlink_usb_assert_srst, srst=0
    Debug: 269 47 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-assert-post
    Debug: 270 47 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-assert-post
    Debug: 271 47 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-deassert-pre
    Debug: 272 47 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-deassert-pre
    Debug: 273 47 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 274 47 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 275 47 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_reset deassert 1
    Debug: 276 47 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_reset deassert 1
    Debug: 277 47 target.c:1901 target_free_all_working_areas_restore(): freeing all working areas
    Debug: 278 47 stm8.c:971 stm8_reset_deassert(): stm8_reset_deassert
    Debug: 279 47 stlink_usb.c:1310 stlink_usb_assert_srst(): **************stlink_usb_assert_srst, srst=1
    Debug: 280 48 hla_interface.c:127 hl_interface_execute_queue(): hl_interface_execute_queue: ignored
    Debug: 281 48 core.c:729 jtag_add_reset(): SRST line released
    Debug: 282 48 stm8.c:984 stm8_reset_deassert(): stm8_reset_deassert, target->state=3
    Debug: 283 51 stm8.c:832 stm8_poll(): stm8_poll stm8_read_dm_csrx failed retval=-4
    Debug: 284 51 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-deassert-post
    Debug: 285 51 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-deassert-post
    Debug: 286 51 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
    Debug: 287 51 command.c:143 script_debug(): command - ocd_transport ocd_transport select
    Debug: 288 51 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu was_examined
    Debug: 289 51 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu was_examined
    Debug: 290 51 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu arp_waitstate halted 1000
    Debug: 291 51 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu arp_waitstate halted 1000
    Debug: 292 53 stm8.c:832 stm8_poll(): stm8_poll stm8_read_dm_csrx failed retval=-4
    Debug: 293 53 target.c:2804 target_wait_state(): waiting for target halted...
    Debug: 294 54 stm8.c:832 stm8_poll(): stm8_poll stm8_read_dm_csrx failed retval=-4
    Debug: 295 56 stm8.c:832 stm8_poll(): stm8_poll stm8_read_dm_csrx failed retval=-4
    Debug: 296 58 stm8.c:832 stm8_poll(): stm8_poll stm8_read_dm_csrx failed retval=-4
    Debug: 297 60 stm8.c:1169 stm8_read_core_reg(): read core reg 0 value 0x6000
    Debug: 298 60 stm8.c:1169 stm8_read_core_reg(): read core reg 1 value 0x0
    Debug: 299 60 stm8.c:1169 stm8_read_core_reg(): read core reg 2 value 0x0
    Debug: 300 60 stm8.c:1169 stm8_read_core_reg(): read core reg 3 value 0x0
    Debug: 301 60 stm8.c:1169 stm8_read_core_reg(): read core reg 4 value 0x7ff
    Debug: 302 60 stm8.c:1169 stm8_read_core_reg(): read core reg 5 value 0x28
    Debug: 303 63 stm8.c:455 stm8_examine_debug_reason(): stm8_examine_debug_reason csr1 = 0x10 csr2 = 0x08
    Debug: 304 63 stm8.c:495 stm8_debug_entry(): entered debug state at PC 0x6000, target->state: halted
    Debug: 305 63 target.c:1519 target_call_event_callbacks(): target event 0 (gdb-halt)
    Debug: 306 63 target.c:1519 target_call_event_callbacks(): target event 1 (halted)
    User : 307 63 stm8.c:1286 stm8_arch_state(): target halted due to debug-request, pc: 0x00006000
    Debug: 308 63 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu curstate
    Debug: 309 63 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu curstate
    Debug: 310 63 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm8.cpu invoke-event reset-end
    Debug: 311 63 command.c:143 script_debug(): command - ocd_stm8.cpu ocd_stm8.cpu invoke-event reset-end
    Debug: 312 64 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_init
    Debug: 313 64 command.c:143 script_debug(): command - init ocd_init
    

    Thank you for resolving this so quickly!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.