NishanthMenon changed the topic of #openocd to: this is the place to discuss all things OpenOCD | Logs: https://libera.irclog.whitequark.org/openocd/
renrelkha has quit [Quit: bye]
renrelkha has joined #openocd
Hawk777 has joined #openocd
tsal_ has joined #openocd
tsal has quit [Ping timeout: 264 seconds]
nerozero has joined #openocd
firelegend has joined #openocd
Bugies has joined #openocd
<PaulFertser> sevan: got it working?
Hawk777 has quit [Quit: Leaving.]
firelegend has quit [Ping timeout: 250 seconds]
<sevan> PaulFertser: no, but I did try on modern macOS (intel) & Ubuntu 23.10 amd64
<PaulFertser> sevan: let's try to solve it, what's the current state?
<sevan> PaulFertser: the st-link v1 device didn't work on modern macOS as you described (I'm not disabling SIP & loading an unsigned kext).
<sevan> PaulFertser: on Ubuntu, openocd could do the right & I could interact with the st-link v1 device via telnet.
<PaulFertser> sevan: (I thought it's kinda odd you still have stm32vldiscovery board as that was the first ever stm32 board I had; but then I realised it's not suprising for someone running PowerPC Mac; why old OS X though and not GNU/Linux?)
<sevan> PaulFertser: <3
<PaulFertser> sevan: ok, so v1 problem is clear, you need to somehow convince OS X to let the device go, probably by unloading usb mass storage kext altogether.
<sevan> PaulFertser: agreed
<PaulFertser> But v2 should work, let's see what about it.
<sevan> PaulFertser: I want to work on but have to head out shortly. I can drop by later this evening.
<PaulFertser> sevan: sure
<PaulFertser> sevan: init mode failed really means some miswiring though
<PaulFertser> GND or Vcc not connected probably. Or SWCLK mixed with SWDIO. Or you're attaching to wrong lines or probably if you're trying same vl board it means you didn't disconnect jumpers that go to stlinkv1 that's on board etc.
<sevan> PaulFertser: the v2 devices I have are the st-link v2 clone adapters, they are unlocked & I've flashed them with the stock firmware using the official st-link utility
<PaulFertser> sevan: yes, that should be good
<PaulFertser> Do you have an oscilloscope or logic analyser? Just to exclude the possibility the labels on those clone adapters are wrong and the SWD lines are miswired somehow.
<sevan> PaulFertser: these are the v2 devices I have https://stm32-base.org/boards/Debugger-STM32F101C8T6-STLINKV2
<PaulFertser> Should be fine yeah
<PaulFertser> They all are slightly different though, pinout, sometimes pulls etc.
<sevan> exact model/pinout config may be different, but they look the same
<sevan> agreed
<PaulFertser> I had some surprise moments figuring out why Webauthn button didn't work properly only to find extra silly pulldown on the board.
<sevan> :)
<sevan> alrighty, bbl
<PaulFertser> See you
nerozero has quit [Ping timeout: 268 seconds]
bvernoux has joined #openocd
MGF_Fabio has joined #openocd
nerozero has joined #openocd
pedro_pt has joined #openocd
pedro_pt has quit [Quit: Client closed]
nerozero has quit [Ping timeout: 260 seconds]
<sevan> PaulFertser: shall we? :)
<PaulFertser> sevan: yeah
<sevan> PaulFertser: the device I'm using is one of these (gold sleeve though) https://stm32-base.org/boards/Debugger-STM32F103C8U6-STLINKV2
<sevan> the SWD OUT pin config & the model controller match
<sevan> It's a STM32F103C8U6 which I've updated the firmware on using ST's updater on Windows
<sevan> I don't have anything connected to it though
<sevan> I'm just plugging the USB dongle in & trying to point openocd to it
<PaulFertser> sevan: ok then the output you showed earlier is OK (init mode failed)
<PaulFertser> Expected
<sevan> I've switched to Ubuntu 23.10 (forget darwin for now)
<sevan> st-info --probe output: http://paste.debian.net/1305538/
<PaulFertser> OK, connect the target then.
<sevan> "openocd -f interface/stlink-v2.cfg -f target/stm32f3x.cfg -d3" http://paste.debian.net/1305539/
<sevan> derp, should've used arget/stm32f1x.cfg
<sevan> t*
<PaulFertser> sevan: doesn't matter in this case. Something's wrong with the wiring. Or probably the target isn't powered?
<PaulFertser> sevan: or probably the target is in sleep mode or has SWD disabled?
<PaulFertser> (to exclude the last two ideas pull target's reset line low while trying to start OpenOCD)
<sevan> LED on the adapter is on
<sevan> when you say it isn't powered? it's in the usb slot (there are no buttons on the device)
<sevan> how can I check if SWD is disabled?
<PaulFertser> sevan: what is your target device atm? How is it connected to power?
<PaulFertser> sevan: to check if SWD is disabled pull target's reset low and re-run OpenOCD and see if it changed.
<sevan> that's what I'm saying, I don't have anything attached to the SWD OUT pins on the adapter
<PaulFertser> sevan: what do you expect then? Without target you can't debug a target :)
<sevan> :D
<sevan> so I can't interact with the device itself, it's simply a means to connect to another device which I would like to debug?
<PaulFertser> sevan: stlink is a debug adapter, yes, it's used to debug other targets.
<sevan> I will disable the st-link v1 interface on the stm32-discovery & try connecting that up (I did try it earlier this morning but still failed)
<PaulFertser> sevan: remove both jumpers yes and connect stlink to target stm32f100, that should work.
<sevan> ack
<sevan> I skipped on the VDD pin & just powered the stm32f100 via USB as I read something scary about the clone adapters supplying power. That should still be ok, right?
<PaulFertser> sevan: yes, should be ok
<PaulFertser> sevan: never connect a clone adapter to a non-3.3 V target though
<sevan> ah, noted. So the 5V pins are a lie?
<PaulFertser> No, they are directly connected to USB Vcc so you can use them to power the target if it has a 3.3 V LDO or something
slobodan has joined #openocd
<sevan> ok, SWCLK, GND, SWDIO pins connected up
<PaulFertser> sevan: should be enough to try
<sevan> ah
<PaulFertser> sevan: you connected another stlink
<sevan> yeah, since I'm connecting USB to the same host
<sevan> Plugged the usb port into another computer to the one I'm running openocd on :)
<PaulFertser> Good for quick try ok so what gives?
<sevan> hmm, I wonder if the stm32-discover doesn't have SWD enabled
<sevan> It certainly didn't originally and had to be unlocked.
<PaulFertser> sevan: press reset button on the target board while starting OpenOCD.
<sevan> PaulFertser: nothing, would you like to see the openocd output?
<PaulFertser> While reset button is pressed the target flash config or contents can't affect the result anyhow.
<PaulFertser> sevan: nothing as in exactly the same as before?
<PaulFertser> sevan: hm, yes. How exactly did you connect it?
<PaulFertser> What wire goes where
<sevan> there's 4 sets of pins on the left hand side of the stm32-discovery board labelled SWD
<sevan> CN2
<PaulFertser> 4 sets?
MGF_Fabio has quit [Ping timeout: 256 seconds]
<PaulFertser> Or a set of 4?
<sevan> sorry, a set of 4 pins
<karlp> vl discovery had a 4 pin header for connecting to _another_ board for debugging
<karlp> using the awesome v1...
<PaulFertser> sevan: don't use that, it goes to stlinkv1 itself.
<karlp> later boards moved to the 6 pin.
<PaulFertser> sevan: connect to PA13, PA14 of the target MCU
<sevan> Ahhh
<PaulFertser> karlp: nostalgic moment eh
<karlp> not really...
<sevan> PaulFertser: I've been connecting 2 debugger together?!
<karlp> not in any good way at least :)
<PaulFertser> For me yes, I reflashed that stlinkv1 to BMP and implemented support for semihosting and had good experience upstreaming it
<karlp> you could connect an external debugger there too iirc, depending on how you had the other jumpers connected.
<PaulFertser> Also soldered directly to those stlinkv1 pins to get aux serial channel
<PaulFertser> sevan: you have
<sevan> PaulFertser: winning! :)
<sevan> PA13 is SWDIO, PA14 is SWCLK
<PaulFertser> Also used that vldisco board later to measure 7 temperatures around a human in a special hammock tent in -15 C winter
<PaulFertser> And trying to contribute ds18b20 library port to locm3-examples karlp ;)
<PaulFertser> sevan: got it connected now?
<sevan> PaulFertser: I have it connected, but still not working with openocd, however, st-util connects under reset now
<PaulFertser> sevan: so show openocd result
slobodan has left #openocd [Leaving]
<sevan> let me get the results, 1mo
<sevan> PaulFertser: 3 sets of output (labelled)
<PaulFertser> sevan: the third output is good. Why f0 though?
<sevan> PaulFertser: my ignorance, rather than intentional.
<sevan> f1x?
<sevan> it worked
<sevan> need to hold reset down
<sevan> to the PowerPC Mac!
<PaulFertser> sevan: proper way is to connect adapter's reset line to target's reset and use -c "reset_config srst_only connect_assert_srst"
<sevan> PaulFertser: https://paste.debian.net/1305558/ openocd on OS X 10.4 PowerPC
<PaulFertser> sevan: looks good
<sevan> PaulFertser: telnet interface is working. I don't have a gdb for arm built on macppc so can't try that.
<sevan> PaulFertser: thanks so much for the help :)
<PaulFertser> sevan: welcome :)
<sevan> I had to butcher some things in openocd source to get things to compile on OS X 10.4 with GCC 4.0
<sevan> This is the patch which I'm using. https://paste.debian.net/1305563/ I disabled armv8 support & a few other things
<PaulFertser> What's the appeal of old OS X, why not GNU/Linux?
<PaulFertser> sevan: ((irdata[0] >> 7) & 3) == "0b01" <-- certainly wrong change
<sevan> permacomputing, you can fish out these things out of the dump because they're out of fashion & the ancient OS has full support for the hardware
<sevan> PaulFertser: it's all wrong, I had to butcher it
<sevan> PaulFertser: just that I have to go back and fix it correctly.
<sevan> PaulFertser: that line specially 0b01 fails because it is not treated as hex
<sevan> so GCC complains about b01
<PaulFertser> sevan: I'm asking about software, not hardware
<sevan> If I prefix it with 0x, GCC complains that there are more issues
<sevan> PaulFertser: are you referring to OS X?
<PaulFertser> Yes
<sevan> supports the hardware well, and there's a whole bunch of professional creative software for it.
<sevan> saying that, I hear good things about Linux on macpc since IBMs work for power applied to some of these systems, e.g virtualisation. I tried other "not linux" open source operating systems on them & the focus there is more on the operating systems support for the target than actually being able to use the machine for making music, editing, ...
<PaulFertser> I see makes sense indee.
<sevan> Regarding openocd, I had to disable armv8 support because there are many cases with hex numbers being referenced without a prefix so I ripped it out just to plough on.
<sevan> As is documented in src/helper/options.c, realpath is expected to be POSIX 2008 implementation I'll break that out for Darwin so that on older system it does the right thing.
<sevan> The MIN macro conflicts with something in the system's header files regarding networking :)
<sevan> And lastly, linker is too on this system to recognise -rpath. :)
<sevan> I think the issues in armv8 support, src/flash/nor/xcf.c, realpath would be worth fixing and upstreaming since there's broader impact.
<PaulFertser> We do not really target retro computers normally
<sevan> ack
<PaulFertser> If it's something simple and doesn't increase maintenance why not. But when it gets more involved, probably not worth it given already rather limited time the maintainers have.
<PaulFertser> And I personally do not review patches for few years already as I'm not using OpenOCD anymore with the new job.
<sevan> got it :)
<sevan> btw, now that I actually have something connected up correctly, st-info reports a bit more detail https://paste.debian.net/1305575/ (I trimmed the serial)
<sevan> src/flash/nor/xcf.c:133:46: error: invalid suffix "b01" on integer constant
<sevan> src/flash/nor/xcf.c:134:46: error: invalid suffix "b01" on integer constant
<sevan> src/flash/nor/xcf.c:531:10: error: invalid suffix "b1111" on integer constant
<sevan> hmm, prefixing those with 0x satisfied GCC
<sevan> two "minus ones" on the review. wrong solution :)
MGF_Fabio has joined #openocd
<PaulFertser> sevan: I thought you're joking and not actually submitting that for review
<PaulFertser> I have to note this joke is kinda silly
<PaulFertser> It was catchy enough to make "avrdude" author reply!
<PaulFertser> Weird story
<sevan> :D
<sevan> I didn't intend anything malicious
<PaulFertser> or avr-libc
<sevan> I've used avrdude :)
bvernoux has quit [Quit: Leaving]
Bugies has quit [Ping timeout: 260 seconds]
MGF_Fabio has quit [Ping timeout: 256 seconds]