riscv-openocd
riscv-openocd copied to clipboard
Functions csr_read_progbuf() et al. should exit early if there is no program buffer
These functions currently do not exit early if program the program buffer in the target is insufficient:
-
csr_read_progbuf() -
fpr_read_progbuf() -
csr_write_progbuf() -
fpr_write_progbuf()
Because of that, riscv_program_insert() is attempted and extra error messages get displayed which may be confusing to the user:
Error: [target_name] Unable to insert program into progbuf, capacity would be exceeded (progbufsize=0).
Steps to reproduce:
- Use a target with progbufsize == 0
- Make an attempt to access a non-existent CSR (this also happens out of the box during the examination - for example the read of VLENB CSR on targets that do not implement the vector extension).
Fix this by exiting early from the above functions if the program buffer is not large enough. Use function has_sufficient_progbuf().