NishanthMenon changed the topic of #openocd to: this is the place to discuss all things OpenOCD | Logs: https://libera.irclog.whitequark.org/openocd/
vfazio has joined #openocd
noarb has quit [Ping timeout: 256 seconds]
noarb has joined #openocd
noarb has quit [Quit: ZNC 1.8.2 - https://znc.in]
noarb has joined #openocd
noarb- has joined #openocd
noarb has quit [Ping timeout: 255 seconds]
Hawk777 has quit [Quit: Leaving.]
ayaka_ has joined #openocd
balrog has quit [Quit: Bye]
balrog has joined #openocd
crabbedhaloablut has joined #openocd
ayaka_ has quit [Ping timeout: 252 seconds]
tsal has joined #openocd
tsal_ has quit [Ping timeout: 252 seconds]
nerozero has joined #openocd
ayaka_ has joined #openocd
gzlb has quit [Ping timeout: 240 seconds]
gzlb has joined #openocd
erhankur has quit [Remote host closed the connection]
erhankur has joined #openocd
MGF_Fabio has joined #openocd
Hawk777 has joined #openocd
erhankur has quit [Remote host closed the connection]
erhankur has joined #openocd
Haohmaru has joined #openocd
renrelkha has quit [Quit: bye]
renrelkha has joined #openocd
IoT-Maker has joined #openocd
<IoT-Maker> i want to load a firmwareimage to ram and run the system with it. In openocd i did: load_image /home/<user>/minicom_log/img/release.B810i.2-0-1.tdf 0x20000000. Is there anything to do other than just reset run?
Hawk777 has quit [Quit: Leaving.]
<IoT-Maker> I tried resume 0x20000000 and it seems it starts from nor-flash
<PaulFertser> IoT-Maker: resume should do the thing. But in Cortex-M you do not have actual branch instruction at the beginning, you have the stack pointer and reset vector pointer.
<PaulFertser> Which need to be taken care of.
<IoT-Maker> it's a Cortex-A, Marvell ARMADA XP ARM7 SoC
<IoT-Maker> Hmm, the first ELF image in this firmwarefile has an offset of 0x22c, maybe i have to resume at 0x2000022c then?
dnm has quit [Ping timeout: 276 seconds]
<PaulFertser> IoT-Maker: yes, you need to resume to the entry point.
dnm has joined #openocd
youthpastor has quit [Ping timeout: 255 seconds]
<PaulFertser> IoT-Maker: you can also set $pc manually and then do "step" few times to see how it goes.
<IoT-Maker> There is a SPI flash with u-boot on it. It seems thats where it starts from. Then it loads default system from nor-flash. Even if i resume from 0x2000022c.
youthpastor has joined #openocd
<PaulFertser> IoT-Maker: resume doesn't toggle reset so it shouldn't do that.
slobodan has joined #openocd
<PaulFertser> IoT-Maker: set pc manually and see how it goes step by step
RolfNoot has quit [Remote host closed the connection]
RolfNoot has joined #openocd
<RolfNoot> PaulFertser: contrib/cross* isn't for MacOS, right?
<PaulFertser> RolfNoot: why not? It automates the steps that should be applicable to any system.
<PaulFertser> If you have a cross-compiler for it.
<RolfNoot> PaulFertser: readlink -f isn't working on MacOs
<PaulFertser> RolfNoot: the script has readlink -m
<RolfNoot> readlink: illegal option -- m
<IoT-Maker> ok, i'm beginner, i had to check what pc mean, programm counter, i read: get_reg {pc sp} and the result was: pc 0xffff0928 sp 0x00000000. I did set_reg {pc 0x2000022c} and load the image to that address
<PaulFertser> RolfNoot: also, I'm not sure if "fully native" macOS build is supported at all, people build OpenOCD for macOS via brew or macports. So cross-compiling should be performed with the same environment I think.
<karlp> you should load the image to the same place you downloaded it from. you don't want to offset it...
<RolfNoot> PaulFertser: that makes sense. I was just wondering if it's documented and easily to use. I was looking for it to do quick tests.
<PaulFertser> RolfNoot: but you still have some additional environment on macOS, so why not use it for cross-compiling?
<RolfNoot> PaulFertser: you mean a VM?
<PaulFertser> RolfNoot: I mean Homebrew or MacPorts or Gentoo prefix or similar.
<RolfNoot> PaulFertser: yes, I can install readlink wit MacPorts, but there's one built in as well. It's cumbersome to set all the paths
<PaulFertser> RolfNoot: probably there's a more standard way than readlink -m that can work on macOS natively.
<PaulFertser> But you still need all the other parts like pkg-config and cross-compiler etc.
<RolfNoot> PaulFertser: Yes, those are already installed
<RolfNoot> readlink -f is supported on MacOS though, so maybe it's easy to change the script
<PaulFertser> RolfNoot: yes, -f sounds appropriate for the job too
<RolfNoot> PaulFertser: I will check if that works probably later today.
<karlp> what about realpath?
<karlp> oh, nvm, that's coreutils only, whtever
<karlp> I'll just keep using that myself by hand :)
erhankur has quit [Remote host closed the connection]
erhankur has joined #openocd
ayaka_ has quit [Ping timeout: 264 seconds]
lh has quit [Remote host closed the connection]
bryanb has quit [Remote host closed the connection]
geep has quit [Remote host closed the connection]
geep has joined #openocd
bryanb has joined #openocd
lh has joined #openocd
erhankur has quit [Remote host closed the connection]
erhankur has joined #openocd
<IoT-Maker> Tried different ways now. load_image to 0x0, set_reg {0x22c} resume at 0x22c, load_image to 0x20000000 set_reg{pc 0x2000022c} and resume from 0x2000022c, stepping from both addresses. But it always starts from SPI-flash. And after two trials it does a soft reset or something that turns the device off. This is the serial port log https://bpa.st/MHIQ
geep has quit [Read error: Connection reset by peer]
lh has quit [Read error: Connection reset by peer]
bryanb has quit [Read error: Connection reset by peer]
geep_ has joined #openocd
dnm has quit [Read error: Connection reset by peer]
bryanb_ has joined #openocd
lh_ has joined #openocd
youthpastor has quit [Read error: Connection reset by peer]
dnm has joined #openocd
balrog has quit [Quit: Bye]
bryanb_ is now known as bryanb
youthpastor has joined #openocd
balrog has joined #openocd
erhankur has quit [Remote host closed the connection]
crabbedhaloablut has quit [Read error: Connection reset by peer]
crabbedhaloablut has joined #openocd
erhankur has joined #openocd
merethan has joined #openocd
erhankur has quit [Remote host closed the connection]
erhankur has joined #openocd
erhankur has quit [Remote host closed the connection]
erhankur has joined #openocd
erhankur has quit [Remote host closed the connection]
Ha0hmaru has joined #openocd
Haohmaru has quit [Read error: Connection reset by peer]
Ha0hmaru is now known as Haohmaru
<IoT-Maker> If i set_reg {pc 0x2000022c] and do a step, the next get_reg {pc} show me 0xffff000c addresses. Is that normal? I expected an 0x2000... address. https://bpa.st/5YSA
<IoT-Maker> BootROMstarts at 0xFFF00000
<PaulFertser> Have you checked disassembly for 0x2000022c ?
<PaulFertser> And is PSR in the right mode (ARM)?
erhankur has joined #openocd
erhankur has quit [Remote host closed the connection]
erhankur has joined #openocd
erhankur has quit [Remote host closed the connection]
erhankur has joined #openocd
erhankur has quit []
cp- has quit [Ping timeout: 268 seconds]
cp- has joined #openocd
<IoT-Maker> PaulFertser what is PSR and how can i set it's mode? I read there is thumb mode or arm mode. The forum posts i found was about developing/recompiling software. But in my case i only have a firmware file. I opened it with Malcat which show me 4 modules inside. Two of them marked as ELF. First one fits to the size of the SPI flash (Device is a Drobo B810i NAS) and the second ELF module looks like vxworks image. Third
<IoT-Maker> one is a jffs2 (linux-)image.
<PaulFertser> IoT-Maker: PSR is the special register. If the instruction you run first is in ARM mode then you need to make sure PSR is in ARM too.
<PaulFertser> IoT-Maker: ELF files can not be uploaded to a RAM location as is. You need an ELF loader.
<IoT-Maker> Ok, so i have to extract the ELF files, write it to nor-flash and change some u-boot variables i guess.
<PaulFertser> IoT-Maker: are those elf files relocatable? Do they use shared objects?
<PaulFertser> IoT-Maker: OpenOCD can load ELF files on its own but that's mostly used for microcontroller code linked fully statically.
<IoT-Maker> PaulFertser: I don't know if they use shared objectes. It's my first vxworks device. I just try do fix a failed firmware update. I know the linux jffs2 part was extracted from firmware and installed on the device but vxworks not.
<PaulFertser> IoT-Maker: you probably want to inspect that ELF file with radare2 or Ghidra first.
<IoT-Maker> firmwarefile is this one https://files.drobo.com/webrelease/b810i/B810i_Firmware_2-0-1.zip there is only one single tdf file inside.
<RolfNoot> Still building with contrib/cross-build is very cumbersome on MacOS
<RolfNoot> I think the script is quite outdated or not compatible with newer releases
<RolfNoot> I will move to native building, guess that works better
<RolfNoot> Some problems I run into:
<RolfNoot> building libFTDI: Could NOT find LibUSB (missing: LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR)
<RolfNoot> while the script had just built LibUSB without issues
<RolfNoot> when building Capstone: i686-w64-mingw32-gcc: fout: unrecognized command-line option ‘-arch’
<PaulFertser> This script is used by ST to build their Windows binaries.
<PaulFertser> And probably by riscv fork too.
<RolfNoot> when building libjaylink: Users/rolf/openocd-cross/libjaylink/config.guess: No such file or directory
<RolfNoot> and /Users/rolf/openocd-cross/libjaylink/configure: No such file or directory
<RolfNoot> while libjaylink is cloned into /Users/rolf/openocd-cross/libjaylink
<RolfNoot> PaulFertser: Okay, probably they made changes or use other sources / versions.
<RolfNoot> PaulFertser: maybe it will work better on Linux as well
<PaulFertser> Probably it assumes you have released versions which has "configure" file.
<PaulFertser> As the script doesn't run autoreconf for those additional libraries.
<RolfNoot> yes, so I need to bootstrap
nerozero has quit [Ping timeout: 246 seconds]
<RolfNoot> the script seems to build without libftdi, only cross-compiling is slow. Will check if I can set -j12 for the compiler
merethan has quit [Ping timeout: 245 seconds]
Haohmaru has quit [Quit: saionara]
<PaulFertser> RolfNoot: yes, just set MAKE_JOBS prior to running
<PaulFertser> export MAKE_JOBS=$(nproc)
ahorvat has joined #openocd
Vuokko has joined #openocd
Hawk777 has joined #openocd
gzlb has quit [Ping timeout: 256 seconds]
gzlb has joined #openocd
Vuokko has quit [Quit: Client closed]
IoT-Maker has quit [Ping timeout: 260 seconds]
RolfNoot has quit [Remote host closed the connection]
RolfNoot has joined #openocd
<RolfNoot> PaulFertser: thanks, that works
RolfNoot has quit [Remote host closed the connection]
RolfNoot has joined #openocd
tlwoerner_ has joined #openocd
tlwoerner has quit [Ping timeout: 260 seconds]