Update urclock's -x parameters

This commit is contained in:
Stefan Rueger 2022-11-07 18:01:23 +00:00
parent 715db4c690
commit cf3c81f714
No known key found for this signature in database
GPG Key ID: B0B4F1FD86B1EC55
2 changed files with 39 additions and 31 deletions

View File

@ -1152,9 +1152,12 @@ Defaults to 10 if not specified.
.It Ar Urclock
.Bl -tag -offset indent -width indent
.It Ar showall
Show all info for the connected part and exit.
Show all info for the connected part, then exit. The -xshow... options
below can be used to assemble a bespoke response consisting of a subset
(or only one item) of all available relevant information about the
connected part and bootloader.
.It Ar showid
Show a unique Urclock ID stored in either flash or EEPROM of the MCU and exit.
Show a unique Urclock ID stored in either flash or EEPROM of the MCU, then exit.
.It Ar id=<E|F>.<addr>.<len>
Historically, the Urclock ID was a six-byte unique little-endian number
stored in Urclock boards at EEPROM address 257. The location of this
@ -1162,28 +1165,34 @@ number can be set by the -xid=<E|F>.<addr>.<len> extended parameter. E
stands for EEPROM and F stands for flash. A negative address addr counts
from the end of EEPROM and flash, respectively. The length len of the
Urclock ID can be between 1 and 8 bytes.
.It Ar showdate
Show the last-modified date of the input file for the flash application,
then exit. If the input file was stdin, the date will be that of the
programming.
.It Ar showfilename
Show the input filename (or title) of the last flash writing session, then exit.
.It Ar title=<string>
When set, <string> will be used in lieu of the input filename. The maximum
string length for the title/filename field is 254 bytes including
terminating nul.
.It Ar showapp
Show the size of the programmed application and exit.
Show the size of the programmed application, then exit.
.It Ar showstore
Show the size of the unused flash between the application and metadata and exit.
Show the size of the unused flash between the application and metadata, then exit.
.It Ar showmeta
Show the size of the metadata just below the bootloader and exit.
Show the size of the metadata just below the bootloader, then exit.
.It Ar showboot
Show the size of the bootloader and exit.
Show the size of the bootloader, then exit.
.It Ar showversion
Show bootloader version and capabilities, and exit.
Show bootloader version and capabilities, then exit.
.It Ar showvbl
Show the vector number and name of the interrupt table vector used by the
bootloader for starting the application, and exit. For hardware-supported
bootloader for starting the application, then exit. For hardware-supported
bootloaders this will be vector 0 (Reset), and for vector bootloaders this
will be any other vector number of the interrupt vector table or the slot
just behind the vector table with the name VBL_ADDITIONAL_VECTOR.
.It Ar showdate
Show the last-modified date of the input file for the flash application
and exit. If the input file was stdin, the date will be that of the
programming.
.It Ar showfilename
Show the input filename (or title) of the last flash writing session, and exit.
.It Ar showpart
Show the part for which the bootloader was compiled, then exit.
.It Ar bootsize=<size>
Manual override for bootloader size. Urboot bootloaders put the number of used
bootloader pages into a table at the top of flash, so the urclock programmer can
@ -1223,10 +1232,6 @@ not be reached after reset.
.It Ar initstore
On writing to flash fill the store space between the flash application and
the metadata section with 0xff.
.It Ar title=<string>
When set, <string> will be used in lieu of the input filename. The maximum
string length for the title/filename field is 254 bytes including
terminating nul.
.It Ar nofilename
On writing to flash do not store the application input filename (nor a title).
.It Ar nodate

View File

@ -282,14 +282,15 @@ typedef struct {
// Extended parameters for Urclock
int showall, // Show all pieces of info for connected part and exit
showid, // ... Urclock ID
showdate, // ... last-modified date of last uploaded application
showfilename, // ... filename of last uploaded application
showapp, // ... application size
showstore, // ... store size
showmeta, // ... metadata size
showboot, // ... bootloader size
showversion, // ... bootloader version and capabilities
showvbl, // ... vector bootloader level, vector number and name
showdate, // ... last-modified date of last uploaded application
showfilename, // ... filename of last uploaded application
showpart, // ... part for which bootloader was compiled
xbootsize, // Manual override for size of bootloader section
xvectornum, // ... for vector number (implies vbllevel = 1)
xeepromrw, // ... for EEPROM r/w capability
@ -812,14 +813,15 @@ nopatch_nometa:
set++;
if(set && set != vecsz)
Return("input overwrites the reset vector partially rendering vector bootloader moot, exiting");
Return("input overwrites reset vector, which would render the vector bootloader inoperable");
if(set) {
int resetdest;
if(reset2addr(flm->buf, vecsz, flm->size, &resetdest) < 0)
Return("input does not hold an r/jmp at reset vector rendering vector bootloader moot, exiting");
Return("input would overwrite the reset vector making the vector bootloader unreachable");
if(resetdest != ur.blstart)
Return("input file points reset to 0x%04x instead of vector bootloader at 0x%04x, exiting", resetdest, ur.blstart);
Return("input file points reset to 0x%04x instead of vector bootloader at 0x%04x, exiting",
resetdest, ur.blstart);
}
}
return size;
@ -1260,7 +1262,7 @@ vblvecfound:
// Showing properties mostly requires examining the bytes below bootloader for metadata
if(ur.showall || (ur.showid && *ur.iddesc && *ur.iddesc != 'E') || ur.showapp ||
ur.showstore || ur.showmeta || ur.showboot || ur.showversion || ur.showvbl ||
ur.showdate || ur.showfilename) {
ur.showpart || ur.showdate || ur.showfilename) {
if((rc = ur_readEF(pgm, p, spc, ur.blstart-nm, nm, 'F')))
return rc;
@ -1313,7 +1315,8 @@ vblvecfound:
// Print and exit when option show... was given
int first=1;
int single = !ur.showall && (!!ur.showid + !!ur.showapp + !!ur.showstore + !!ur.showmeta +
!!ur.showboot + !!ur.showversion + !!ur.showvbl + !!ur.showdate + !!ur.showfilename) == 1;
!!ur.showboot + !!ur.showversion + !!ur.showvbl + !!ur.showpart + !!ur.showdate +
!!ur.showfilename) == 1;
if(ur.showid || ur.showall) {
uint64_t urclockID;
@ -1339,7 +1342,7 @@ vblvecfound:
int vnum = ur.vbllevel? ur.vblvectornum & 0x7f: 0;
term_out(" vector %d (%s)"+first, vnum, vblvecname(pgm, vnum)), first=0;
}
if(ur.showall)
if(ur.showall || ur.showpart)
term_out(" %s"+first, ur.uP.name);
if(!first) {
term_out("\n");
@ -1907,7 +1910,7 @@ static int urclock_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AV
for(; addr < n; addr += chunk) {
chunk = n-addr < page_size? n-addr: page_size;
if(urclock_paged_rdwr(pgm, p, Cmnd_STK_PROG_PAGE, addr, chunk, mchr, (char *) m->buf+addr) < 0)
if(urclock_paged_rdwr(pgm, p, Cmnd_STK_PROG_PAGE, addr, chunk, mchr, (char *) m->buf+addr)<0)
return -3;
if(urclock_res_check(pgm, __func__, 0, NULL, 0) < 0)
return -4;
@ -1986,14 +1989,16 @@ static int urclock_parseextparms(const PROGRAMMER *pgm, LISTID extparms) {
} options[] = {
{"showall", &ur.showall, 0, NULL, 0, "Show all info for connected part and exit"},
{"showid", &ur.showid, 0, NULL, 0, " ... unique Urclock ID"},
{"showdate", &ur.showdate, 0, NULL, 0, " ... last-modified date of flash application"},
{"showfilename", &ur.showfilename, 0, NULL, 0, " ... filename of last uploaded application"},
{"showapp", &ur.showapp, 0, NULL, 0, " ... application size"},
{"showstore", &ur.showstore, 0, NULL, 0, " ... store size"},
{"showmeta", &ur.showmeta, 0, NULL, 0, " ... metadata size"},
{"showboot", &ur.showboot, 0, NULL, 0, " ... bootloader size"},
{"showversion", &ur.showversion, 0, NULL, 0, " ... bootloader version and capabilities"},
{"showvbl", &ur.showvbl, 0, NULL, 0, " ... vector bootloader level, vec # and name"},
{"showdate", &ur.showdate, 0, NULL, 0, " ... last-modified date of flash application"},
{"showfilename", &ur.showfilename, 0, NULL, 0, " ... filename of last uploaded application"},
{"id", NULL, sizeof ur.iddesc, ur.iddesc, 1, "Location of Urclock ID, eg, F.12345.6"},
{"title", NULL, sizeof ur.title, ur.title, 1, "Title stored and shown in lieu of a filename"},
{"bootsize", &ur.xbootsize, 0, NULL, 1, "Manual override for bootloader size"},
{"vectornum", &ur.xvectornum, 0, NULL, 1, " ... for vector number"}, // implies vbllevel=1
{"eepromrw", &ur.xeepromrw, 0, NULL, 0, " ... for EEPROM read/write capability"},
@ -2005,8 +2010,6 @@ static int urclock_parseextparms(const PROGRAMMER *pgm, LISTID extparms) {
{"nodate", &ur.nodate, 0, NULL, 0, " ... application filename and no date either"},
{"nometadata", &ur.nometadata, 0, NULL, 0, " ... metadata at all (ie, no store support)"},
{"delay", &ur.delay, 0, NULL, 1, "Add delay [ms] after reset, can be negative"},
{"id", NULL, sizeof ur.iddesc, ur.iddesc, 1, "Location of Urclock ID, eg F.12324.6"},
{"title", NULL, sizeof ur.title, ur.title, 1, "Title used in lieu of a filename when set"},
{"help", &help, 0, NULL, 0, "Show this help menu and exit"},
};