Segmentation Fault on openocd start in linux ubuntu

I have downloaded blink on freedom-e300-arty using Arduino IDE on Mac and it works properly. Currently I am trying to use freedom-e-sdk on linux to download demo_gpio.

the following make software command works fine:
cd freedom-e-sdk
make software PROGRAM=demo_gpio BOARD=freedom-e300-arty
however when I try the make upload command it fails due to this error:
localhost:3333: Connection timed out.

the following is the log of make upload PROGRAM=demo_gpio BOARD=freedom-e300-arty:

work/build/openocd/prefix/bin/openocd -f bsp/env/freedom-e300-arty/openocd.cfg &
/home/kcharfi/freedom-e-sdk/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gdb software/demo_gpio/demo_gpio --batch -ex “set remotetimeout 240” -ex “target extended-remote localhost:3333” -ex “monitor reset halt” -ex “monitor flash protect 0 64 last off” -ex “load” -ex “monitor resume” -ex “monitor shutdown” -ex “quit”;
echo "Successfully uploaded ‘demo_gpio’ to freedom-e300-arty."
Open On-Chip Debugger 0.10.0-dev-g563f6ac (2017-05-17-12:29)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 10000 kHz
Info : auto-selecting first available session transport “jtag”. To override use 'transport select ‘.
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz
Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (), part: 0x0e31, ver: 0x1)
Info : Examined RISCV core; XLEN=32, misa=0x40001105
localhost:3333: Connection timed out.
“monitor” command not supported by this target.
“monitor” command not supported by this target.
You can’t do that when your target is `exec’
“monitor” command not supported by this target.
“monitor” command not supported by this target.
Successfully uploaded ‘demo_gpio’ to freedom-e300-arty.

So I figured that openocd or gdb didn’t start so I tried the following command to test work/build/openocd/prefix/bin/openocd -f bsp/env/freedom-e300-arty/openocd.cfg -d
and it resulted in Segmentation fault. the following is the log that resulted from the above command

Open On-Chip Debugger 0.10.0-dev-g563f6ac (2017-05-17-12:29)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
User : 13 4 command.c:544 command_print(): debug_level: 3
Debug: 14 4 options.c:96 add_default_dirs(): bindir=/home/kcharfi/freedom-e-sdk/work/build/openocd/prefix/bin
Debug: 15 4 options.c:97 add_default_dirs(): pkgdatadir=/home/kcharfi/freedom-e-sdk/work/build/openocd/prefix/share/openocd
Debug: 16 4 options.c:98 add_default_dirs(): run_prefix=
Debug: 17 4 configuration.c:42 add_script_search_dir(): adding /home/kcharfi/.openocd
Debug: 18 4 configuration.c:42 add_script_search_dir(): adding /home/kcharfi/freedom-e-sdk/work/build/openocd/prefix/share/openocd/site
Debug: 19 4 configuration.c:42 add_script_search_dir(): adding /home/kcharfi/freedom-e-sdk/work/build/openocd/prefix/share/openocd/scripts
Debug: 20 4 configuration.c:82 find_file(): found bsp/env/freedom-e300-arty/openocd.cfg
Debug: 21 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_adapter_khz 10000
Debug: 22 4 command.c:143 script_debug(): command - adapter_khz ocd_adapter_khz 10000
Debug: 24 4 core.c:1745 jtag_config_khz(): handle jtag khz
Debug: 25 4 core.c:1712 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 26 4 core.c:1712 adapter_khz_to_speed(): convert khz to interface specific speed value
User : 27 4 command.c:544 command_print(): adapter speed: 10000 kHz
Debug: 28 4 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_interface ftdi
Debug: 29 4 command.c:143 script_debug(): command - interface ocd_interface ftdi
Debug: 31 4 command.c:364 register_command_handler(): registering ‘ocd_ftdi_device_desc’…
Debug: 32 4 command.c:364 register_command_handler(): registering ‘ocd_ftdi_serial’…
Debug: 33 5 command.c:364 register_command_handler(): registering ‘ocd_ftdi_location’…
Debug: 34 5 command.c:364 register_command_handler(): registering ‘ocd_ftdi_channel’…
Debug: 35 5 command.c:364 register_command_handler(): registering ‘ocd_ftdi_layout_init’…
Debug: 36 5 command.c:364 register_command_handler(): registering ‘ocd_ftdi_layout_signal’…
Debug: 37 5 command.c:364 register_command_handler(): registering ‘ocd_ftdi_set_signal’…
Debug: 38 5 command.c:364 register_command_handler(): registering ‘ocd_ftdi_get_signal’…
Debug: 39 5 command.c:364 register_command_handler(): registering ‘ocd_ftdi_vid_pid’…
Debug: 40 5 command.c:364 register_command_handler(): registering ‘ocd_ftdi_tdo_sample_edge’…
Debug: 41 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_device_desc Olimex OpenOCD JTAG ARM-USB-TINY-H
Debug: 42 5 command.c:143 script_debug(): command - ftdi_device_desc ocd_ftdi_device_desc Olimex OpenOCD JTAG ARM-USB-TINY-H
Debug: 44 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_vid_pid 0x15ba 0x002a
Debug: 45 5 command.c:143 script_debug(): command - ftdi_vid_pid ocd_ftdi_vid_pid 0x15ba 0x002a
Debug: 47 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_layout_init 0x0808 0x0a1b
Debug: 48 5 command.c:143 script_debug(): command - ftdi_layout_init ocd_ftdi_layout_init 0x0808 0x0a1b
Debug: 50 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_layout_signal nSRST -oe 0x0200
Debug: 51 5 command.c:143 script_debug(): command - ftdi_layout_signal ocd_ftdi_layout_signal nSRST -oe 0x0200
Debug: 53 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_layout_signal nTRST -data 0x0100 -oe 0x0100
Debug: 54 5 command.c:143 script_debug(): command - ftdi_layout_signal ocd_ftdi_layout_signal nTRST -data 0x0100 -oe 0x0100
Debug: 56 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_ftdi_layout_signal LED -data 0x0800
Debug: 57 5 command.c:143 script_debug(): command - ftdi_layout_signal ocd_ftdi_layout_signal LED -data 0x0800
Debug: 59 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
Debug: 60 5 command.c:143 script_debug(): command - ocd_transport ocd_transport select
Info : 61 5 transport.c:286 jim_transport_select(): auto-selecting first available session transport “jtag”. To override use 'transport select '.
Debug: 62 6 command.c:364 register_command_handler(): registering ‘ocd_jtag_flush_queue_sleep’…
Debug: 63 6 command.c:364 register_command_handler(): registering ‘ocd_jtag_rclk’…
Debug: 64 6 command.c:364 register_command_handler(): registering ‘ocd_jtag_ntrst_delay’…
Debug: 65 6 command.c:364 register_command_handler(): registering ‘ocd_jtag_ntrst_assert_width’…
Debug: 66 6 command.c:364 register_command_handler(): registering ‘ocd_scan_chain’…
Debug: 67 6 command.c:364 register_command_handler(): registering ‘ocd_jtag_reset’…
Debug: 68 6 command.c:364 register_command_handler(): registering ‘ocd_runtest’…
Debug: 69 6 command.c:364 register_command_handler(): registering ‘ocd_irscan’…
Debug: 70 6 command.c:364 register_command_handler(): registering ‘ocd_verify_ircapture’…
Debug: 71 6 command.c:364 register_command_handler(): registering ‘ocd_verify_jtag’…
Debug: 72 6 command.c:364 register_command_handler(): registering ‘ocd_tms_sequence’…
Debug: 73 6 command.c:364 register_command_handler(): registering ‘ocd_wait_srst_deassert’…
Debug: 74 6 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 75 6 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 76 6 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 77 6 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 78 6 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 79 6 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 80 6 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 81 6 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 82 6 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 83 6 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 84 6 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 85 6 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 86 6 command.c:364 register_command_handler(): registering ‘ocd_jtag’…
Debug: 87 6 command.c:364 register_command_handler(): registering ‘ocd_svf’…
Debug: 88 6 command.c:364 register_command_handler(): registering ‘ocd_xsvf’…
Debug: 89 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport select
Debug: 90 6 command.c:143 script_debug(): command - ocd_transport ocd_transport select
Debug: 91 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_jtag newtap riscv cpu -irlen 5 -expected-id 0x10e31913
Debug: 92 6 command.c:143 script_debug(): command - ocd_jtag ocd_jtag newtap riscv cpu -irlen 5 -expected-id 0x10e31913
Debug: 93 6 tcl.c:549 jim_newtap_cmd(): Creating New Tap, Chip: riscv, Tap: cpu, Dotted: riscv.cpu, 4 params
Debug: 94 6 tcl.c:573 jim_newtap_cmd(): Processing option: -irlen
Debug: 95 6 tcl.c:573 jim_newtap_cmd(): Processing option: -expected-id
Debug: 96 7 core.c:1418 jtag_tap_init(): Created Tap: riscv.cpu abs position 0, irlen 5, capture: 0x1 mask: 0x3
Debug: 97 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target create riscv.cpu riscv -chain-position riscv.cpu
Debug: 98 7 command.c:143 script_debug(): command - ocd_target ocd_target create riscv.cpu riscv -chain-position riscv.cpu
Debug: 99 7 target.c:1894 target_free_all_working_areas_restore(): freeing all working areas
Debug: 100 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 101 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 102 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 103 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 104 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 105 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 106 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 107 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 108 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 109 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 110 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 111 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 112 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 113 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 114 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 115 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 116 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 117 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 118 7 command.c:364 register_command_handler(): registering ‘ocd_riscv.cpu’…
Debug: 119 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1
Debug: 120 7 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1
Debug: 121 7 target.c:1894 target_free_all_working_areas_restore(): freeing all working areas
Debug: 122 7 target.c:1894 target_free_all_working_areas_restore(): freeing all working areas
Debug: 123 7 target.c:1894 target_free_all_working_areas_restore(): freeing all working areas
Debug: 124 7 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_flash bank my_first_flash fespi 0x20000000 0 0 0 riscv.cpu
Debug: 125 7 command.c:143 script_debug(): command - ocd_flash ocd_flash bank my_first_flash fespi 0x20000000 0 0 0 riscv.cpu
Debug: 127 7 fespi.c:177 fespi_flash_bank_command(): fespi_flash_bank_command
Debug: 128 7 tcl.c:1032 handle_flash_bank_command(): ‘fespi’ driver usage field missing
Debug: 129 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_init
Debug: 130 8 command.c:143 script_debug(): command - init ocd_init
Debug: 132 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target init
Debug: 133 8 command.c:143 script_debug(): command - ocd_target ocd_target init
Debug: 135 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_target names
Debug: 136 8 command.c:143 script_debug(): command - ocd_target ocd_target names
Debug: 137 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu cget -event gdb-flash-erase-start
Debug: 138 8 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu cget -event gdb-flash-erase-start
Debug: 139 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu configure -event gdb-flash-erase-start reset init
Debug: 140 8 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu configure -event gdb-flash-erase-start reset init
Debug: 141 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu cget -event gdb-flash-write-end
Debug: 142 8 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu cget -event gdb-flash-write-end
Debug: 143 8 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_riscv.cpu configure -event gdb-flash-write-end reset halt
Debug: 144 8 command.c:143 script_debug(): command - ocd_riscv.cpu ocd_riscv.cpu configure -event gdb-flash-write-end reset halt
Debug: 145 8 target.c:1319 handle_target_init_command(): Initializing targets…
Debug: 146 8 riscv.c:246 riscv_init_target(): riscv_init_target()
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 9 command.c:364 register_command_handler(): registering ‘ocd_halt’…
Debug: 158 9 command.c:364 register_command_handler(): registering ‘ocd_resume’…
Debug: 159 9 command.c:364 register_command_handler(): registering ‘ocd_reset’…
Debug: 160 9 command.c:364 register_command_handler(): registering ‘ocd_soft_reset_halt’…
Debug: 161 9 command.c:364 register_command_handler(): registering ‘ocd_step’…
Debug: 162 9 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’…
Debug: 175 9 command.c:364 register_command_handler(): registering ‘ocd_test_image’…
Debug: 176 9 command.c:364 register_command_handler(): registering ‘ocd_reset_nag’…
Debug: 177 9 command.c:364 register_command_handler(): registering ‘ocd_ps’…
Debug: 178 9 command.c:364 register_command_handler(): registering ‘ocd_test_mem_access’…
Debug: 179 9 ftdi.c:692 ftdi_initialize(): ftdi interface using shortest path jtag state transitions
Debug: 180 20 mpsse.c:422 mpsse_purge(): -
Debug: 181 20 mpsse.c:703 mpsse_loopback_config(): off
Debug: 182 20 mpsse.c:748 mpsse_set_frequency(): target 10000000 Hz
Debug: 183 20 mpsse.c:740 mpsse_rtck_config(): off
Debug: 184 20 mpsse.c:729 mpsse_divide_by_5_config(): off
Debug: 185 20 mpsse.c:709 mpsse_set_divisor(): 2
Debug: 186 20 mpsse.c:772 mpsse_set_frequency(): actually 10000000 Hz
Debug: 187 20 core.c:1712 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 188 20 core.c:1715 adapter_khz_to_speed(): have interface set up
Debug: 189 20 mpsse.c:748 mpsse_set_frequency(): target 10000000 Hz
Debug: 190 20 mpsse.c:740 mpsse_rtck_config(): off
Debug: 191 20 mpsse.c:729 mpsse_divide_by_5_config(): off
Debug: 192 20 mpsse.c:709 mpsse_set_divisor(): 2
Debug: 193 20 mpsse.c:772 mpsse_set_frequency(): actually 10000000 Hz
Info : 194 20 ftdi.c:291 ftdi_speed(): ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Debug: 195 20 core.c:1712 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 196 20 core.c:1715 adapter_khz_to_speed(): have interface set up
Info : 197 20 core.c:1500 adapter_init(): clock speed 10000 kHz
Debug: 198 20 openocd.c:135 handle_init_command(): Debug Adapter init complete
Debug: 199 20 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport init
Debug: 200 20 command.c:143 script_debug(): command - ocd_transport ocd_transport init
Debug: 202 20 transport.c:239 handle_transport_init(): handle_transport_init
Debug: 203 20 core.c:729 jtag_add_reset(): SRST line released
Debug: 204 21 core.c:753 jtag_add_reset(): TRST line released
Debug: 205 21 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 206 21 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_jtag arp_init
Debug: 207 21 command.c:143 script_debug(): command - ocd_jtag ocd_jtag arp_init
Debug: 208 21 core.c:1513 jtag_init_inner(): Init JTAG chain
Debug: 209 21 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 210 21 core.c:1173 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASS
Debug: 211 21 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Info : 212 21 core.c:1072 jtag_examine_chain_display(): JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (), part: 0x0e31, ver: 0x1)
Debug: 213 21 core.c:1304 jtag_validate_ircapture(): IR capture validation scan
Debug: 214 21 core.c:1362 jtag_validate_ircapture(): riscv.cpu: IR capture 0x01
Debug: 215 21 openocd.c:148 handle_init_command(): Examining targets…
Debug: 216 21 target.c:1512 target_call_event_callbacks(): target event 21 (examine-start)
Debug: 217 21 riscv.c:313 riscv_examine(): riscv_examine()
Debug: 218 21 riscv.c:223 dtmcontrol_scan(): DTMCONTROL: 0x0 -> 0x1450
Debug: 219 21 riscv.c:323 riscv_examine(): dtmcontrol=0x1450
Debug: 220 21 riscv.c:325 riscv_examine(): version=0x0
Debug: 221 21 riscv-011.c:1439 init_target(): init
Debug: 222 23 riscv-011.c:330 dtmcontrol_scan(): DTMCONTROL: 0x0 -> 0x1450
Debug: 223 23 riscv-011.c:1799 examine(): dtmcontrol=0x1450
Debug: 224 23 riscv-011.c:1800 examine(): addrbits=5
Debug: 225 23 riscv-011.c:1801 examine(): version=0
Debug: 226 23 riscv-011.c:1802 examine(): idle=5
Debug: 227 23 riscv-011.c:430 scan(): 41b r …:00000000 11 -> + …:30102473 00
Debug: 228 23 riscv-011.c:430 scan(): 41b r …:00000000 11 -> + …:00001821 11
Debug: 229 23 riscv-011.c:1827 examine(): dminfo: 0x00001821
Debug: 230 23 riscv-011.c:1828 examine(): abussize=0x0
Debug: 231 23 riscv-011.c:1829 examine(): serialcount=0x0
Debug: 232 23 riscv-011.c:1830 examine(): access128=0
Debug: 233 23 riscv-011.c:1831 examine(): access64=0
Debug: 234 23 riscv-011.c:1832 examine(): access32=0
Debug: 235 23 riscv-011.c:1833 examine(): access16=0
Debug: 236 23 riscv-011.c:1834 examine(): access8=0
Debug: 237 23 riscv-011.c:1835 examine(): dramsize=0x6
Debug: 238 23 riscv-011.c:1836 examine(): authenticated=0x1
Debug: 239 23 riscv-011.c:1837 examine(): authbusy=0x0
Debug: 240 23 riscv-011.c:1838 examine(): authtype=0x0
Debug: 241 23 riscv-011.c:1839 examine(): version=0x1
Debug: 242 23 riscv-011.c:770 cache_set32(): cache[0x0] = 0xfff04493
Debug: 243 23 riscv-011.c:770 cache_set32(): cache[0x1] = 0x1f4d493
Debug: 244 23 riscv-011.c:770 cache_set32(): cache[0x2] = 0x40902023
Debug: 245 23 riscv-011.c:770 cache_set32(): cache[0x3] = 0x1f4d493
Debug: 246 23 riscv-011.c:770 cache_set32(): cache[0x4] = 0x40902223
Debug: 247 23 riscv-011.c:770 cache_set32(): cache[0x5] = 0x3f00006f
Debug: 248 23 riscv-011.c:770 cache_set32(): cache[0x6] = 0x60c1218
Debug: 249 23 riscv-011.c:862 cache_write(): enter
Debug: 250 23 riscv-011.c:430 scan(): 41b w .h:fff04493 00 -> + …:00001821 11
Debug: 251 23 riscv-011.c:430 scan(): 41b w .h:01f4d493 01 -> + …:30102473 00
Debug: 252 23 riscv-011.c:430 scan(): 41b w .h:40902023 02 -> + …:40802823 01
Debug: 253 23 riscv-011.c:430 scan(): 41b w .h:01f4d493 03 -> + …:3fc0006f 02
Debug: 254 23 riscv-011.c:430 scan(): 41b w .h:40902223 04 -> + …:01f4d493 03
Debug: 255 23 riscv-011.c:430 scan(): 41b w .h:3f00006f 05 -> + …:40001105 04
Debug: 256 23 riscv-011.c:430 scan(): 41b w .h:060c1218 06 -> + …:3f00006f 05
Debug: 257 23 riscv-011.c:430 scan(): 41b r .h:00000000 00 -> + …:00000000 06
Debug: 258 23 riscv-011.c:430 scan(): 41b r .h:00000000 00 -> + …:fff04493 00
Debug: 259 23 riscv-011.c:981 cache_write(): exit
Debug: 260 23 riscv-011.c:430 scan(): 41b r …:00000000 00 -> + …:fff04493 00
Debug: 261 23 riscv-011.c:430 scan(): 41b r …:00000000 01 -> + …:fff04493 00
Debug: 262 24 riscv-011.c:430 scan(): 41b r …:00000000 01 -> + …:01f4d493 01
Debug: 263 24 riscv-011.c:430 scan(): 41b r …:00000000 02 -> + …:01f4d493 01
Debug: 264 24 riscv-011.c:430 scan(): 41b r …:00000000 02 -> + …:40902023 02
Debug: 265 24 riscv-011.c:430 scan(): 41b r …:00000000 03 -> + …:40902023 02
Debug: 266 24 riscv-011.c:430 scan(): 41b r …:00000000 03 -> + …:01f4d493 03
Debug: 267 24 riscv-011.c:430 scan(): 41b r …:00000000 04 -> + …:01f4d493 03
Debug: 268 24 riscv-011.c:430 scan(): 41b r …:00000000 04 -> + …:40902223 04
Debug: 269 24 riscv-011.c:430 scan(): 41b r …:00000000 05 -> + …:40902223 04
Debug: 270 24 riscv-011.c:430 scan(): 41b r …:00000000 05 -> + …:3f00006f 05
Debug: 271 24 riscv-011.c:430 scan(): 41b r …:00000000 06 -> + …:3f00006f 05
Debug: 272 24 riscv-011.c:430 scan(): 41b r …:00000000 06 -> + …:060c1218 06
Debug: 273 24 riscv-011.c:862 cache_write(): enter
Debug: 274 25 riscv-011.c:430 scan(): 41b w ih:00000000 10 -> + …:060c1218 06
Debug: 275 25 riscv-011.c:430 scan(): 41b r .h:00000000 00 -> + …:00002000 10
Debug: 276 25 riscv-011.c:430 scan(): 41b r .h:00000000 00 -> + …:00000001 00
Debug: 277 25 riscv-011.c:981 cache_write(): exit
Debug: 278 25 riscv-011.c:430 scan(): 41b r …:00000000 00 -> + …:00000001 00
Debug: 279 25 riscv-011.c:430 scan(): 41b r …:00000000 01 -> + …:00000001 00
Debug: 280 25 riscv-011.c:430 scan(): 41b r …:00000000 01 -> + …:00000000 01
Debug: 281 25 riscv-011.c:1895 examine(): Discovered XLEN is 32
Debug: 282 25 riscv-011.c:770 cache_set32(): cache[0x0] = 0x30102473
Debug: 283 25 riscv-011.c:770 cache_set32(): cache[0x1] = 0x40802823
Debug: 284 25 riscv-011.c:770 cache_set32(): cache[0x2] = 0x3fc0006f
Debug: 285 25 riscv-011.c:862 cache_write(): enter
Debug: 286 25 riscv-011.c:430 scan(): 41b w .h:30102473 00 -> + …:00000000 01
Debug: 287 25 riscv-011.c:430 scan(): 41b w .h:40802823 01 -> + …:00000001 00
Debug: 288 25 riscv-011.c:430 scan(): 41b w ih:3fc0006f 02 -> + …:00000000 01
Debug: 289 25 riscv-011.c:430 scan(): 41b r .h:00000000 04 -> + …:40902023 02
Debug: 290 25 riscv-011.c:430 scan(): 41b r .h:00000000 04 -> + …:40001105 04
Debug: 291 25 riscv-011.c:981 cache_write(): exit
Debug: 292 25 riscv-011.c:1043 read_csr(): csr 0x301 = 0x40001105
Debug: 293 25 riscv.c:950 riscv_set_current_hartid(): setting hartid to 0, was 0
Debug: 294 25 riscv.c:964 riscv_set_current_hartid(): Initializing registers: xlen=32
Debug: 295 25 riscv-011.c:1235 reg_cache_set(): x0 <= 0xffffffffffffffff
Debug: 296 25 riscv-011.c:1235 reg_cache_set(): x1 <= 0xffffffffffffffff
Debug: 297 25 riscv-011.c:1235 reg_cache_set(): x2 <= 0xffffffffffffffff
Debug: 298 25 riscv-011.c:1235 reg_cache_set(): x3 <= 0xffffffffffffffff
Debug: 299 25 riscv-011.c:1235 reg_cache_set(): x4 <= 0xffffffffffffffff
Debug: 300 25 riscv-011.c:1235 reg_cache_set(): x5 <= 0xffffffffffffffff
Debug: 301 25 riscv-011.c:1235 reg_cache_set(): x6 <= 0xffffffffffffffff
Debug: 302 25 riscv-011.c:1235 reg_cache_set(): x7 <= 0xffffffffffffffff
Debug: 303 25 riscv-011.c:1235 reg_cache_set(): x8 <= 0xffffffffffffffff
Debug: 304 25 riscv-011.c:1235 reg_cache_set(): x9 <= 0xffffffffffffffff
Debug: 305 25 riscv-011.c:1235 reg_cache_set(): x10 <= 0xffffffffffffffff
Debug: 306 26 riscv-011.c:1235 reg_cache_set(): x11 <= 0xffffffffffffffff
Debug: 307 26 riscv-011.c:1235 reg_cache_set(): x12 <= 0xffffffffffffffff
Debug: 308 26 riscv-011.c:1235 reg_cache_set(): x13 <= 0xffffffffffffffff
Debug: 309 26 riscv-011.c:1235 reg_cache_set(): x14 <= 0xffffffffffffffff
Debug: 310 26 riscv-011.c:1235 reg_cache_set(): x15 <= 0xffffffffffffffff
Debug: 311 26 riscv-011.c:1235 reg_cache_set(): x16 <= 0xffffffffffffffff
Debug: 312 26 riscv-011.c:1235 reg_cache_set(): x17 <= 0xffffffffffffffff
Debug: 313 26 riscv-011.c:1235 reg_cache_set(): x18 <= 0xffffffffffffffff
Debug: 314 26 riscv-011.c:1235 reg_cache_set(): x19 <= 0xffffffffffffffff
Debug: 315 26 riscv-011.c:1235 reg_cache_set(): x20 <= 0xffffffffffffffff
Debug: 316 26 riscv-011.c:1235 reg_cache_set(): x21 <= 0xffffffffffffffff
Debug: 317 26 riscv-011.c:1235 reg_cache_set(): x22 <= 0xffffffffffffffff
Debug: 318 26 riscv-011.c:1235 reg_cache_set(): x23 <= 0xffffffffffffffff
Debug: 319 26 riscv-011.c:1235 reg_cache_set(): x24 <= 0xffffffffffffffff
Debug: 320 26 riscv-011.c:1235 reg_cache_set(): x25 <= 0xffffffffffffffff
Debug: 321 26 riscv-011.c:1235 reg_cache_set(): x26 <= 0xffffffffffffffff
Debug: 322 26 riscv-011.c:1235 reg_cache_set(): x27 <= 0xffffffffffffffff
Debug: 323 26 riscv-011.c:1235 reg_cache_set(): x28 <= 0xffffffffffffffff
Debug: 324 26 riscv-011.c:1235 reg_cache_set(): x29 <= 0xffffffffffffffff
Debug: 325 26 riscv-011.c:1235 reg_cache_set(): x30 <= 0xffffffffffffffff
Debug: 326 26 riscv-011.c:1235 reg_cache_set(): x31 <= 0xffffffffffffffff
Info : 327 26 riscv-011.c:1916 examine(): Examined RISCV core; XLEN=32, misa=0x40001105
Debug: 328 26 target.c:1512 target_call_event_callbacks(): target event 22 (examine-end)
Debug: 329 26 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_flash init
Debug: 330 26 command.c:143 script_debug(): command - ocd_flash ocd_flash init
Debug: 332 26 tcl.c:1098 handle_flash_init_command(): Initializing flash devices…
Debug: 333 26 command.c:364 register_command_handler(): registering ‘ocd_flash’…
Debug: 334 26 command.c:364 register_command_handler(): registering ‘ocd_flash’…
Debug: 335 26 command.c:364 register_command_handler(): registering ‘ocd_flash’…
Debug: 336 26 command.c:364 register_command_handler(): registering ‘ocd_flash’…
Debug: 337 26 command.c:364 register_command_handler(): registering ‘ocd_flash’…
Debug: 338 26 command.c:364 register_command_handler(): registering ‘ocd_flash’…
Debug: 339 26 command.c:364 register_command_handler(): registering ‘ocd_flash’…
Debug: 340 26 command.c:364 register_command_handler(): registering ‘ocd_flash’…
Debug: 341 26 command.c:364 register_command_handler(): registering ‘ocd_flash’…
Debug: 342 26 command.c:364 register_command_handler(): registering ‘ocd_flash’…
Debug: 343 26 command.c:364 register_command_handler(): registering ‘ocd_flash’…
Debug: 344 26 command.c:364 register_command_handler(): registering ‘ocd_flash’…
Debug: 345 26 command.c:364 register_command_handler(): registering ‘ocd_flash’…
Debug: 346 26 command.c:364 register_command_handler(): registering ‘ocd_flash’…
Debug: 347 26 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_mflash init
Debug: 348 26 command.c:143 script_debug(): command - ocd_mflash ocd_mflash init
Debug: 350 26 mflash.c:1377 handle_mflash_init_command(): Initializing mflash devices…
Debug: 351 26 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_nand init
Debug: 352 26 command.c:143 script_debug(): command - ocd_nand ocd_nand init
Debug: 354 27 tcl.c:495 handle_nand_init_command(): Initializing NAND devices…
Debug: 355 27 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_pld init
Debug: 356 27 command.c:143 script_debug(): command - ocd_pld ocd_pld init
Debug: 358 27 pld.c:205 handle_pld_init_command(): Initializing PLDs…
Debug: 359 27 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_halt
Debug: 360 27 command.c:143 script_debug(): command - halt ocd_halt
Debug: 362 27 target.c:2828 handle_halt_command(): -
Debug: 363 27 riscv.c:683 riscv_openocd_halt(): halting all harts
Debug: 364 27 riscv.c:841 riscv_halt_one_hart(): halting hart 0
Debug: 365 27 riscv.c:950 riscv_set_current_hartid(): setting hartid to 0, was 0
Debug: 366 27 riscv.c:961 riscv_set_current_hartid(): registers already initialized, skipping
Segmentation fault (core dumped)

I believe you are experiencing the same problem with openocd as described here:

http://forums.sifive.com/t/question-about-the-hello-program/541/4

The fix has already been pushed to openocd. However, the freedom-e-sdk has not been updated to include the fixed version. The version of openocd contained in the freedom-e-sdk at this time is still the broken version “openocd @ 563f6ac”. So, the freedom-e-sdk code on github needs to be updated to include the latest version of openocd.

To get the freedom-e-sdk working on my machine, I manually checked out an updated version of openocd prior to building the tools:

git clone --recursive https://github.com/sifive/freedom-e-sdk.git
cd freedom-e-sdk/openocd/
git checkout c431c0eb251bf6d02959a6f55be3baba04552b5d
cd …
make tools

I’m new to this, so I hope this helps. I basically lost half a day yesterday with the same problem - the Arduino openocd worked, but the freedom-e-sdk openocd was broken.

Thanks all for pointing this out. We’ve bumped the version of OpenOCD which is tagged in the Freedom E SDK repo.

Note that we now host pre-compiled versions of the tools so you don’t have to build from source (these are always going to be slightly older, more stable versions than the latest): https://www.sifive.com/products/tools/

I’ll update the Freedom E SDK README with instructions on how to use those versions instead of compiling from source.

Thank you Jon and Megan. That problem is now solved.
However I am still not able to load demo_gpio due to some other errors. log of make upload PROGRAM=demo_gpio BOARD=freedom-e300-arty is as follows

work/build/openocd/prefix/bin/openocd -f bsp/env/freedom-e300-arty/openocd.cfg &
/home/kcharfi/freedom-e-sdk/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gdb software/demo_gpio/demo_gpio --batch -ex “set remotetimeout 240” -ex “target extended-remote localhost:3333” -ex “monitor reset halt” -ex “monitor flash protect 0 64 last off” -ex “load” -ex “monitor resume” -ex “monitor shutdown” -ex “quit” &&
echo "Successfully uploaded ‘demo_gpio’ to freedom-e300-arty."
Open On-Chip Debugger 0.10.0-dev-gc431c0e (2017-05-18-11:40)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 10000 kHz
Info : auto-selecting first available session transport “jtag”. To override use 'transport select '.
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz
Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (), part: 0x0e31, ver: 0x1)
Info : Examined RISCV core; XLEN=32, misa=0x40001105
riscv.cpu: target state: halted
halted at 0x204001e6 due to debug interrupt
Info : accepting ‘gdb’ connection on tcp/3333
Info : Found flash device ‘micron n25q128’ (ID 0x0018ba20)
0x204001e6 in handle_m_ext_interrupt () at demo_gpio.c:29
29 void handle_m_ext_interrupt(){
Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (), part: 0x0e31, ver: 0x1)
JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (), part: 0x0e31, ver: 0x1)
riscv.cpu: target state: halted
halted at 0x404 due to software breakpoint
riscv.cpu: target state: halted
halted at 0x404 due to software breakpoint
cleared protection for sectors 64 through 255 on flash bank 0
cleared protection for sectors 64 through 255 on flash bank 0
warning: Can not parse XML memory map; XML support was disabled at compile time
Loading section .init, size 0x72 lma 0x20400000
Loading section .text, size 0xbbde lma 0x20400074
Error: Core got an exception (0xffffffff) while writing to 0x2040006c
Error: (It may have failed between 0x20400000 and 0x2040006b as well, but we didn’t check then.)
Load failed
Error: Core got an exception (0xffffffff) while writing to 0x20403e8c
Error: (It may have failed between 0x20400074 and 0x20403e8b as well, but we didn’t check then.)
halted at 0x20400460 due to step
halted at 0x20400460 due to step
shutdown command invoked
shutdown command invoked
A debugging session is active.

Inferior 1 [Remote target] will be detached.

Quit anyway? (y or n) [answered Y; input not from terminal]
Remote communication error. Target disconnected.: Connection reset by peer.
Successfully uploaded ‘demo_gpio’ to freedom-e300-arty.

I got it fixed following this thread

Thanks

1 Like