NishanthMenon changed the topic of #openocd to: this is the place to discuss all things OpenOCD | Logs: https://libera.irclog.whitequark.org/openocd/
<Getty> is there something that can give me better output on the Error: open failed with a stlink?
<Getty> debugging is not really helping :D damn, one of those "could be hardware" error and then on the init of the situation
<karlp> open failed? that's... sounding like just plain old permissions problems on the usb device?
<Getty> no, its also the problem you get if your programmer doesnt like you
<Getty> somehow that thing i got in front of me is not the ST Link that i expect it to be, or its broken, i dont know :D i took out an old one and NOW suddenly it works all fine
<Getty> <pain>
<Getty> oh my god, that was now dumb..... I had before programmed Atmel and we had JUST started to use the standard connector on the STM32 which is like Atmel one so................. yeah.............. exactly
<Getty> well that not gonna happen to me again :D
nerozero has joined #openocd
Hawk777 has joined #openocd
Hawk777 has quit [Quit: Leaving.]
Hawk777 has joined #openocd
crabbedhaloablut has joined #openocd
crabbedhaloablut has quit [Read error: Connection reset by peer]
crabbedhaloablut has joined #openocd
crabbedhaloablut has quit [Ping timeout: 245 seconds]
crabbedhaloablut has joined #openocd
Hawk777 has quit [Quit: Leaving.]
MGF_Fabio has joined #openocd
slobodan has joined #openocd
kucha has joined #openocd
Foxyloxy_ has joined #openocd
Foxyloxy has quit [Read error: Connection reset by peer]
MGF_Fabio has quit [Remote host closed the connection]
MGF_Fabio has joined #openocd
tlwoerner has quit [Ping timeout: 268 seconds]
tlwoerner has joined #openocd
wingsorc has joined #openocd
bvernoux has joined #openocd
nerozero has quit [Ping timeout: 276 seconds]
Guest27 has joined #openocd
<Guest27> Is it possible to include all libraries in the openocd binary when crosscompiling? (compiled for aarch64 android, but some libraries are missing)
tchebb has quit [Ping timeout: 252 seconds]
<PaulFertser> Guest27: like static linking?
<PaulFertser> Guest27: there's some hint about that in the cross compiling script.
gzlb has quit [Ping timeout: 256 seconds]
gzlb has joined #openocd
<Guest27> PaulFertser: yes, i checked it, it only mentions it for cross compilation script, i cannot find the required source files for the script so i built with make but i did do ./config --enable-static as explained in configure help
<Guest27> when i readelf the binary outputted in src/ folder it still lists the libraries as needed
<Guest27> i also built it natively on an aarch64 machine (apple m1 with parallels ubuntu) if that makes any difference
renrelkha has quit [Quit: bye]
renrelkha has joined #openocd
<PaulFertser> Guest27: sorry I do not have the answer ready I'll try to check. Do you have root on that android?
<PaulFertser> Guest27: do you have static version of libusb installed? On Debian I see there's no static libusb by default.
<PaulFertser> So building static OpenOCD isn't possible without it.
<PaulFertser> Guest27: and in any case I think you need to run configure with LDFLAGS="-static" in environment so that the final executable is statically linked if possible.
<PaulFertser> Guest27: but probably you can install ready-made OpenOCD with Termux (by just doing pkg install openocd)?
crabbedhaloablut has quit []
crabbedhaloablut has joined #openocd
<Guest27> PaulFertser: i thought about that too but pkg install openocd or open-ocd gives nothing
<Guest27> PaulFertser: i installed libusb-1.0-0-dev through apt
<Guest27> this would not really be an issue on rooted android however i am trying to have this run on unrooted android for now
<Guest27> PaulFertser: about the specific missing libraries: libusb-1.0.so.0, libjaylink.so.0, libc.so.6, ld-linux-aarch64.so.1
<PaulFertser> Guest27: but does libusb-1.0-0-dev have a static .a library archive?
<PaulFertser> Guest27: how do you expect non-rooted android to allow regular libusb to work?
<Guest27> good point, seems like this is pretty much impossible to do without rooting
<PaulFertser> Probably termux have some alternative libusb implementation which uses some API, idk. Android is a mess and PITA.
<PaulFertser> If you put .so files there on the target you can use them with LD_LIBRARY_PATH
<Guest27> i did try that too and got this
<Guest27>  linux-vdso.so.1 => [vdso] (0x7e8ae5c000)
<Guest27> WARNING: linker: Warning: "/data/local/tmp/andro_openocd/libexec/libusb-1.0.so.0" unused DT entry: DT_RPATH (type 0xf arg 0x1149) (ignoring)
<Guest27> WARNING: linker: Warning: "/data/local/tmp/andro_openocd/libexec/libudev.so.1" unused DT entry: DT_RPATH (type 0xf arg 0xd77) (ignoring)
<Guest27> WARNING: linker: Warning: "/data/local/tmp/andro_openocd/libexec/libatomic.so.1" unused DT entry: DT_RPATH (type 0xf arg 0x8f9) (ignoring)
<Guest27>  libusb-1.0.so.0 => /data/local/tmp/andro_openocd/libexec/libusb-1.0.so.0 (0x7e868be000)
<Guest27>  libjaylink.so.0 => /data/local/tmp/andro_openocd/libexec/libjaylink.so.0 (0x7e8661f000)
<Guest27>  libc.so.6 => /data/local/tmp/andro_openocd/libexec/libc.so.6 (0x7e86648000)
<Guest27> CANNOT LINK EXECUTABLE "linker64": cannot find verneed/verdef for version index=32770 referenced by symbol "_res" at "/data/local/tmp/andro_openocd/libexec/libc.so.6"
<PaulFertser> That's because it's a different linker I guess. You might need to copy /lib/ld-linux-aarch64.so.1 too, and use it from command line to tell it to load everything needed.
<Guest27> i was hoping to get openocd working because i cant find any alternative that can flash stm32 and nrf51 at the same time..
<PaulFertser> I'd expect it to work just fighting android is tricky.
<PaulFertser> Try starting ld-linux-aarch64.so.1 as an executable with appropriate arguments to load openocd.
<Guest27> yeah same, first i tried to just use xpack's arm64 implementation but i had this same issue
<PaulFertser> man 8 ld.so
<Guest27> hmm i tried that and got this
<Guest27> ./ld-linux-aarch64.so.1 /data/local/tmp/andro_openocd/openocd
Guest27 has quit [Quit: Client closed]
Guest27 has joined #openocd
<Guest27> error while loading shared libraries: libusb-1.0.so.0: cannot open shared object file: No such file or directory
<PaulFertser> Guest27: yes, with LD_LIBRARY_PATH=/dir/where/you/copied/so in the env
<Guest27> kinda interesting considering i have this already in my ld lib path
<PaulFertser> Or with --library-path argument
<Guest27> nvm i forgot to set it again because i restarted my adb shell
<PaulFertser> Or with --preload
<Guest27> oh wow
<Guest27> ./ld-linux-aarch64.so.1 /data/local/tmp/andro_openocd/openocd
<Guest27> Open On-Chip Debugger 0.12.0+dev-00468-gadcc8ef87 (2024-01-07-16:39)
<Guest27> Licensed under GNU GPL v2
<Guest27> For bug reports, read
<Guest27> embedded:startup.tcl:28: Error: Can't find openocd.cfg
<Guest27> in procedure 'script'
<Guest27> at file "embedded:startup.tcl", line 28
<Guest27> Info : Listening on port 6666 for tcl connections
<Guest27> Info : Listening on port 4444 for telnet connections
<Guest27> Error: Debug Adapter has to be specified, see "adapter driver" command
<Guest27> embedded:startup.tcl:28: Error:
<Guest27> in procedure 'script'
<Guest27> at file "embedded:startup.tcl", line 28
<Guest27> just gotta set the adapter and target line and fingers crossed it might actually work?
crabbedhaloablut has quit []
crabbedhaloablut has joined #openocd
crabbedhaloablut has quit [Client Quit]
crabbedhaloablut has joined #openocd
MGF_Fabio has quit [Ping timeout: 245 seconds]
MGF_Fabio has joined #openocd
<HelloShitty> Hello. I was tinking about to program an RP2040 (Raspberry chip which is a dual core ARM Cortex M0+) wit openocd but there is no specific target config file for this chip. Would it work if I use stm32f0x.cfg which is a single core ARM Cortex M0 (suggested by some AI) or maybe stm32wbx.cfg or even stm32wblx.cfg which are ARM Cortex M0+ ? I'm asking in terms of memory region settings because I don't
<HelloShitty> know how to change CFG files to match this specific RP2040.
<HelloShitty> RP2040 datasheet says: internal SRAM can contain code or data. It is addressed as a single 264 kB region, but physically partitioned into 6 banks to allow simultaneous parallel access from different masters.
<HelloShitty> but I can't find any chip with these memory characteristics. 6 banks as 64 + 64 + 64 + 64 + 4 + 4
<HelloShitty> Address map of this RP2040 are well documented but I don't know how to put the addresses in a CFG file!
<Guest27> PaulFertser:messing with it now, when i try to connect to my chip i get a wall of this DEPRECATED! use 'swj_newdap' not 'hla newtap' then it says
<Guest27> embedded:startup.tcl:1392: Error: Infinite eval recursion
<Guest27> in procedure 'script'
<Guest27> at file "embedded:startup.tcl", line 28
<Guest27> then it spams this
<Guest27> in procedure 'swj_newdap' called at file "/data/local/tmp/andro_openocd/oocd/scripts/target/stm32f1x.cfg", line 46
<Guest27> in procedure 'hla newtap' called at file "/data/local/tmp/andro_openocd/oocd/scripts/target/swj-dp.tcl", line 28
<Guest27> in procedure 'swj_newdap' called at file "embedded:startup.tcl", line 324
<Guest27> in procedure 'hla newtap' called at file "/data/local/tmp/andro_openocd/oocd/scripts/target/swj-dp.tcl", line 28
<Guest27> in procedure 'swj_newdap' called at file "embedded:startup.tcl", line 324
bvernoux has quit [Quit: Leaving]
<karlp> HelloShitty: target/rp2040.cfg exists? what version are you using?
<PaulFertser> Guest27: the problem is that you're using cfg files from some other OpenOCD version. They need to be in sync.
<PaulFertser> Guest27: but you got it starting with shared libraries and using linker manually?
<Guest27> yeah, im trying different ones now
<Guest27> PaulFertser: "but you got it starting with shared libraries and using linker manually?" yes
<PaulFertser> Guest27: Infinite eval recursion is not something I ever saw. Probably something in your compilation procedure was too unusual.
<Guest27> Open On-Chip Debugger 0.12.0+dev-00468-gadcc8ef87 (2024-01-07-16:39)
<Guest27> Licensed under GNU GPL v2
<Guest27> For bug reports, read
<Guest27> Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
<Guest27> Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
<Guest27> Info : Listening on port 6666 for tcl connections
<Guest27> Info : Listening on port 4444 for telnet connections
<Guest27> Info : clock speed 1000 kHz
<Guest27> Error: open failed
<Guest27> hmm
<PaulFertser> Guest27: please never paste more than 2-3 lines to a public channel use some pastebin.
<Guest27> okay
<PaulFertser> Guest27: open failed means it can't talk to debug adapter.
<Guest27> yeah
<Guest27> im running it through adb shell over wifi now, i guess nothing can be done about this now or?
<PaulFertser> With strace you can see what exactly it's trying to do.
<PaulFertser> I have no idea what APIs android without root can provide and how...
<Guest27> PaulFertser: https://pastebin.com/rHtbt8HZ
<PaulFertser> That's actually interesting.
<Guest27> is it complaining about not being able to find libusb or something else? '=D
<PaulFertser> Looks like libusb is trying to create an NETLINK socket before trying to enumerate usb devices.
<PaulFertser> OK, your libusb is compiled without __ANDROID__ macro defined so it tries to talk to the kernel to register for hotplug events.
<PaulFertser> And then probably some other tricks for libusb on android to do what you want.
<Guest27> i just googled it quickly, on https://github.com/libusb/libusb/blob/master/android/README it says something about installing libusb on android
<Guest27> ill try that
<PaulFertser> Guest27: yes looks like you can use libusb on unrooted android after all. But that also requires some tweaks to app and also a corresponding Java helper.
<Guest27> yeah i see it needs an app
<Guest27> i wonder if theres a way to use it without the app part
<PaulFertser> Probably with termux
<PaulFertser> It seems to have some suitable app integrated.
kucha has quit [Quit: 73!]
MGF_Fabio has quit [Ping timeout: 255 seconds]
<HelloShitty> karlp: this is the datasheet of the RP2040 I'm using: https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf
<HelloShitty> I couldn't find any target/rp2040.cfg
<HelloShitty> $ openocd --version
<HelloShitty> Open On-Chip Debugger 0.11.0-rc1+dev-00032-gbd1adcffe-dirty (2021-01-23-18:54)