shithub: stm32up

Download patch

ref: 17d88daa0060c7f7f2133a9364ce63e982f63671
parent: 4ec6177689f8274f645ba24e9b8a52883c405608
author: kitzman <kitzman@disroot.org>
date: Tue Dec 12 12:01:12 EST 2023

man page; updated LICENSE

--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) <year> <copyright holders>
+Copyright (c) <2023> <kitzman @ disroot.org>
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 
--- a/mkfile
+++ b/mkfile
@@ -1,5 +1,6 @@
 </$objtype/mkfile
 BIN=/$objtype/bin
+MAN=/sys/man/1
 
 TARG=stm32up
 OFILES=\
@@ -12,3 +13,5 @@
 	${TARG:%=/386/bin/%}\
 
 </sys/src/cmd/mkone
+
+install: stm32up.man
--- a/stm32up.c
+++ b/stm32up.c
@@ -476,14 +476,6 @@
 usage(void)
 {
 	fprint(2, "usage: %s [-d] [-D device] [-b baud] command args ..\n", argv0);
-	fprint(2, "	info\n");
-	fprint(2, "	read 	addr size\n");
-	fprint(2, "	write 	addr size\n");
-	fprint(2, "	erase	page n\n");
-	fprint(2, "	flash	addr size\n");
-	fprint(2, "	go		addr\n");
-	fprint(2, "	readp, readunp, writeunp\n");
-	fprint(2, "	TODO: writep,csum\n");
 	exits("usage");
 }
 
--- /dev/null
+++ b/stm32up.man
@@ -1,0 +1,77 @@
+.TH STM32UP 1
+.SH NAME
+stm32up \- stm32 UART flashing utility
+.SH SYNOPSIS
+.B stm32up
+[
+.B -d
+]
+[
+.B -D
+.I device
+]
+[
+.B -b
+.I baud
+]
+.I command ...
+.SH DESCRIPTION
+Stm32up uses the UART protocol of the STM32 processors,
+to perform commands on the chip.
+.PP
+The
+.B -D
+argument sets the serial device path, which defaults
+to
+.B /dev/eia0 .
+The
+.B -b
+argument sets the serial line's baud rate, which otherwise is 9600.
+Verbose output is obtained by specifying the
+.B -d
+flag. The tool sets the line according to the protocol, to have
+8 data bits, an even parity bit, and a stop bit.
+.SH COMMANDS
+.TF info
+.TP
+.BI info
+Prints information about the available commands on the device.
+.TP
+.BI read " addr size"
+Reads
+.I size
+amount of bytes, starting from
+.I addr .
+The data is written to stdout.
+.TP
+.BI write " addr size"
+Write
+.I size
+amount of bytes, starting from
+.I addr .
+The data is read from stdin.
+.TP
+.BI erase " n addr"
+Erases
+.I n
+pages starting with
+.I page .
+.TP
+.BI go " addr"
+The devices exits the reset state and goes to
+.I addr .
+.TP
+.BI flash " addr size"
+Erases all 256 pages, writes the data, then issues a
+.B go
+command to
+.I addr .
+.TP
+.B "readp, readunp, writeunp"
+Protects against reads, unprotects against reads or writes.
+.SH SEE ALSO
+AN3155
+.br
+AN2606
+.SH BUGS
+Most certainly.