NishanthMenon changed the topic of #openocd to: this is the place to discuss all things OpenOCD | Logs: https://libera.irclog.whitequark.org/openocd/
haxar has quit [Ping timeout: 250 seconds]
haxar has joined #openocd
Hawk777 has joined #openocd
wingsorc__ has quit [Quit: Leaving]
t0mm3k has joined #openocd
<t0mm3k> Hey everyone, I have an i.mx35 board with 32MiB NOR-Flash at address 0xA0000000. I connected via JTAG+OpenOCD and where able to read the Memory with `dump_image dump.bin 0xA000000 33554432`. That took a while but worked flawlessly. Now I want to write back to that flash, but neither `load_image` nor gdb-restore works. Even `mwb` doesn't allow me to overwrite stuff. I'm very new to OpenOCD and have no clue why that does not work.
<t0mm3k> Any help is greatly appreciated.
rkta has left #openocd [#openocd]
<Hawk777> Have you declared the Flash with the “flash bank” command?
<Hawk777> I don’t know i.mx35 personally, but some MCUs are able to make Flash appear memory-mapped, but only for reading; if you want to write, you do it through various register accesses instead. Thus, as long as the memory mapping is set up, OpenOCD will be able to read from the Flash at A0000000 without any driver, but needs a driver to understand how to write to it.
<Hawk777> If you’re using a standard devboard or something like that, and a config file specific to that board, it should have the “flash bank” command included. If you’re just using the processor config file, it generally won’t.
<Hawk777> The “flash banks” command (note the plural) lists what banks are configured, so you could check there.
<t0mm3k> Hey Hawk777, thanks for your quick reply. I already read in the openocd documentation about the `flash` commands. Unfortunately `flash banks` and `flash list` don't return anything to me.
<t0mm3k> probably as you expected due to my openocd.cfg (where I only `source` the imx35.cfg and imx.cfg). So no real "board-setup"
<Hawk777> Right, you’ll need to add a “flash bank” line.
<Hawk777> Hm… if there is even a driver in OpenOCD.
<Hawk777> The documentation is here <https://openocd.org/doc-release/html/Flash-Commands.html#Flash-Driver-List>; from searching that page it looks as if there is a driver for the i.mx35 NAND controller but maybe not the NOR controller, unfortunately?
<Hawk777> Unless it’s a parallel Flash (as opposed to SPI or something), in which case the “cfi” driver might work?
<Hawk777> I’m not sure how you make that work honestly (e.g. how you tell it where the MCU’s I/O pins are in memory and how to operate them)
<t0mm3k> I do have a ReferenceManual for my Board which says that the NOR-flash is a "Numonyx PC28F256M29EWL" which is attach via a so called "WEIM" bus. Here a quote from the ReferenceManual:
<t0mm3k> "For example, the EIM default settings allow the core to interface to a NOR Flash
<t0mm3k> device immediately out of reset. This means that the core can interface with any NOR Flash device, but
<t0mm3k> performance is slow. Also, some peripherals, such as SDRAM, might require some registers to be
<t0mm3k> MDC registers are set up using device configuration data (DCD)."
<t0mm3k> programmed before you can use it. WEIM (for NOR flash) and ESDRAMC (for SDRAM) registers and
<t0mm3k> (sorry for shitty formatting)
<Hawk777> I’m not sure that really answers anything. “Interface to” could still mean read-only.
<t0mm3k> I see. Okay so then I guess I have to figure out how to set the `flash bank` command up correctly
<Hawk777> Anyway, sorry I can’t be of more help; I haven’t personally used anything but the stmqspi driver for external Flash, which is not applicable to your situation. I’m off now. Hopefully someone else will be by sometime.
Hawk777 has quit [Quit: Leaving.]
<t0mm3k> Thank you anyways for your time :)
<t0mm3k> (and your clarification of the `flash bank` command) :)
<t0mm3k> have a good one
PsySc0rpi0n has joined #openocd
phr3ak has quit [Ping timeout: 246 seconds]
phr3ak has joined #openocd
<karlp> t0mm3k: there's drivers fora few SoCs to talk to their flash controllers for writing, but not all, you'd need something similar for your own, definitely. reading via memory mapped is easy, as you saw.
<t0mm3k> I tried to make use of the `scripts/board/imx35pdk.cfg` file as well (as it seems to set up the WEIM Bus) but it has no `flash bank` setup either, so I still have no clue how to configure that correctly
<t0mm3k> but you're right, I was surprised that I could read the NOR that easily ;)
<karlp> examples if you want to copy are things like "stmqspi" "ath79" "mrvlqspi" "lpcspifi" and friends.
indy_ is now known as indy
<t0mm3k> but i dont know the driver of my board
<karlp> yes, it's the one you have to write for the imx35 :)
<karlp> what board is this? imx35 I don't remember seeing a lot of, lots of ixm23, but then I thought lots of stuff skipped forward to the imx6
<t0mm3k> its a custom board of my company. its quiet old and prevents us from updating to new tools and languagefeatures. So I'm trying to update it with a new buildroot-system. Before I start I'd like to backup the current system (uboot is stored on its NOR-flash)
<karlp> given that you have uboot already running then, you could just use uboot to write flash...
<t0mm3k> I have the old uboot running. But I'm currently creating a "backup-plan" when I screw up the uboot (while trying to update it). The current version is from 2010
<t0mm3k> before I try to write my new uboot into NOR flash (via the old uboot) I'd like to know, how to restore everything when the board doesn't boot no more ;)
<karlp> check what your imx35 rom bootloader supports as well.
<karlp> other options are a spi flash clip and something like urjtag or flashrom to talk directly to the flash chip, and just hold the processor in reset.
<karlp> many many ways to skin cats .
<t0mm3k> yeah, good to hear that ... unfortunately I'm pretty new to that kind of stuff. Just had my hands on some AVR chips in my free-time
<t0mm3k> I'd hoped for something similar to `load_image` to write back the flash. But that doesn't seem too straight-forward ^^
PsySc0rpi0n has quit [Ping timeout: 256 seconds]
PsySc0rpi0n has joined #openocd
<karlp> not for your board, no... there woudl be, and the work is mostly jsut mechanical copy things from the reference manual, but yes, it's work.
<t0mm3k> okay thank you very much for your support so far. I firstly might ask how our supplier did the initial flashing. If they can't support me, I'll give it a try to read myself into the `flash bank` driver-plugin topic
karlp has quit [Quit: WeeChat 3.5]
karlp has joined #openocd
piie has joined #openocd
marcusmae has quit [Ping timeout: 265 seconds]
PsySc0rpi0n has quit [Ping timeout: 252 seconds]
PsySc0rpi0n has joined #openocd
t0mm3k has quit [Quit: Leaving]
marcusmae has joined #openocd
marcusmae has quit [Ping timeout: 246 seconds]
slobodan has joined #openocd
PsySc0rpi0n has quit [Ping timeout: 260 seconds]
t0mm3k has joined #openocd
PsySc0rpi0n has joined #openocd
t0mm3k has quit [Client Quit]
marcusmae has joined #openocd
PsySc0rpi0n has quit [Ping timeout: 265 seconds]
PsySc0rpi0n has joined #openocd
PsySc0rpi0n has quit [Ping timeout: 248 seconds]
PsySc0rpi0n has joined #openocd
slobodan has quit [Read error: Connection reset by peer]
slobodan has joined #openocd
PsySc0rpi0n has quit [Ping timeout: 265 seconds]
PsySc0rpi0n has joined #openocd
slobodan has quit [Ping timeout: 276 seconds]
zjason``` is now known as zjason
Hawk777 has joined #openocd
slobodan has joined #openocd
slobodan has quit [Quit: Leaving]
peeps[work] has joined #openocd
josuah has joined #openocd
peeps[work] has quit [Ping timeout: 250 seconds]