cpq / esputil

ESP flashing utility
MIT License
136 stars 19 forks source link

esputil flash 0 frimware.bin hang #6

Open borisnimcevic opened 1 year ago

borisnimcevic commented 1 year ago

Hi, I am trying the example/blinky and it seems that it builds with no problem but then it stops after "esputil flash 0 firmware.bin" and hangs there forever.

firmware.bin is generated with no issues

I tried on two different esp32c3 boards, but the same result. So I am stuck with ideas on what to do next.

What is it waiting for when it is trying to flash the chip? Where could be my next step in debugging this?

Thank you.

NilsBe commented 1 year ago

Try in verbose mode.

To compare, here's my output with the blinky example:

$ esputil -v flash 0 firmware.bin
Opened /dev/ttyACM0 @ 115200 fd=4
SYNC [44 bytes]
0000  00 08 24 00 00 00 00 00 07 07 12 20 55 55 55 55  ..$........ UUUU
0010  55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55  UUUUUUUUUUUUUUUU
0020  55 55 55 55 55 55 55 55 55 55 55 55              UUUUUUUUUUUU

--SLIP_RESPONSE: [12 bytes]
0000  01 08 04 00 12 55 55 55 00 00 00 00              .....UUU....

READ_REG [12 bytes]
0000  00 0a 04 00 00 00 00 00 00 10 00 40              ...........@

--SLIP_RESPONSE: [12 bytes]
0000  01 0a 04 00 6f 50 31 1b 00 00 00 00              ....oP1.....

SPI_ATTACH [16 bytes]
0000  00 0d 08 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

--SLIP_RESPONSE: [12 bytes]
0000  01 0d 04 00 6f 50 31 1b 00 00 00 00              ....oP1.....

SPI_SET_PARAMS [32 bytes]
0000  00 0b 18 00 00 00 00 00 00 00 00 00 00 00 40 00  ..............@.
0010  00 00 01 00 00 10 00 00 00 01 00 00 ff ff 00 00  ................

--SLIP_RESPONSE: [12 bytes]
0000  01 0b 04 00 6f 50 31 1b 00 00 00 00              ....oP1.....

READ_FLASH_SLOW [16 bytes]
0000  00 0e 08 00 00 00 00 00 00 00 00 00 10 00 00 00  ................

--SLIP_RESPONSE: [76 bytes]
0000  01 0e 44 00 6f 50 31 1b e9 02 02 2f 00 04 38 40  ..D.oP1..../..8@
0010  ee 00 00 00 05 00 00 00 00 00 00 00 00 00 00 00  ................
0020  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0030  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0040  00 00 00 00 00 00 00 00 00 00 00 00              ............

Using flash params 0x22f
Erasing 560 bytes @ 0FLASH_BEGIN [28 bytes]
0000  00 02 14 00 00 00 00 00 30 02 00 00 01 00 00 00  ........0.......
0010  00 10 00 00 00 00 00 00 00 00 00 00              ............

--SLIP_RESPONSE: [12 bytes]
0000  01 02 04 00 6f 50 31 1b 00 00 02 2f              ....oP1..../

Writing firmware.bin, 560/560 bytes @ 0x0 (100%)FLASH_DATA [584 bytes]
0000  00 03 40 02 9a 00 00 00 30 02 00 00 00 00 00 00  ..@.....0.......
0010  00 00 00 00 00 00 00 00 e9 02 02 2f 00 04 38 40  .........../..8@
0020  ee 00 00 00 05 00 00 00 00 00 00 00 00 00 00 01  ................
0030  00 80 c8 3f 60 00 00 00 4c 45 44 3a 20 25 64 0a  ...?`...LED: %d.
0040  00 41 25 00 00 00 72 69 73 63 76 00 01 1b 00 00  .A%...riscv.....
0050  00 04 10 05 72 76 33 32 69 32 70 30 5f 6d 32 70  ....rv32i2p0_m2p
0060  30 5f 63 32 70 30 00 41 25 00 00 00 72 69 73 63  0_c2p0.A%...risc
0070  76 00 01 1b 00 00 00 04 10 05 72 76 33 32 69 32  v.........rv32i2
0080  70 30 5f 6d 32 70 30 5f 63 32 70 30 00 00 00 00  p0_m2p0_c2p0....
0090  00 00 00 00 00 00 00 00 00 04 38 40 a0 01 00 00  ..........8@....
00a0  b7 87 c8 3f 37 87 c8 3f 93 87 07 07 23 20 f7 06  ...?7..?....# ..
00b0  b7 87 ca 3f 37 87 c8 3f 93 87 07 00 23 22 f7 06  ...?7..?....#"..
00c0  41 11 b7 87 c8 3f 37 85 c8 3f 93 87 07 07 13 07  A....?7..?......
00d0  05 06 06 c6 33 86 e7 40 63 f3 e7 00 01 46 81 45  ....3..@c....F.E
00e0  13 05 05 06 97 00 c8 ff e7 80 00 f1 b7 07 0c 60  ...............`
00f0  98 47 13 05 00 0a 71 9b 98 c7 98 47 13 67 57 00  .G....q....G.gW.
0100  98 c7 37 87 0a 00 13 07 07 40 b8 cf b7 07 00 40  ..7......@.....@
0110  93 87 87 58 82 97 15 20 01 a0 b7 37 02 60 37 07  ...X... ...7.`7.
0120  00 40 d8 c3 85 47 3e 87 fd 17 11 e7 b7 37 02 60  .@...G>......7.`
0130  ac 43 e8 43 82 80 01 00 fd b7 01 11 b7 87 00 60  .C.C...........`
0140  b7 46 d8 50 26 ca 4a c8 4e c6 52 c4 56 c2 06 ce  .F.P&.J.N.R.V...
0150  22 cc 5a c0 13 87 07 08 93 86 16 aa 14 d7 23 a8  ".Z...........#.
0160  07 08 b7 36 1d 8f 23 a6 07 08 93 86 a6 12 14 db  ...6..#.........
0170  54 57 37 06 00 80 fd 74 d1 8e 54 d7 23 aa 07 0a  TW7....t..T.#...
0180  b7 f7 01 60 03 a7 c7 0f 93 06 00 28 fd 14 13 77  ...`.......(...w
0190  f7 df 23 ae e7 0e 23 a4 07 04 b7 07 02 60 23 a4  ..#...#......`#.
01a0  07 04 b7 47 00 60 13 87 07 58 54 c3 98 53 85 66  ...G.`...XT..S.f
01b0  b7 a9 07 00 65 8f 98 d3 98 53 37 8a c8 3f b7 8a  ....e....S7..?..
01c0  c8 3f 55 8f 98 d3 37 49 00 60 93 89 09 12 13 04  .?U...7I.`......
01d0  8a 06 0c 40 13 85 0a 00 97 00 c8 ff e7 80 80 b0  ...@............
01e0  83 27 49 00 18 40 e5 8f 23 22 f9 00 83 26 49 00  .'I..@..#"...&I.
01f0  b3 37 e0 00 b2 07 d5 8f 23 22 f9 00 13 37 17 00  .7......#"...7..
0200  18 c0 21 3f 93 97 c5 01 11 81 5d 8d 33 0b 35 01  ..!?......].3.5.
0210  91 81 33 35 ab 00 33 04 b5 00 01 37 93 97 c5 01  ..35..3....7....
0220  11 81 91 81 5d 8d 63 e6 85 00 e3 12 b4 fa e3 70  ....].c........p
0230  65 fb 85 47 3e 87 fd 17 6d d3 01 00 e5 bf 00 00  e..G>...m.......
0240  00 00 00 00 00 00 00 d4                          ........

--SLIP_RESPONSE: [12 bytes]
0000  01 03 04 00 6f 50 31 1b 00 00 02 2f              ....oP1..../

Written firmware.bin, 560 bytes @ 0
FLASH_END [12 bytes]
0000  00 04 04 00 00 00 00 00 00 00 00 00              ............

--SLIP_RESPONSE: [12 bytes]
0000  01 04 04 00 6f 50 31 1b 00 00 02 2f              ....oP1..../
volemo commented 12 months ago

I've encountered the same problem. Verbose mode shows nothing — before any if (verbose) the program hangs on open syscall in open_serial function. As far as I could check with fuser and lsof, the device file is free.

I'm using macOS 14.1.1 on MacBook Air M1 and ESP32C3 board by LuatOS . ESP IDF compiles and flashes the board without problems.