Skip to content

Commit a024079

Browse files
committed
code linted & typos fixed
1 parent 3f1b420 commit a024079

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+679
-351
lines changed

.idea/inspectionProfiles/Project_Default.xml

+338
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

+18-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
# Changelog
2-
date | version | comment
3-
----------|--------:|----------------
4-
2020-02-11| 0.1 | initial version
5-
2020-02-14| 0.2 | SHORT_MEMORY switch added
6-
2020-02-18| 0.3 | C macros renamed into TRICE
7-
2020-02-20| 0.4 | trice printf() adapter added
8-
2020-02-22| 0.5 | support for auto param count
9-
2020-03-01| 0.6 | encryption support, TRICE64_2 added
10-
2020-03-12| 0.7 | `trice u -src dir1 -src file -src dir2` any now possible, -ts added, effective runtime strings
11-
2020-03-29| 0.8 | auto-logfile, remoteDisplay added, check issues!
12-
2020-04-07| 0.8.2 | display server supports many receiver-clients, no line mixes, code partially restructured, line prefix
13-
2020-04-22| 0.9 | fileWatcher added (no need to re-load til.json anymore), now `trice s` possible for COMport scan, NUCLEO-F070 demo project added, now with ANSI color (faster), default log filename with timestamp, remote displayServer shutdown possible
14-
2020-05-12| 0.9.1 | `SeggerRTT` & `SeggerRTTD` added, docs extended, more test examples, TRICE16_1 critical section bugfix
15-
2020-06-29| 0.9.2 | CLI slightly changed (no more 'r'), doc extended, added: Tests, Examples, JLINK, RND, SIM, FILE, TRICE_SYNC, TRICE_VARIANT, TRICE_ASSERT, now no semi-colon after TRICE* is tolerated (macros), several TRICE* in one code line are now ok
2+
3+
| date | version | comment |
4+
|-------------|--------:|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
5+
| 2020-02-11 | 0.1 | initial version |
6+
| 2020-02-14 | 0.2 | SHORT_MEMORY switch added |
7+
| 2020-02-18 | 0.3 | C macros renamed into TRICE |
8+
| 2020-02-20 | 0.4 | trice printf() adapter added |
9+
| 2020-02-22 | 0.5 | support for auto param count |
10+
| 2020-03-01 | 0.6 | encryption support, TRICE64_2 added |
11+
| 2020-03-12 | 0.7 | `trice u -src dir1 -src file -src dir2` any now possible, -ts added, effective runtime strings |
12+
| 2020-03-29 | 0.8 | auto-logfile, remoteDisplay added, check issues! |
13+
| 2020-04-07 | 0.8.2 | display server supports many receiver-clients, no line mixes, code partially restructured, line prefix |
14+
| 2020-04-22 | 0.9 | fileWatcher added (no need to re-load til.json anymore), now `trice s` possible for COMport scan, NUCLEO-F070 demo project added, now with ANSI color (faster), default log filename with timestamp, remote displayServer shutdown possible |
15+
| 2020-05-12 | 0.9.1 | `SeggerRTT` & `SeggerRTTD` added, docs extended, more test examples, TRICE16_1 critical section bugfix |
16+
| 2020-06-29 | 0.9.2 | CLI slightly changed (no more 'r'), doc extended, added: Tests, Examples, JLINK, RND, SIM, FILE, TRICE_SYNC, TRICE_VARIANT, TRICE_ASSERT, now no semi-colon after TRICE* is tolerated (macros), several TRICE* in one code line are now ok |
17+
| ... | | |
18+
| 2022-FEB-11 | 0.48.0 | FILE & TCP4 input ports added |
19+
1620

1721

GoInfos.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

3-
// github.com/onsi/ginko behavioral tests
3+
// github.com/onsi/ginkgo behavioral tests
44
// goconvey.co view test results in browser based display
55
// code.google.com/p/gomock
66
// go test -coverprofile cover.out

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ This slightly simplified [view](https://github.com/jgraph/drawio) is explained [
5050

5151
## Data Transfer
5252

53-
- Inplemented:
53+
- Implemented:
5454
- [UART](https://en.wikipedia.org/wiki/Universal_asynchronous_receiver-transmitter) connectable to virtual UART over USB
5555
- [RTT](https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer/) over [J-Link](./third_party/segger.com/ReadMe.md) and [RTT over ST-Link](./third_party/goST/ReadMe.md)
56-
- A small separate micro-controller is always usable as interfaces bridge to [GPIO](https://circuitcellar.com/cc-blog/a-trace-tool-for-embedded-systems/), [I²C](https://en.wikipedia.org/wiki/I%C2%B2C), [SPI](https://en.wikipedia.org/wiki/Serial_Peripheral_Interface), [CAN](https://en.wikipedia.org/wiki/CAN_bus), [LIN](https://en.wikipedia.org/wiki/Local_Interconnect_Network), ...
56+
- A small separate microcontroller is always usable as interfaces bridge to [GPIO](https://circuitcellar.com/cc-blog/a-trace-tool-for-embedded-systems/), [I²C](https://en.wikipedia.org/wiki/I%C2%B2C), [SPI](https://en.wikipedia.org/wiki/Serial_Peripheral_Interface), [CAN](https://en.wikipedia.org/wiki/CAN_bus), [LIN](https://en.wikipedia.org/wiki/Local_Interconnect_Network), ...
5757

5858
## Display server option
5959

docs/TriceMessagesEncoding.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
* Several *Trice* message can occur within one single **COBS** package.
2727
* Each **COBS** package starts with a 32-bit descriptor:
2828

29-
| Descriptor | Meaning |
30-
|---------------- |----------------------------------------------------- |
31-
| `0x00000000` | *Trice* message(s) without prefix |
32-
| `0x00000001` | *Trice* message(s) with 32-bit target timestamp |
33-
| `0x00000002` | *Trice* message(s) with 32-bit target location |
34-
| `0x00000003` | *Trice* message(s) with 64-bit target timestamp and location |
35-
| `0x00000004`...`0x000000FF` | Reserved for *Trice* encodings |
36-
| `0x00000100`...`0xFFFFFFFF` | User protocol data, the **trice** tool ignores them |
29+
| Descriptor | Meaning |
30+
|-----------------------------|--------------------------------------------------------------|
31+
| `0x00000000` | *Trice* message(s) without prefix |
32+
| `0x00000001` | *Trice* message(s) with 32-bit target timestamp |
33+
| `0x00000002` | *Trice* message(s) with 32-bit target location |
34+
| `0x00000003` | *Trice* message(s) with 64-bit target timestamp and location |
35+
| `0x00000004`...`0x000000FF` | Reserved for *Trice* encodings |
36+
| `0x00000100`...`0xFFFFFFFF` | User protocol data, the **trice** tool ignores them |
3737

3838
* This allows intermixing of several data streams with *Trice* data.
3939
* After the 4 COBS package descriptor bytes start several full *Trice* messages.

docs/TriceObsoleteEncodings.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,9 @@ The `esc` encoding uses an escape character for syncing after some data loss. It
490490

491491
An `esc` trice transfer packet consists of an 4-byte header followed by an optional payload.
492492

493-
| Start Byte | Second Byte | Third Byte | Fourth Byte
494-
|--------------------|-------------------|--------------|--------------
495-
| Escape char `EC` | Length Code `LC` | triceID `IH` | triceID `IL`
493+
| Start Byte | Second Byte | Third Byte | Fourth Byte |
494+
|:----------------:|------------------|--------------|--------------|
495+
| Escape char `EC` | Length Code `LC` | triceID `IH` | triceID `IL` |
496496

497497
### 7.1. <a name='StartbyteEC'></a>Start byte `EC`
498498

docs/TriceSpace.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727

2828
The following numbers are measured with a legacy encoding, showing that the instrumentation code can be even smaller.
2929

30-
Program Size (STM32-F030R8 demo project) |trice instrumentation|buffer size|compiler optimize for time| comment
31-
---------------------------------------------|------------------------|-----------|-------------------------|-----------------------------
32-
Code=1592 RO-data=236 RW-data= 4 ZI-data=1028| none | 0 | off | CubeMX generated, no trice
33-
Code=1712 RO-data=240 RW-data=24 ZI-data=1088| core | 64 | off | core added without trices
34-
Code=3208 RO-data=240 RW-data=36 ZI-data=1540| TriceCheckSet() | 512 | off | TRICE_SHORT_MEMORY is 1 (small)
35-
Code=3808 RO-data=240 RW-data=36 ZI-data=1540| TriceCheckSet() | 512 | on | TRICE_SHORT_MEMORY is 0 (fast)
30+
| Program Size (STM32-F030R8 demo project) | trice instrumentation | buffer size | compiler optimize for time | comment |
31+
|-----------------------------------------------|-----------------------|-------------|----------------------------|---------------------------------|
32+
| Code=1592 RO-data=236 RW-data= 4 ZI-data=1028 | none | 0 | off | CubeMX generated, no trice |
33+
| Code=1712 RO-data=240 RW-data=24 ZI-data=1088 | core | 64 | off | core added without trices |
34+
| Code=3208 RO-data=240 RW-data=36 ZI-data=1540 | TriceCheckSet() | 512 | off | TRICE_SHORT_MEMORY is 1 (small) |
35+
| Code=3808 RO-data=240 RW-data=36 ZI-data=1540 | TriceCheckSet() | 512 | on | TRICE_SHORT_MEMORY is 0 (fast) |
3636

3737
* The core instrumentation needs less 150 bytes FLASH and about 100 bytes RAM when buffer size is 64 bytes.
3838
* The about 50 trices in TriceCheckSet() allocate roughly 2100 (fast mode) or 1500 (small mode) bytes.

docs/TriceUserGuide.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@
3636

3737
## 1. <a name='Projectstructure'></a>Project structure
3838

39-
name | info |
40-
---------------|---------------------------------------------------------|
41-
cmd/trice | `trice` tool command Go sources |
42-
cmd/cui | (do not use) command user interface tryout code |
43-
docs/ | documentation |
44-
internal/ | `trice` tool internal Go packages |
45-
pkg/ | `trice` tool common Go packages |
46-
pkg/src/ | C sources for trice instrumentation |
47-
test/ | example target projects |
48-
third_party/ | external components |
39+
| name | info |
40+
|--------------|-------------------------------------------------|
41+
| cmd/trice | `trice` tool command Go sources |
42+
| cmd/cui | (do not use) command user interface tryout code |
43+
| docs/ | documentation |
44+
| internal/ | `trice` tool internal Go packages |
45+
| pkg/ | `trice` tool common Go packages |
46+
| pkg/src/ | C sources for trice instrumentation |
47+
| test/ | example target projects |
48+
| third_party/ | external components |
4949

5050
## 2. <a name='Getstarted'></a>Get started
5151

internal/args/handler.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func Handler(w io.Writer, args []string) error {
3131

3232
if Date == "" { // goreleaser will set Date, otherwise use file info.
3333
fi, err := os.Stat(os.Args[0])
34-
if nil == err { // On running main tests fileinfo is invalid, so do not use in that case.
34+
if nil == err { // On running main tests file-info is invalid, so do not use in that case.
3535
Date = fi.ModTime().String()
3636
}
3737
}
@@ -110,7 +110,7 @@ func logLoop(w io.Writer) {
110110
if emitter.TimestampFormat == "LOCmicro" {
111111
emitter.TimestampFormat = "off"
112112
}
113-
if DefaultPrefix == emitter.Prefix {
113+
if defaultPrefix == emitter.Prefix {
114114
emitter.Prefix = " }, `"
115115
}
116116
if emitter.Suffix == "" {

internal/args/helpinfo.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2020 Thomas.Hoehenleitner [at] seerose.net
22
// Use of this source code is governed by a license that can be found in the LICENSE file.
33

4-
// Package args implemets the commandline interface and calls the appropriate commands.
4+
// Package args implements the commandline interface and calls the appropriate commands.
55
package args
66

77
import (
@@ -12,7 +12,7 @@ import (
1212
"github.com/rokath/trice/pkg/msg"
1313
)
1414

15-
// scHelp is sub-command help. It prits usage to stdout.
15+
// scHelp is sub-command help. It prints usage to stdout.
1616
func scHelp(w io.Writer) error {
1717
if verbose {
1818
fmt.Fprintf(w, "\n*** https://github.com/rokath/trice ***\n\n")

internal/args/init.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/rokath/trice/pkg/cipher"
1717
)
1818

19-
const DefaultPrefix = "source: "
19+
const defaultPrefix = "source: "
2020

2121
var (
2222
colorInfo = `The format strings can start with a lower or upper case channel information.
@@ -73,13 +73,13 @@ func helpInit() {
7373

7474
func logInit() {
7575
fsScLog = flag.NewFlagSet("log", flag.ExitOnError) // sub-command
76-
fsScLog.StringVar(&decoder.Encoding, "encoding", "COBS", `The trice transmit data format type, options: '(CHAR|COBS|DUMP|ESC|FLEX)'. Target device encoding must match.
76+
fsScLog.StringVar(&decoder.Encoding, "encoding", "COBS", `The trice transmit data format type, options: '(CHAR|COBS|dumpDec|ESC|FLEX)'. Target device encoding must match.
7777
CHAR prints the received bytes as characters.
7878
COBS expects 0 delimited byte sequences.
79-
DUMP prints the received bytes as hex code (see switch -dc too).
79+
dumpDec prints the received bytes as hex code (see switch -dc too).
8080
`) // flag
8181
fsScLog.StringVar(&decoder.Encoding, "e", "COBS", "Short for -encoding.") // short flag
82-
fsScLog.IntVar(&decoder.DumpLineByteCount, "dc", 32, `Dumped bytes per line when "-encoding DUMP"`)
82+
fsScLog.IntVar(&decoder.DumpLineByteCount, "dc", 32, `Dumped bytes per line when "-encoding dumpDec"`)
8383
fsScLog.StringVar(&cipher.Password, "password", "", `The decrypt passphrase. If you change this value you need to compile the target with the appropriate key (see -showKeys).
8484
Encryption is recommended if you deliver firmware to customers and want protect the trice log output. This does work right now only with flex and flexL format.`) // flag
8585
fsScLog.StringVar(&cipher.Password, "pw", "", "Short for -password.") // short flag
@@ -103,10 +103,10 @@ If you need target timestamps you need to get the time inside the target and sen
103103
fsScLog.BoolVar(&decoder.DebugOut, "debug", false, "Show additional debug information")
104104
fsScLog.StringVar(&decoder.TargetEndianness, "targetEndianess", "littleEndian", `Target endianness trice data stream. Option: "bigEndian".`)
105105
fsScLog.StringVar(&emitter.ColorPalette, "color", "default", colorInfo) // flag
106-
fsScLog.StringVar(&emitter.Prefix, "prefix", DefaultPrefix, "Line prefix, options: any string or 'off|none' or 'source:' followed by 0-12 spaces, 'source:' will be replaced by source value e.g., 'COM17:'.") // flag
106+
fsScLog.StringVar(&emitter.Prefix, "prefix", defaultPrefix, "Line prefix, options: any string or 'off|none' or 'source:' followed by 0-12 spaces, 'source:' will be replaced by source value e.g., 'COM17:'.") // flag
107107
fsScLog.StringVar(&emitter.Suffix, "suffix", "", "Append suffix to all lines, options: any string.") // flag
108108

109-
info := `receiver device: 'BUFFER|DUMP|FILE|JLINK|STLINK|TCP4|serial name.
109+
info := `receiver device: 'BUFFER|dumpDec|FILE|JLINK|STLINK|TCP4|serial name.
110110
The serial name is like 'COM12' for Windows or a Linux name like '/dev/tty/usb12'.
111111
Using a virtual serial COM port on the PC over a FTDI USB adapter is a most likely variant.
112112
`
@@ -122,7 +122,7 @@ It is the only setup parameter. The other values default to 8N1 (8 data bits, no
122122

123123
argsInfo := fmt.Sprint(`Use to pass port specific parameters. The "default" value depends on the used port:
124124
port "BUFFER": default="`, receiver.DefaultBUFFERArgs, `", Option for args is any comma separated byte sequence.
125-
port "DUMP": default="`, receiver.DefaultDumpArgs, `", Option for args is any space separated byte sequence.
125+
port "dumpDec": default="`, receiver.DefaultDumpArgs, `", Option for args is any space separated byte sequence.
126126
port "COMn": default="`, receiver.DefaultCOMArgs, `", use "TARM" for a different driver. (For baud rate settings see -baud.)
127127
port "FILE": default="`, receiver.DefaultFileArgs, `", Option for args is any file name.
128128
port "J-LINK": default="`, receiver.DefaultLinkArgs, `", `, linkArgsInfo, `

internal/args/short_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
func TestMain(m *testing.M) {
1818
id.FnJSON = getTemporaryFileName("til-*.JSON")
1919
code := m.Run()
20-
os.Remove(id.FnJSON) // // os.Exit() does not respect defer statements
21-
os.Exit(code)
20+
msg.OnErr(os.Remove(id.FnJSON))
21+
os.Exit(code) // os.Exit() does not respect defer statements
2222
}
2323

2424
func getTemporaryFileName(pattern string) string {

0 commit comments

Comments
 (0)