Hi This looks like a reset problem, not a write to flash problem. This is the type of problems we are trying fix with the latest jtag/jlink/ft2232 patches.
What is the target configuration. Best regards Magnus Xiaofan Chen skrev: > Relative long email. > > I have not tried to use flashing so far. So today I tried to learn how to > flash the LPC2148 on board of the Olimex LPC-P2148. > > I tried to halt the target and then use > "flash write_image isoc_io_sample.hex 0x0 ihex" but this does > not seem to work. Then I tried to use the following script from psas > (in part or in full, dcc or non-dcc) > http://www.linuxjournal.com/article/10421 > > #***************** > # open ocd (on chip debugger) script to flash lpc2148 > # 'info .../OCD/src/openocd/doc/openocd.info' > > # 3 is most. 0 is least info. > debug_level 1 > # stop > reset halt > # log file > log_output write_flash.log > # pause...500mS > sleep 500 > # current state > poll > # Force ARM7 into supervisor mode > reg cpsr 0x13 > # mww: Memory word write > # Set the MEMMAP reg to point to flash (avoids problems while trying to flash) > mww 0xE01FC040 1 > ### > # * arm7_9 dcc_downloads <ENABLE|DISABLE> Enable the use of the debug > # communications channel (DCC) to write larger (>128 byte) amounts > # of memory. DCC downloads offer a huge speed increase, but might be > # potentially unsafe, especially with targets running at a very low > # speed. This command was introduced with OpenOCD rev. 60. > arm7_9 dcc_downloads enable > # Wait for target to enter debug mode. Default time is 5ms. > wait_halt > # pause > sleep 10 > # current state > poll > # identify the flash > flash probe 0 > # erase first bank only: > flash erase_sector 0 0 26 > # pause > sleep 20 > # memory display halfword <from address> [COUNT] > mdh 0x0 30 > # pause > sleep 20 > ### > # * flash write_image [ERASE] <FILE> [OFFSET] [TYPE] Write the image > # <FILE> to the current target's flash bank(s). A relocation > # [OFFSET] can be specified and the file [TYPE] can be specified > # explicitly as `bin' (binary), `ihex' (Intel hex), `elf' (ELF file) > # or `s19' (Motorola s19). Flash memory will be erased prior to > # programming if the `erase' parameter is given. > flash write_image isoc_io_sample.hex 0x0 ihex > #flash write_image serial.hex 0x0 > #flash erase write_image serial.hex 0x0 > #flash write_image serial.elf 0x0 elf > #flash write_image serial.hex 0x0 ihex > #flash write_image serial.bin 0x0 bin > > # pause > sleep 20 > # memory display halfword <from address> [COUNT] > mdh 0x0 30 > # pause > sleep 20 > # can't verify because of 0x14 reserved chksum address (LPC SPEC) > #verify_image serial.hex 0x0 bin > # memory display halfword <from address> [COUNT] > mdh 0x0 30 > > # pause > sleep 20 > #reset run_and_halt > reset > halt > > # pause > sleep 10 > # stop the open ocd daemon. > #shutdown > #***************** > > > The flashing seem to be successful but the target is not working. > > target state: halted > target halted in ARM state due to debug-request, current mode: System > cpsr: 0x8000005f pc: 0x0000088c > cpsr (/32): 0x00000013 > dcc downloads are enabled > target state: halted > target halted in ARM state due to debug-request, current mode: Supervisor > cpsr: 0x00000013 pc: 0x0000088c > flash 'lpc2000' found at 0x00000000 > erased sectors 0 through 26 on flash bank 0 in 0.256274s > 0x00000000: ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff > ffff ffff ffff ffff ffff > 0x00000020: ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff > ffff ffff ffff > wrote 8036 byte from file isoc_io_sample.hex in 1.586009s (4.948053 kb/s) > 0x00000000: f018 e59f f018 e59f f018 e59f f018 e59f f018 e59f 0000 > e1a0 fff0 e51f f014 e59f > 0x00000020: 0040 0000 00e4 0000 00e0 0000 00e4 0000 00e4 0000 00d8 > 0000 00dc 0000 > 0x00000000: f018 e59f f018 e59f f018 e59f f018 e59f f018 e59f 0000 > e1a0 fff0 e51f f014 e59f > 0x00000020: 0040 0000 00e4 0000 00e0 0000 00e4 0000 00e4 0000 00d8 > 0000 00dc 0000 > This error appears after reset command > Error: invalid mode value encountered > Error: cpsr contains invalid mode value - communication failure > Runtime error, file "oocd_flash_lpc2148.script", line 96: > Warn : DBGACK set while target was in unknown state. Reset or > initialize target. > Error: invalid mode value encountered > Error: cpsr contains invalid mode value - communication failure > Warn : DBGACK set while target was in unknown state. Reset or initialize > target. > ... (keeps the same error) > > After this error, I have to unplug everything and then use lpc21isp > to flash the target so that I can run OpenOCD again with J-Link V3. > > I know the hex is correct since the target works when flashing > with lpc21isp. The hex file is built from the lpcusb project and > tested with the Linux host program from psas. > > What is the correct step to flash the LPC2148? > > _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development