Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid use of Trice0 will misbehave trice insert #465

Open
KammutierSpule opened this issue May 16, 2024 · 6 comments
Open

invalid use of Trice0 will misbehave trice insert #465

KammutierSpule opened this issue May 16, 2024 · 6 comments
Labels
wontfix This will not be worked on

Comments

@KammutierSpule
Copy link

KammutierSpule commented May 16, 2024

Trice0( variable ); // invalid use
Trice0( "text %u", variable ); // invalid use

Will cause that the next Trices will be ignored or not updated.
(also if Trice0 are // commented)

See also: #464

@rokath
Copy link
Owner

rokath commented May 16, 2024

Am I understand you right, that the first line causes the trice tool not to insert further IDs in that file? That's indeed an issue. Unfortunately I am not a parser expert and the trice tool is somehow limited.

There is probably no quick fix right now. See also comment in https://github.com/rokath/trice/blob/master/internal/id/insertIDs.go near line 280.

@KammutierSpule
Copy link
Author

also, it happens with clean too.
If there is an invalid use of Trice0, trice clean will not be able to clean next ids on the file

@rokath
Copy link
Owner

rokath commented May 16, 2024

Yes, it is the same parser. I am going to add a chapter about that to https://github.com/rokath/trice/blob/master/docs/TriceUserGuide.md#9-additional-hints.

@rokath
Copy link
Owner

rokath commented May 19, 2024

@rokath rokath added the wontfix This will not be worked on label Jun 3, 2024
@rokath
Copy link
Owner

rokath commented Nov 13, 2024

The following sequence inside trice/examples/OpenCM3_STM32F411_Nucleo/main.c

                // Depending on mode, either print this string to
		// UART (mode 0), or the Trice write buffer (mode 200).
		TRICE( Id( 4030),"Hello, TRICE, %d\n", 42);

		// TRICE() with a string parameter only is problematic.
		// See discussion on https://github.com/rokath/trice/issues/279
		// TRICE0() works in either case
		#ifdef __STRICT_ANSI__
		// if compiled with e.g. --std=c99
		TRICE0( Id( 4683),"Hello, TRICE\n");
		#else
		TRICE( Id( 2926),"Hello, TRICE\n");
		TRICE0( Id( 7263),"Hello, TRICE0()\n");
		#endif

gets changed into

		// Depending on mode, either print this string to
		// UART (mode 0), or the Trice write buffer (mode 200).
		TRICE(Id(0), "Hello, TRICE, %d\n", 42);

		// TRICE(Id(0), "Hello, TRICE\n");
		#else
		TRICE(Id(0), "Hello, TRICE\n");
		TRICE0(Id(0), "Hello, TRICE0()\n");
		#endif

so these lines are disappearing:

		// TRICE() with a string parameter only is problematic.
		// See discussion on https://github.com/rokath/trice/issues/279
		// TRICE0() works in either case
		#ifdef __STRICT_ANSI__
		// if compiled with e.g. --std=c99

when running renewIDs_in_examples_and_test_folder.sh in branch devel. This needs a special test first.

@rokath
Copy link
Owner

rokath commented Dec 18, 2024

I propose to close this issue for less issue noise. Normal usage is trice(... and all these cases are evaluated for matching value counts. If a user writes TRICE0(... or TRICE_3(... incorrectly, at least the compiler will complain. Also this limitation is documented now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants