• R/O
  • SSH
  • HTTPS

chibios: Commit


Commit MetaInfo

Revision14906 (tree)
Time2021-10-13 20:19:23
Authorgdisirio

Log Message

Improved demo to make report readable.

Change Summary

Incremental Difference

--- trunk/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_DYNAMIC/Makefile (revision 14905)
+++ trunk/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_DYNAMIC/Makefile (revision 14906)
@@ -5,7 +5,7 @@
55
66 # Compiler options here.
77 ifeq ($(USE_OPT),)
8- USE_OPT = -Og -ggdb -fomit-frame-pointer -falign-functions=16
8+ USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
99 endif
1010
1111 # C specific options here (added to USE_OPT).
--- trunk/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_DYNAMIC/main.c (revision 14905)
+++ trunk/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_DYNAMIC/main.c (revision 14906)
@@ -101,19 +101,13 @@
101101 */
102102 static THD_WORKING_AREA(waThread1, 256);
103103 static THD_FUNCTION(Thread1, arg) {
104- unsigned i = 1U;
105104
106105 (void)arg;
107106
108107 chRegSetThreadName("blinker");
109108 while (true) {
110- palClearLine(LINE_LED_GREEN);
109+ palToggleLine(LINE_LED_GREEN);
111110 chThdSleepMilliseconds(500);
112- (void) sbSendMessageTimeout(&sbx1, (msg_t)i, TIME_MS2I(10));
113- palSetLine(LINE_LED_GREEN);
114- chThdSleepMilliseconds(500);
115- (void) sbSendMessageTimeout(&sbx2, (msg_t)i, TIME_MS2I(10));
116- i++;
117111 }
118112 }
119113
@@ -121,6 +115,7 @@
121115 * Application entry point.
122116 */
123117 int main(void) {
118+ unsigned i = 1U;
124119 thread_t *utp1, *utp2;
125120 event_listener_t el1;
126121
@@ -190,6 +185,18 @@
190185 chprintf((BaseSequentialStream *)&LPSD1, "SB2 terminated\r\n");
191186 }
192187 }
188+
189+ if ((i & 1) == 0U) {
190+ if (!chThdTerminatedX(utp1)) {
191+ (void) sbSendMessageTimeout(&sbx1, (msg_t)i, TIME_MS2I(10));
192+ }
193+ }
194+ else {
195+ if (!chThdTerminatedX(utp2)) {
196+ (void) sbSendMessageTimeout(&sbx2, (msg_t)i, TIME_MS2I(10));
197+ }
198+ }
199+ i++;
193200 }
194201 }
195202
--- trunk/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/Makefile (revision 14905)
+++ trunk/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/Makefile (revision 14906)
@@ -5,7 +5,7 @@
55
66 # Compiler options here.
77 ifeq ($(USE_OPT),)
8- USE_OPT = -Og -ggdb -fomit-frame-pointer -falign-functions=16
8+ USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
99 endif
1010
1111 # C specific options here (added to USE_OPT).
--- trunk/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/main.c (revision 14905)
+++ trunk/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/main.c (revision 14906)
@@ -73,19 +73,13 @@
7373 */
7474 static THD_WORKING_AREA(waThread1, 256);
7575 static THD_FUNCTION(Thread1, arg) {
76- unsigned i = 1U;
7776
7877 (void)arg;
7978
8079 chRegSetThreadName("blinker");
8180 while (true) {
82- palClearLine(LINE_LED_GREEN);
81+ palToggleLine(LINE_LED_GREEN);
8382 chThdSleepMilliseconds(500);
84- (void) sbSendMessageTimeout(&sbx1, (msg_t)i, TIME_MS2I(10));
85- palSetLine(LINE_LED_GREEN);
86- chThdSleepMilliseconds(500);
87- (void) sbSendMessageTimeout(&sbx2, (msg_t)i, TIME_MS2I(10));
88- i++;
8983 }
9084 }
9185
@@ -93,6 +87,7 @@
9387 * Application entry point.
9488 */
9589 int main(void) {
90+ unsigned i = 1U;
9691 thread_t *utp1, *utp2;
9792 event_listener_t el1;
9893
@@ -180,6 +175,18 @@
180175 chprintf((BaseSequentialStream *)&LPSD1, "SB2 terminated\r\n");
181176 }
182177 }
178+
179+ if ((i & 1) == 0U) {
180+ if (!chThdTerminatedX(utp1)) {
181+ (void) sbSendMessageTimeout(&sbx1, (msg_t)i, TIME_MS2I(10));
182+ }
183+ }
184+ else {
185+ if (!chThdTerminatedX(utp2)) {
186+ (void) sbSendMessageTimeout(&sbx2, (msg_t)i, TIME_MS2I(10));
187+ }
188+ }
189+ i++;
183190 }
184191 }
185192
Show on old repository browser