@@ -27,10 +27,16 @@ fpb_cli.py [OPTIONS] <command> [args...]
2727
2828Options:
2929 -v, --verbose Enable verbose output
30+ --version Show version
3031 --port, -p < device> Serial port (e.g., /dev/ttyACM0, COM3)
3132 --baudrate, -b < rate> Serial baudrate (default: 115200)
3233 --elf < path> Path to ELF file (global default)
3334 --compile-commands < path> Path to compile_commands.json
35+ --tx-chunk-size < bytes> TX chunk size for serial commands (0=disabled, default: 0)
36+ --tx-chunk-delay < secs> Delay between TX chunks in seconds (default: 0.005)
37+ --max-retries < num> Maximum retry attempts for file transfer (default: 10)
38+ --direct Force direct serial connection (skip WebServer proxy detection)
39+ --server-url < url> WebServer URL for proxy mode (default: http://localhost:5500)
3440```
3541
3642## Commands
@@ -105,12 +111,40 @@ fpb_cli.py search <elf_path> <pattern>
105111}
106112```
107113
108- #### 6. ` compile ` - Compile patch source (offline validation)
114+ #### 6. ` get-symbols ` - Get all symbols from ELF
115+
116+ More comprehensive than ` search ` — returns all symbol types via ` nm ` , with optional filtering.
117+
118+ ``` bash
119+ fpb_cli.py get-symbols < elf_path> [--filter < pattern> ] [--limit < num> ]
120+ ```
121+
122+ ** Options:**
123+ - ` --filter <pattern> ` — Case-insensitive substring filter (default: all symbols)
124+ - ` --limit <num> ` — Maximum results, 0 for unlimited (default: 0)
125+
126+ ** Output:**
127+ ``` json
128+ {
129+ "success" : true ,
130+ "count" : 3 ,
131+ "total" : 150 ,
132+ "symbols" : [
133+ {"name" : " gpio_init" , "addr" : " 0x08001000" , "type" : " func" },
134+ {"name" : " gpio_pin_map" , "addr" : " 0x08002000" , "type" : " other" }
135+ ]
136+ }
137+ ```
138+
139+ #### 7. ` compile ` - Compile patch source (offline validation)
109140
110141``` bash
111142fpb_cli.py compile < source_file> --elf < elf> --compile-commands < path> [--addr < base_addr> ]
112143```
113144
145+ ** Options:**
146+ - ` --addr <base_addr> ` — Base address for patch code (default: 0x20001000)
147+
114148** Output:**
115149``` json
116150{
@@ -121,9 +155,25 @@ fpb_cli.py compile <source_file> --elf <elf> --compile-commands <path> [--addr <
121155}
122156```
123157
158+ ### Connection Commands
159+
160+ #### 8. ` connect ` - Connect to device
161+
162+ ``` bash
163+ fpb_cli.py --port /dev/ttyACM0 connect
164+ ```
165+
166+ Establishes a serial connection. Required before any online command when using ` --direct ` mode.
167+
168+ #### 9. ` disconnect ` - Disconnect from device
169+
170+ ``` bash
171+ fpb_cli.py disconnect
172+ ```
173+
124174### Online Commands (Device Required)
125175
126- #### 7 . ` info ` - Get device FPB info
176+ #### 10 . ` info ` - Get device FPB info
127177
128178``` bash
129179fpb_cli.py --port /dev/ttyACM0 info
@@ -141,7 +191,7 @@ fpb_cli.py --port /dev/ttyACM0 info
141191}
142192```
143193
144- #### 8 . ` inject ` - Inject patch to device
194+ #### 11 . ` inject ` - Inject patch to device
145195
146196``` bash
147197fpb_cli.py --port < device> --elf < elf> --compile-commands < path> \
@@ -178,13 +228,136 @@ fpb_cli.py --port /dev/ttyACM0 --elf firmware.elf \
178228}
179229```
180230
181- #### 9 . ` unpatch ` - Remove patch
231+ #### 12 . ` unpatch ` - Remove patch
182232
183233``` bash
184234fpb_cli.py --port /dev/ttyACM0 unpatch --comp < slot>
185235fpb_cli.py --port /dev/ttyACM0 unpatch --all
186236```
187237
238+ #### 13. ` test-serial ` - Test serial throughput
239+
240+ 3-phase probing to find optimal transfer parameters.
241+
242+ ``` bash
243+ fpb_cli.py --port /dev/ttyACM0 test-serial [options]
244+
245+ Options:
246+ --start-size < bytes> Starting test size (default: 16)
247+ --max-size < bytes> Maximum test size (default: 4096)
248+ --timeout < secs> Timeout per test (default: 2.0)
249+ ```
250+
251+ ### Serial I/O Commands (Device Required)
252+
253+ #### 14. ` serial-send ` - Send data to device
254+
255+ ``` bash
256+ fpb_cli.py --port /dev/ttyACM0 serial-send < data> [options]
257+
258+ Options:
259+ --no-read Don' t read response after sending
260+ --timeout <secs> Response read timeout (default: 1.0)
261+ ```
262+
263+ **Output:**
264+ ```json
265+ {
266+ "success": true,
267+ "sent": "ps",
268+ "response": " PID GROUP PRI POLICY TYPE NPX STATE ..."
269+ }
270+ ```
271+
272+ > WARNING: Avoid sending `fl` commands directly — use `inject`/`unpatch`/`info` instead.
273+
274+ #### 15. `serial-read` - Read serial output
275+
276+ ```bash
277+ fpb_cli.py --port /dev/ttyACM0 serial-read [options]
278+
279+ Options:
280+ --timeout <secs> How long to wait for data (default: 1.0)
281+ --lines <num> Max log lines to return (default: 50)
282+ ```
283+
284+ **Output:**
285+ ```json
286+ {
287+ "success": true,
288+ "new_data": "Patched: pin=13 val=1\r\n",
289+ "log": ["Patched: pin=13 val=1"],
290+ "log_count": 1,
291+ "total_buffered": 1
292+ }
293+ ```
294+
295+ ### Memory Access Commands (Device Required)
296+
297+ #### 16. `mem-read` - Read device memory
298+
299+ ```bash
300+ fpb_cli.py --port /dev/ttyACM0 mem-read <addr> <length> [--fmt hex|raw|u32]
301+ ```
302+
303+ **Example:**
304+ ```bash
305+ fpb_cli.py --port /dev/ttyACM0 mem-read 0x20000000 64 --fmt hex
306+ ```
307+
308+ #### 17. `mem-write` - Write to device memory
309+
310+ ```bash
311+ fpb_cli.py --port /dev/ttyACM0 mem-write <addr> <hex_data>
312+ ```
313+
314+ **Example:**
315+ ```bash
316+ fpb_cli.py --port /dev/ttyACM0 mem-write 0x20001000 DEADBEEF01020304
317+ ```
318+
319+ #### 18. `mem-dump` - Dump memory to file
320+
321+ ```bash
322+ fpb_cli.py --port /dev/ttyACM0 mem-dump <addr> <length> <output_file>
323+ ```
324+
325+ **Example:**
326+ ```bash
327+ fpb_cli.py --port /dev/ttyACM0 mem-dump 0x20000000 4096 /tmp/ram.bin
328+ ```
329+
330+ ### File Transfer Commands (Device Required)
331+
332+ #### 19. `file-list` - List device directory
333+
334+ ```bash
335+ fpb_cli.py --port /dev/ttyACM0 file-list [path]
336+ ```
337+
338+ Default path is `/`.
339+
340+ #### 20. `file-stat` - Get file info
341+
342+ ```bash
343+ fpb_cli.py --port /dev/ttyACM0 file-stat <path>
344+ ```
345+
346+ Returns size, modification time, and type (file/dir).
347+
348+ #### 21. `file-download` - Download file from device
349+
350+ ```bash
351+ fpb_cli.py --port /dev/ttyACM0 file-download <remote_path> <local_path>
352+ ```
353+
354+ Transfers via chunked Base64 encoding with CRC verification.
355+
356+ **Example:**
357+ ```bash
358+ fpb_cli.py --port /dev/ttyACM0 file-download /data/log.bin /tmp/log.bin
359+ ```
360+
188361## Typical Workflow
189362
190363```bash
0 commit comments