1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

sys/test_utils/interactive_sync: AVR puts to pgmspace

This commit is contained in:
Francisco Molina 2019-12-13 10:12:01 +01:00
parent 26a1348a9a
commit 089c9ae71a

View File

@ -20,6 +20,16 @@
#include <stdio.h> #include <stdio.h>
#include "test_utils/interactive_sync.h" #include "test_utils/interactive_sync.h"
#if defined(__AVR__)
#include <avr/pgmspace.h>
/* For small AVR targets the extra strings generated by test interactive
can make the application overflow the .data section (RAM), we use puts_P()
to write those constant string to .txt section (FLASH)*/
#define PUTS(_s) puts_P(PSTR(_s))
#else
#define PUTS(_s) puts(_s)
#endif
void test_utils_interactive_sync(void) void test_utils_interactive_sync(void)
{ {
char c = '\0'; /* Print help on first loop */ char c = '\0'; /* Print help on first loop */
@ -27,13 +37,13 @@ void test_utils_interactive_sync(void)
if (c == 'r') { if (c == 'r') {
/* This one should have a different case than the help message /* This one should have a different case than the help message
* otherwise we match it when using 'expect' */ * otherwise we match it when using 'expect' */
puts("READY"); PUTS("READY");
} }
else if (c != '\n' && c != '\r') { else if (c != '\n' && c != '\r') {
puts("Help: Press s to start test, r to print it is ready"); PUTS("Help: Press s to start test, r to print it is ready");
} }
c = getchar(); c = getchar();
} while (c != 's'); } while (c != 's');
puts("START"); PUTS("START");
} }