HiZ> flash -h
usage:
flash [init|probe|erase|write|read|verify|test]
[-f ] [-e(rase)] [-v(verify)] [-h(elp)]
Initialize and probe: flash probe
Erase and program, with verify: flash write -f example.bin -e -v
Read to file: flash read -f example.bin
Verify with file: flash verify -f example.bin
Test chip (full erase/write/verify): flash test
read, write and erase flash chips using SFDP info if available
init Reset and initialize flash chip. Default if no options given. flash
probe Probe flash chip for ID and SFDP info. flash probe
erase Erase flash chip. flash erase [-v(erify)]
write Write file to flash chip. flash write -f {file} [-e(rase)] [-v(erify)]
read Read flash chip to file. flash read -f {file}
verify Verify flash chip against file. flash verify -f {file}
test Erase and write full chip with dummy data, verify. flash test
-f File flag. File to write, read or verify. flash verify -f {file}
-e Erase flag. Add erase before write. flash write -f {file} -e
-v Verify flag. Add verify after write or erase. flash write -f {file} -v
the flash memory programming command help menu. Usage is very git like:
flash write -f example.bin -e -v
Write file example.bin, erase first, verify erase & write.
This uses the latest command line optional arguments parser that has the ability to scan within the current user input for strings or numbers based on position or -flag.
The new command line optional argument parser appears to be in good shape for now. The previous system was still attached to the Bus Pirate v3 idea that we could only parse user input going forwards.
Previously we controlled the command line read pointer at the base level, any read from the buffer advanced the pointer. It was a one-way street with a mess of handling functions all over the place.
bool cmdln_args_find_flag(char flag, command_var_t *arg);
bool cmdln_args_find_flag_uint32(char flag, command_var_t *arg, uint32_t *value);
bool cmdln_args_find_flag_string(char flag, command_var_t *arg, uint32_t max_len, char *value);
bool cmdln_args_uint32_by_position(uint32_t pos, uint32_t *value);
bool cmdln_args_string_by_position(uint32_t pos, uint32_t max_len, char *str);
The new functions scan over the whole buffer looking for strings, integers, and -flags. Five pretty easy to understand functions extract command line arguments from within mini programs like the flash command.
Still no push. There’s still a TON of cleanup to get everything else in the firmware using these commands, but this is a really big improvement. I’ll try to get it out today.