IRC log for #openjtag on 20070327

01:59.08*** join/#openjtag RobNC (n=NSLU2-IR@user-0c8ha9e.cable.mindspring.com)
02:01.02*** join/#openjtag RobNC (n=NSLU2-IR@user-0c8ha9e.cable.mindspring.com)
02:01.11RobNCAnyone ever used BDI2000?
02:13.56*** join/#openjtag purl (i=ibot@pdpc/supporter/active/TimRiker/bot/apt)
02:13.56*** topic/#openjtag is this is the place to discuss bootloaders and JTAG
02:17.03*** join/#openjtag purl (i=ibot@pdpc/supporter/active/TimRiker/bot/apt)
02:17.03*** topic/#openjtag is this is the place to discuss bootloaders and JTAG
02:20.02wookey_RobNC: not me personally, but I know it is popular
02:20.55RobNCThanks, trying to hack something I read on bdi website about it to reprogram flash of NSLU2.
03:29.04*** join/#openjtag muasch|swiss (n=muasch@31.14.3.213.fix.bluewin.ch)
05:15.06*** join/#openjtag muasch|swiss (n=muasch@31.14.3.213.fix.bluewin.ch)
05:42.13*** join/#openjtag aproemel (n=aproemel@www-cache.bocholt.fh-gelsenkirchen.de)
06:28.45*** join/#openjtag rd_ (n=redragon@segfault.net)
13:06.20*** join/#openjtag bullet (n=bullet@237.219.62.81.cust.bluewin.ch)
13:35.45*** join/#openjtag prpplague^2 (n=dave@mail.americanmicrosystems.com)
13:50.39*** join/#openjtag xela (n=chatzill@p549ca2a8.dip0.t-ipconnect.de)
13:50.56xelahello vmaster...
13:51.33vmasterhey xela
13:51.59xeladebugging works fine so far (i uploaded my config to openfacts)
13:52.24xelabut on larger files i get the error "could not allocate... workspace..."
13:52.30xelado you have an idea for this?
14:04.37vmasterwhere's that error from?
14:04.45vmasterOpenOCD?
14:04.48xelafrom openocd
14:04.50xelayes
14:05.30vmasterdo you have a log, or a screenshot?
14:05.40vmastergotta run, i'll be back in 30minutes or so
14:24.37*** join/#openjtag bullet (n=bullet@237.219.62.81.cust.bluewin.ch)
14:34.35vmasterok, i'm back
14:48.04xelasorry, have to go for a meeting :-(
14:48.07xelawill ask again
16:18.15*** join/#openjtag bullet (n=bullet@125.248.62.81.cust.bluewin.ch)
16:26.04*** join/#openjtag xela (n=chatzill@p549ca2a8.dip0.t-ipconnect.de)
16:26.11xelavmaster: i am back
16:26.15xelayou still there?
16:26.58vmasteryeah
16:27.27xela> flash erase 0 0 9
16:27.29xelaerased sectors 0 through 9 on flash bank 0 in 3s 984375us
16:27.30xela> flash write 0 ../app/src/output/app.bin 0
16:27.31xela> flash write 0 ../app/src/output/app.bin 0
16:27.33xelafailed writing file ../app/src/output/app.bin to flash bank 0 at offset 0x00000000
16:27.34xelaflash program error
16:27.40xelaand in the openocd window i got:
16:27.55xelaWarning: target.c:537 target_alloc_working_area(): not enough working area available
16:27.56xelaError:   armv4_5.c:584 armv4_5_run_algorithm(): timeout waiting for algorithm to complete, trying to halt target
16:27.58xelaError:   str7x.c:539 str7x_write_block(): error executing str7x flash write algorithm
16:27.59xelaError:   str7x.c:627 str7x_write(): flash writing failed with error code: 0x0
16:28.09vmasterdo you have a "working_area" line your .cfg?
16:28.28xelaworking_area 0 0x40000000 0x4000 nobackup
16:29.08xelatoo big? (stack issues?)
16:29.14xeladisable irqs?
16:29.26vmasterirqs should be disabled
16:29.44vmasteryou're using the str750 iirc?
16:29.47xelayep
16:31.47vmasterok, the working_area msg isn't critical. the code first tries to allocate a 8kb buffer and then decreases the size
16:31.56xelaah ok
16:32.27xelasince our last conversation i have flash the bootloader (which has 2 x 16KB) several dozen times without an error
16:32.47xelabut the app has 232KB and I have a hard time to get it flashed
16:35.16*** join/#openjtag aproemel (n=aproemel@p508ABCEA.dip0.t-ipconnect.de)
16:36.06vmastercould you try again with "-d -l <logfile>" - that should show us where the algorithm execution stopped
16:36.23xelaok
16:41.44*** join/#openjtag rd_ (n=redragon@vnsecurity.net)
16:42.23xelaok
16:42.26xelait worked several times
16:42.33xelabut now i have the reset again
16:42.52xelasorry, error
16:42.59xelathe file is pretty big...
16:43.10xelainterested in a special portion?
16:43.42vmasterit should compress quite well
16:43.51xelaError:   armv4_5.c:584 armv4_5_run_algorithm(): timeout waiting for algorithm to complete, trying to halt target
16:44.09vmasteryeah, mostly the stuff after that
16:44.58xelahow can i send it to you?
16:45.14vmasterDominic <dot> Rath <at> gmx <dot> de
16:45.23vmasteror pastebin.ca
16:46.19xelasent
16:47.07vmasterok, got it... let me check what's in there
16:54.58vmasterhum, looks like interrupts were indeed enabled - but i remember fixing that more than half a year ago
16:56.03xelathe executable is from openocd-2007re131
17:05.04xelawhat i dont understand...
17:07.50xelawho enables the interrupts?
17:07.58xelaif i issue an "soft_reset_halt"
17:08.23xelaand then "flash write..." i would think there is no such thing like enabled interrupts
17:09.37vmasteryeah, the interrupts should be disabled, and there should also be a bit in the EmbeddedICE control register set to keep interrupts disabled, no matter what's in CPSR
17:10.17xelacan i set this in openocd? at least as a workaround for now?
17:31.58vmasterthere are several things that i don't understand with this log
17:32.22xelaanything i can help? information you need from me?
17:32.28vmasterCPSR has I and F set to zero, i.e. interrupts enabled, but the soft_reset_halt should have set them
17:33.21vmastercan you show me the telnet log from when the flashing failed?
17:33.36xelaopenocd crashed several times in the meantime...
17:33.43xelabut i will retry it
17:36.13xelaOpen On-Chip Debugger
17:36.14xela> soft_reset_halt
17:36.16xelarequesting target halt and executing a soft reset
17:36.17xelaTarget 0 halted
17:36.19xelatarget halted in ARM state due to debug request, current mode: Supervisor
17:36.21xelacpsr: 0x600000d3 pc: 0x00000000
17:36.22xela> flash erase 0 0 9
17:36.23xelaerased sectors 0 through 9 on flash bank 0 in 3s 843750us
17:36.25xela> flash write 0 ../app/src/output/app.bin 0
17:36.26xelafailed writing file ../app/src/output/app.bin to flash bank 0 at offset 0x00000000
17:36.28xelaflash program error
17:36.30xela>
17:36.31xelai just sent the log to your email address
17:38.06vmasterok, thanks
17:41.01xelawhen i retry flashing after this i get:
17:41.03xela> flash write 0 ../app/src/output/app.bin 0
17:41.04xelafailed writing file ../app/src/output/app.bin to flash bank 0 at offset 0x00000000
17:41.05xelaflash program error
17:41.07xela> flash write 0 ../app/src/output/app.bin 0
17:41.09xelafailed writing file ../app/src/output/app.bin to flash bank 0 at offset 0x00000000
17:41.10xelaflash program error
17:41.12xela> flash write 0 ../app/src/output/app.bin 0
17:41.13xelafailed writing file ../app/src/output/app.bin to flash bank 0 at offset 0x00000000
17:41.15xelaflash program error
17:41.16xela>
17:43.25vmasterok, this time the CPSR was ok, so it isn't interrupt related
17:45.47xelawhen i try flashing from within gdb i get something like
17:46.11xela(gdb) monitor flash write 0 ../app/src/output/app.bin 0
17:46.13xelaIgnoring packet error, continuing...
17:46.14xela(gdb) Reply contains invalid hex digit 116
17:46.23xelabut i think this is a different problem
17:47.02xela(ah, and after that ignoring... the telnet is sloooooow, or doesnt respond for several minutes)
17:49.02xelaopenocd shows:
17:49.04xelaWarning: gdb_server.c:195 gdb_put_packet(): negative reply, retrying
17:49.34vmasterhum, that's totally unrelated (but shouldn't happen either)
17:50.32xelais there a bugtracker for openocd? maybe the one on berlios?
17:51.01vmasterwell, yeah, but i'm the only one who monitors that bugtracker, so it's not much use...
17:51.35xelaok
17:51.41xelasome more info
17:51.46xelaafter flashing has failed
17:52.07xelaevery time i try to flash after that error i get the same flash error
17:52.24xelaafter several retries it seems to work or at least "do" something
17:52.35xelathe output in openocd is:
17:52.39vmasterok, but did it ever work on a "fresh" start?
17:52.49xelaWarning: target.c:537 target_alloc_working_area(): not enough working area available
17:52.51xelaWarning: str7x.c:511 str7x_write_block(): no large enough working area available, can't do block memory writes
17:52.52xelaWarning: str7x.c:620 str7x_write(): couldn't use block writes, falling back to single memory accesses
17:53.13xelawhat do you mean with fresh start? restart openocd? powerdown/powerup`?
17:53.32vmasterdid you leave it runnig after the "falling back" message? did it finish?
17:53.45vmasteryeah, by "fresh start" i mean a power-up
17:53.55vmasteror at least "restart openocd"
17:54.15vmasterthe fall back should take /long/
17:54.31vmasterlike 15 or 20 minutes for your 200+kb file
17:54.41xelai didnt leave it on running
17:55.55vmasterdid you ever succeed with writing the whole image?
17:56.09xelayes
17:59.01xela> reset
17:59.02xela> Target 0 halted
17:59.04xelatarget halted in ARM state due to debug request, current mode: System
17:59.05xelacpsr: 0x8000001f pc: 0x2000058c
17:59.07xela> soft_reset_halt
17:59.08xelarequesting target halt and executing a soft reset
17:59.10xelaTarget 0 halted
17:59.11xelatarget halted in ARM state due to debug request, current mode: Supervisor
17:59.13xelacpsr: 0x800000d3 pc: 0x00000000
17:59.14xela> flash write 0 ../app/src/output/app.bin 0
17:59.16xelafailed writing file ../app/src/output/app.bin to flash bank 0 at offset 0x00000000
17:59.17xelaflash program error
17:59.19xela> reset
17:59.20xela> flash write 0 ../app/src/output/app.bin 0
17:59.22xelafailed writing file ../app/src/output/app.bin to flash bank 0 at offset 0x00000000
17:59.23xelacan't work with this flash while target is running
17:59.25xela> Target 0 halted
17:59.27xelatarget halted in Thumb state due to debug request, current mode: System
17:59.28xelacpsr: 0xffffffff pc: 0xa1a1a191
17:59.29xela> reset
17:59.31xela> Target 0 halted
17:59.33xelatarget halted in ARM state due to debug request, current mode: IRQ
17:59.35xelacpsr: 0x80000092 pc: 0x00000000
17:59.37xela> flash write 0 ../app/src/output/app.bin 0
17:59.39xelafailed writing file ../app/src/output/app.bin to flash bank 0 at offset 0x00000000
17:59.41xelaflash program error
17:59.43xela> flash write 0 ../app/src/output/app.bin 0
17:59.45xelawrote file ../app/src/output/app.bin to flash bank 0 at offset 0x00000000 in 33s 843750us
17:59.47xela>
18:00.00vmasterok, retrying after it failed once is definitely not a good idea
18:00.26vmasterah, you issued "reset" in between
18:00.45xelawas a thing i wanted to try now after all those errors
18:01.08vmasterok, that's your current state?
18:01.35vmasteri.e. you have the image in flash, and the OpenOCD reported that it worked?
18:01.44xelayes
18:02.13xelabut i need several approaches until it works
18:02.21vmastercould you verify that the flashing worked by dumping to a file (dump binary <file> <address> <size>)?
18:07.58xelamoment...
18:08.08*** join/#openjtag rd_ (n=redragon@segfault.net)
18:12.58xelathe files are identical
18:15.15vmasterhum, we could break on any exception... that should allow us to see why the algorithm execution is aborted
18:15.27vmasters/any/every/
18:18.44vmastergotta run some checks here first
18:28.03*** join/#openjtag nm (n=nm@222.252.37.87)
18:33.14xelayes
18:33.23xela(had some pizza...)
18:41.10xelavmaster: did you set up the OpenFacts page with the example scripts as well?
18:41.34*** part/#openjtag nm (n=nm@222.252.37.87)
18:42.15vmastermhh, i think the example scripts page was contributed
18:48.15*** join/#openjtag bullet (n=bullet@125.248.62.81.cust.bluewin.ch)
18:48.34xelawell, i though about indenting the script with one space
18:48.47xelaso they would be formatted as source code (courier new) or alike
18:49.14xelabut since i am new here i dont want to just trample about and change whatever i see...
18:49.25xela(but willing to contribute)
18:59.31xelas/though/though/
19:11.40*** join/#openjtag vmaster_ (i=vmaster@p5B07D342.dip.t-dialin.net)
19:13.02vmasterxela: ok, got something for you to test
19:13.13xelagreat!
19:13.37vmastermake sure everything is "clean", i.e. the flash erased, board freshly powered up, openocd restarted
19:14.02xelaok
19:15.12vmasteruse the "reg" command to set these registers:
19:15.15vmaster(47) watch 1 addr value (/32): 0x00000000 (dirty: 0, valid: 1)
19:15.15vmaster(48) watch 1 addr mask (/32): 0x0000001f (dirty: 0, valid: 1)
19:15.15vmaster(49) watch 1 data value (/32): 0x00000000 (dirty: 0, valid: 1)
19:15.15vmaster(50) watch 1 data mask (/32): 0xffffffff (dirty: 0, valid: 1)
19:15.15vmaster(51) watch 1 control value (/32): 0x00000100 (dirty: 0, valid: 1)
19:15.18vmaster(52) watch 1 control mask (/32): 0x000000f7 (dirty: 0, valid: 1)
19:15.44vmasterthis causes a breakpoint to be taken on every vector
19:15.50vmasterthen try the flash write sequence
19:15.59vmastermake sure logging is enabled
19:16.03xelaok
19:18.00vmasterit might seems as if it worked, but you'll only know after comparing with a dump
19:18.53xelawhats the command to set a register?
19:19.09vmaster"reg <number> <value"
19:19.30vmastere.g. "reg 47 0x0"
19:20.51xelaok
19:21.32xela1 try succeeded
19:21.50xelai will erase and restart
19:21.52vmasterno
19:21.55vmasterdump
19:22.04xelaok
19:22.05vmasteronly a dump shows you if it really succeeded
19:22.18vmasterto the algorithm code, the breakpoint we set looks like it completed
19:35.35xelamoment have to install cygwin (the hexdump tool i used is win32 crap that produced invalid results)
19:36.36vmasterhmm, just send me the log you've got
19:36.45vmasteri guess i'll be able to see if it worked
19:37.03vmasterthe PC is recorded on reentering debug state
19:38.02xelaok, sent
19:39.56xelaok, files are identical
19:42.20vmasterhmm, yeah, debug was always entered at:
19:42.21vmasterDebug:   arm7_9_common.c:1011 arm7_9_debug_entry(): entered debug state at PC 0x4000004c
19:59.50xelaanything i can do?
20:01.16vmasterif you want you can try again until the dump fails
20:01.39vmasterand send a log from that run
20:01.46vmasterideally you'd start the OpenOCD again on each try
20:01.55xelahm.
20:02.43vmasteror use the additional breakpoint each time you have to flash anyway
20:03.19xelayou mean the reg... sequence?
20:03.28vmasteryeah
20:03.33vmasteryou can put the commands into a script file
20:03.39vmaster(a normal text file)
20:03.44vmasterand call that with "script"
20:03.50xelaok
20:27.54xelacan i run openocd from the commandline, so it only executed some steps and then returns?
20:28.23drathhmm?
20:30.19xelai would like to automize this task
20:30.21xelayou know
20:30.25drathah, yeah, that's possible
20:30.28xelaerase/flash/dump/compare
20:30.44drathhold on, i think there's already an example on the net somewhere
20:31.13drathhttp://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/openocd_intro/index.html
20:31.35drathnot sure if'll get used to that new nick... but vmaster really is from way back in the gaming days... ;)
20:31.45xela:-)
20:32.40xelahm. should i use dcc_downloads as well?
20:32.44drathyou define a target script that gets called after "run_and_halt"
20:32.50drathno, that's only a speed improvement
20:33.00drathwhich might furhter complicate things
20:33.06xelaok
20:34.59*** join/#openjtag drath (i=vmaster@p5b07d342.dip.t-dialin.net)
21:16.34xelai have setup such a script using python and telnetlib
21:23.00xelafrom telnetlib import Telnet
21:23.01xelaimport re
21:23.03xelat=Telnet('127.0.0.1', 4444)
21:23.04xelaFILTER=''.join([(len(repr(chr(x)))==3) and chr(x) or '.' for x in range(256)])
21:23.06xeladef hexDump(src, length=8):
21:23.08xela<PROTECTED>
21:23.09xela<PROTECTED>
21:23.10xela<PROTECTED>
21:23.12xela<PROTECTED>
21:23.14xela<PROTECTED>
21:23.15xela<PROTECTED>
21:23.17xela<PROTECTED>
21:23.18xela<PROTECTED>
21:23.20xeladef dumpFile(bin_file, hex_file):
21:23.21xela<PROTECTED>
21:23.23xela<PROTECTED>
21:23.24xela<PROTECTED>
21:23.26xela<PROTECTED>
21:23.27xela<PROTECTED>
21:23.29xela<PROTECTED>
21:23.31xela<PROTECTED>
21:23.33xela<PROTECTED>
21:23.35xeladef cmd(args):
21:23.37xela<PROTECTED>
21:23.39xela<PROTECTED>
21:23.41xela<PROTECTED>
21:23.43xela<PROTECTED>
21:23.45xela<PROTECTED>
21:23.47xela<PROTECTED>
21:23.49xela<PROTECTED>
21:23.51xela<PROTECTED>
21:23.53xelaBIN='../app/src/output/app.bin'
21:23.55xelaHEX='app.hex'
21:23.57xelaDUMP='dump.bin'
21:23.59xelaDUMP_HEX='dump.hex'
21:24.02xelaapp_hex=dumpFile(BIN,HEX)
21:24.03xelat.read_until('>')
21:24.05xelacmd('halt')
21:24.07xelacmd('reset')
21:24.09xelacmd('soft_reset_halt')
21:24.11xelacmd('flash erase 0 0 9')
21:24.13xelacmd('reg 47 0x00000000 ')
21:24.15xelacmd('reg 48 0x0000001f ')
21:24.17xelacmd('reg 49 0x00000000 ')
21:24.19xelacmd('reg 50 0xffffffff ')
21:24.22xelacmd('reg 51 0x00000100 ')
21:24.24xelacmd('reg 52 0x000000f7 ')
21:24.25xelacmd('flash write 0 %s 0' % (BIN))
21:24.27xelacmd('soft_reset_halt')
21:24.29xelacmd('dump %s 0x20000000 0x3A000' % (DUMP))
21:24.31xeladump_hex=dumpFile(DUMP,DUMP_HEX)
21:24.33xelaif app_hex != dump_hex:
21:24.35xela<PROTECTED>
21:25.16xeladrath: still there?
21:31.09drathyeah
21:31.43drathso, did it eventually fail?
21:31.43xelawell. i guess i have to get some sleep soon
21:32.00xelai didnt manage to get it flashed
21:32.26xelaso now i am commenting out the erase
21:32.33xelamaybe thats the problem (here)
21:43.50xelanow i created a loop in my script to program only blocks of 1024 bytes
21:43.53xelathis worked fine
21:44.10xelawill increase the blocksize to 16384 or so
21:50.06drathheh, just don't wear out your flash because of this problem
21:50.38xelawell, should make no difference whether i program it in one large piece or smaller ones
22:31.53xelahm even using blocks i get this error

Generated by irclog2html.pl Modified by Tim Riker to work with infobot.