Skip to content

Commit b16024d

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents eb5c5d3 + 784e2da commit b16024d

File tree

128 files changed

+21313
-26022
lines changed

Some content is hidden

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

128 files changed

+21313
-26022
lines changed

β€ŽCHANGELOG.mdβ€Ž

Lines changed: 262 additions & 204 deletions
Large diffs are not rendered by default.

β€ŽFilesAndFolders.mdβ€Ž

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,45 @@
22

33
| name | content |
44
|---------------------------------|--------------------------------------------------|
5+
| [./_test](./_test) | automatic target code tests |
6+
| `.code_snippets/` | unused code |
7+
| `.github/` | |
8+
| `.idea/` | GoLand settings |
9+
| `.vscode/` | vsCode settings |
10+
| [./cmd/cui](./_cmd/_cui) | (do not use) command user interface tryout code |
11+
| [./cmd/_stim](./cmd/_stim) | (do not use) target stimulation tool tryout code |
12+
| [./cmd/trice](./cmd/trice) | `trice` tool command Go sources |
13+
| [./docs](./docs) | documentation |
14+
| [./examples](./examples) | example target projects |
15+
| `./examples/*_inst/temp/` | project binary logfiles |
16+
| [./internal](./internal) | `trice` tool internal Go packages |
17+
| [./pkg](./pkg) | `trice` tool common Go packages |
18+
| [./src/](./src) | C sources for trice instrumentation |
19+
| `super-linter.report/` | |
20+
| [./third_party](./third_party) | external components |
21+
| `_config.yml` | unused |
522
| `.clang-format` | See below |
623
| `.clang-format-ignore` | See below |
724
| `.editorconfig` | See below |
8-
| `.code_snippets/` | |
925
| `.git/` | version control data base |
10-
| `.github/` | |
1126
| `.gitattributes` | See below |
1227
| `.gitignore` | |
13-
| `.goreleaser.yml` | |
14-
| `.idea/` | GoLand |
28+
| `.goreleaser.yml` | goreleaser configuration |
1529
| `.travis.yml` | |
16-
| `.vscode/` | |
17-
| `AUTHORS.md` | |
30+
| `AUTHORS.md` | contributors |
1831
| `CHANGELOG.md` | |
1932
| `CODE_OF_CONDUCT.md` | |
2033
| `CONTRIBUTING.md` | |
21-
| `FoldersAndFiles.md` | this file |
34+
| `FilesAndFolders.md` | this file |
35+
| `go.mod` | |
36+
| `go.sum` | |
2237
| `GoInfos.txt` | |
2338
| `LICENSE.md` | |
2439
| `README.md` | |
25-
| `_config.yml` | |
26-
| `branchesInfo.md` | |
27-
| `cmd/` | |
40+
| | |
2841
| `coverage.out` | |
2942
| `dist/` | created by goreleaser |
30-
| `docs/` | |
31-
| `examples/` | real projects |
3243
| `fmtcoverage.html` | |
33-
| `go.mod` | |
34-
| `go.sum` | |
35-
| `internal/` | trice Go packages for internal usage only |
36-
| `pkg/` | trice Go packages usagable externally |
37-
| `src/` | trice target sources |
38-
| `super-linter.report/` | |
39-
| `temp/` | project binary logfiles |
40-
| `third_party/` | tools |
41-
| [./cmd/cui](../cmd/cui) | (do not use) command user interface tryout code |
42-
| [./cmd/stim](../cmd/stim) | (do not use) target stimulation tool tryout code |
43-
| [./cmd/trice](../cmd/trice) | `trice` tool command Go sources |
44-
| [./docs](./docs) | documentation |
45-
| [./examples](../examples) | example target projects |
46-
| [./internal](../internal) | `trice` tool internal Go packages |
47-
| [./pkg](../pkg) | `trice` tool common Go packages |
48-
| [./src/](../src) | C sources for trice instrumentation |
49-
| [./test](../test) | automatic target code tests |
50-
| [./third_party](../third_party) | external components |
5144

5245
## `.clang-format`
5346

β€ŽREADME.mdβ€Ž

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ![TriceGirlS.png](./docs/ref/TriceGirl-167x222.png) **Trice** <- **TR**~~ace~~ **I**~~ds~~ **C** **E**~~mbedded~~
1+
# ![TriceGirlS.png](./docs/ref/TriceGirl-167x222.png) $${\color{red}Trice}$$ <- $${\color{red}TR}$$~~ace~~ $${\color{red}I}$$~~d's~~ $${\color{red}C}$$ $${\color{red}E}$$~~mbedded~~
22

33
[github.io/trice/](https://rokath.github.io/trice/)
44

@@ -68,7 +68,7 @@ Start `trice ds` inside a console, option: [third_party/alacritty](./third_party
6868
- [https://interrupt.memfault.com/blog/trice](https://interrupt.memfault.com/blog/trice)
6969
- [Trice User Guide](./docs/TriceUserGuide.md)
7070
- Check the [docs](./docs) folder. No need to read all this stuff - it is just for help and reference.
71-
- Check issues and discussions including the closed items.
71+
- Check [issues](https://github.com/rokath/trice/issues) and [discussions](https://github.com/rokath/trice/discussions) including the closed items.
7272

7373
## Debugging using VS-Code and Clang for a Trice-instrumented Project in Direct-Out Mode over SEGGER-RTT
7474

@@ -94,6 +94,19 @@ The Trice cache keeps copies of all to `trice i` or `trice c` passed files after
9494
9595
For example an auto-formatter should get active **before** the `tice insert` command.
9696

97+
## Wich mode to use?
98+
99+
- For the development direct mode with SEGGER_RTT is recommended.
100+
- Most use cases are coverable in deferred mode with TRICE_BUFFER == TRICE_RING_BUFFER (less RAM needs) in TRICE_MULTI_PACK_MODE (less transfer data).
101+
102+
## Project Status
103+
104+
Trice is full usable and there are no known bugs (see [issues](https://github.com/rokath/trice/issues)).
105+
106+
## Future
107+
108+
The documentation could get improved, for example by adding a quick start help. Additional features like remote procedure calls could be described and a separate tlog, maybe written in C, would allow logging on any platforms - not only **Go** supported ones.
109+
97110
## Support?
98111

99112
Yes please - or simply :star: it. ☺

β€Ž_test/ReadMe.mdβ€Ž

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
## General info
44

5-
This folder is per default renamed into `_test` to avoid vsCode slow down.
5+
This folder is per default named to `_test` to avoid vsCode slow down.
66

77
The main aim of these tests is to automatic compile and run the target code in different compiler switch variants avoiding manual testing this way.
88

99
For the user it could be helpful to start with a `triceConfig.h`file from here and to adapt the Trice tool command line from the matching `cgo_test.go` if no close match in the `examples` folder was found.
1010

1111
## How to run the tests
1212

13-
- In `trice` folder first execute `go clean -cache`. Cleaning the **Go** cache is recommended, because the CGO tests somehow keep pre-compiled files and when editing C-files, this can led to confusing results.
14-
- To run the tests `cd` into `_test` and execute `go test ./...`.
13+
- In `_trice` folder first execute `go clean -cache`. Cleaning the **Go** cache is recommended, because the CGO tests keep pre-compiled files and when editing C-files, this can led to confusing results.
14+
- To run the tests `cd` into `_test` and execute `go test ./...` fom there.
1515

1616
## Tests Details
1717

@@ -27,7 +27,7 @@ To be able to run `go test ./...` successfully without running the [./updateTest
2727

2828
The folders `tf` are Go packages just for tests. They all have the same package name `cgot` and are not included into the trice tool. The different `cgot` packages are independent and could have any names. They do not see each other and are used for target code testing independently.
2929

30-
The `tf/triceConfig.h` files differ and correspondent to the `tf/cgo_test.go` files in the same folder. On test execution, the `./testdata/*.c` files are compiled into the trice test executable together with the trice sources `../src` using the `tf/triceConfig.h` file.
30+
The `tf/triceConfig.h` files differ and correspondent to the `tf/cgo_test.go` files in the same folder. On test execution, the `./testdata/*.c` files are compiled into the trice test executable together with the trice sources `../src` using the `tf/triceConfig.h` file.
3131

3232
The individual tests collect the expected results (`//exp: result`) together with the line numbers into a slice to execute the test loop on it. The `triceLogTest` function gets the `triceLog` function as parameter.
3333

@@ -46,7 +46,7 @@ The `testdata\cgoPackage.go` file contains a variable `testLines = n`, which lim
4646

4747
## Test Internals
4848

49-
The `./trice/_test/testdata/*.c` and `./trice/src/*.c` are compiled together with the actual cgot package into one singe Trice test binary, resulting in as many test binaries as there are test folders. Calling its TestFunction(s) causes the activation of the Trice statement(s) inside *triceCheck.c*. The ususally into an embedded device compiled Trice code generates a few bytes according to the configuration into a buffer. These bytes are transmitted usually in real life over a (serial) port or RTT. In the tests here, this buffer is then read out by the Trice tool handler function according to the used CLI switches and processed to a log string using the *til.json* file. This string in then compared to the expected string for the activated line.
49+
The `./trice/_test/testdata/*.c` and `./trice/src/*.c` are compiled together with the actual cgot package into one singe Trice test binary, resulting in as many test binaries as there are test folders. Calling its TestFunction(s) causes the activation of the Trice statement(s) inside *triceCheck.c*. The ususally into an embedded device compiled Trice code generates a few bytes according to the configuration into a buffer. These bytes are transmitted usually in real life over a (serial) port or RTT. In the tests here, this buffer is then read out by the Trice tool handler function according to the used CLI switches and processed to a log string using the *til.json* file. This string is then compared to the expected string for the activated line.
5050

5151
Each `tf` is a **Go** package, which is not part of any **Go** application. They all named `cgot` and are only used independently for testing different configurations. The `tf/generated_cgoPackage.go` file is identical in all `tf`. Its master is `testdata/cgoPackage.go`. After editing the master, running the command `./updateTestData.sh` copies the master to all `tf` and renames it to `generated_cgoPackage.go`.
5252

@@ -57,7 +57,7 @@ When running `go test ./tf`, a Trice tool test executable is build, using the Tr
5757
During the test, the file `triceCheck.c` is scanned for lines like
5858

5959
```C
60-
reak; case __LINE__: TRice( iD(3537), "info:This is a message without values and a 32-bit stamp.\n" ); //exp: time: 842,150_450default: info:This is a message without values and a 32-bit stamp.
60+
break; case __LINE__: TRice( iD(3537), "info:This is a message without values and a 32-bit stamp.\n" ); //exp: time: 842,150_450default: info:This is a message without values and a 32-bit stamp.
6161
```
6262

6363
Some C-code lines contain Trice statements and comments starting with `//exp: ` followed by the expected Trice tool output for that specific line. The **Go** testfunction collects these outputs in a slice together with the line numbers. Then for each found line number the execution of the **Go** function `func triceCheck(n int)` takes part, which in turn calls the CGO compiled C-function `TriceCheck(n)`. The now activated Trice C-code writes the generated trice bytes in a between **C** and **Go** shared buffer using the C-function `TriceWriteDeviceCgo`. After returning from the **Go** function `func triceCheck(n int)` and optionally calling `TriceTransfer` in deferred mode the Trice tool `triceLog()` function converts the Trice buffer bytes to the log string and compares the result with the expected data. The between **Go** and **C** shared buffer limits the executed Trices per line to one, because they use the same buffer from the beginning. This could be done better with an increment to allow several trices in one single line.

β€Ž_test/_ringB_protect_de_tcobs_ua/TargetActivity.cβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
// Needed safety space is TRICE_DATA_OFFSET + (2*TRICE_SINGLE_MAX_SIZE)-4) = 208
55
// TRICE_DEFERRED_BUFFER_SIZE == 324
66
char* TargetActivity(void) { // -4 bytes TRICE_DATA_OFFSET = 320 bytes space
7-
TRice(iD(16204), "Hello "); // -8 bytes = 312 bytes space
8-
TRice(iD(16205), "World!\n"); // -8 bytes = 304 bytes space
9-
TRice64(iD(16206), "msg:Twelve 64-bit values: %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n", -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12); // -104 bytes = 200 bytes space
7+
TRice(iD(16200), "Hello "); // -8 bytes = 312 bytes space
8+
TRice(iD(16201), "World!\n"); // -8 bytes = 304 bytes space
9+
TRice64(iD(16202), "msg:Twelve 64-bit values: %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n", -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12); // -104 bytes = 200 bytes space
1010
// so the next Trice does not fit
11-
trice(iD(16207), "Hello again\n"); // -4 bytes -> no fit!
11+
trice(iD(16203), "Hello again\n"); // -4 bytes -> no fit!
1212
return "feed3322 Hello World!\nfeed3322 Twelve 64-bit values: -1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12";
1313
}

β€Ž_test/be_dblB_de_tcobs_ua/triceConfig.hβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
extern "C" {
1010
#endif
1111

12+
#define TRICE_BUFFER TRICE_DOUBLE_BUFFER
13+
1214
#define TRICE_TRANSFER_ORDER_IS_BIG_ENDIAN 1
1315

1416
#define TRICE_DEFERRED_OUTPUT 1

β€Ž_test/dblB_de_cobs_ua/triceConfig.hβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
extern "C" {
1010
#endif
1111

12+
#define TRICE_BUFFER TRICE_DOUBLE_BUFFER
13+
1214
#define TRICE_DEFERRED_OUTPUT 1
1315
#define TRICE_DEFERRED_OUT_FRAMING TRICE_FRAMING_COBS
1416
#define TRICE_DEFERRED_UARTA 1

β€Ž_test/dblB_de_multi_cobs_ua/triceConfig.hβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
extern "C" {
1010
#endif
1111

12+
#define TRICE_BUFFER TRICE_DOUBLE_BUFFER
13+
1214
#define TRICE_DEFERRED_TRANSFER_MODE TRICE_MULTI_PACK_MODE
1315
#define TRICE_DEFERRED_OUTPUT 1
1416
#define TRICE_DEFERRED_OUT_FRAMING TRICE_FRAMING_COBS

β€Ž_test/dblB_de_multi_nopf_ua/triceConfig.hβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
extern "C" {
1010
#endif
1111

12+
#define TRICE_BUFFER TRICE_DOUBLE_BUFFER
13+
1214
#define TRICE_CONFIG_WARNINGS 0
1315

1416
#define TRICE_DEFERRED_TRANSFER_MODE TRICE_MULTI_PACK_MODE

β€Ž_test/dblB_de_multi_tcobs_ua/triceConfig.hβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
extern "C" {
1010
#endif
1111

12+
#define TRICE_BUFFER TRICE_DOUBLE_BUFFER
13+
1214
#define TRICE_DEFERRED_TRANSFER_MODE TRICE_MULTI_PACK_MODE
1315
#define TRICE_DEFERRED_OUTPUT 1
1416
#define TRICE_DEFERRED_UARTA 1

0 commit comments

Comments
Β (0)