forked from platformio/platformio-core
Update unit testing support for mbed framework
- Take into account Mbed OS6 API changes - RawSerial is used with Mbed OS 5 since Serial doesn't support putc with baremetal profile
This commit is contained in:
2
examples
2
examples
Submodule examples updated: c3f6d1f17e...f0f4e0971b
@ -25,33 +25,33 @@ TRANSPORT_OPTIONS = {
|
|||||||
"arduino": {
|
"arduino": {
|
||||||
"include": "#include <Arduino.h>",
|
"include": "#include <Arduino.h>",
|
||||||
"object": "",
|
"object": "",
|
||||||
"putchar": "Serial.write(c)",
|
"putchar": "Serial.write(c);",
|
||||||
"flush": "Serial.flush()",
|
"flush": "Serial.flush();",
|
||||||
"begin": "Serial.begin($baudrate)",
|
"begin": "Serial.begin($baudrate);",
|
||||||
"end": "Serial.end()",
|
"end": "Serial.end();",
|
||||||
"language": "cpp",
|
"language": "cpp",
|
||||||
},
|
},
|
||||||
"mbed": {
|
"mbed": {
|
||||||
"include": "#include <mbed.h>",
|
"include": "#include <mbed.h>",
|
||||||
"object": "Serial pc(USBTX, USBRX);",
|
"object": "#if MBED_MAJOR_VERSION == 6\nUnbufferedSerial pc(USBTX, USBRX);\n#else\nRawSerial pc(USBTX, USBRX);\n#endif",
|
||||||
"putchar": "pc.putc(c)",
|
"putchar": "#if MBED_MAJOR_VERSION == 6\npc.write(&c, 1);\n#else\npc.putc(c);\n#endif",
|
||||||
"flush": "",
|
"flush": "",
|
||||||
"begin": "pc.baud($baudrate)",
|
"begin": "pc.baud($baudrate);",
|
||||||
"end": "",
|
"end": "",
|
||||||
"language": "cpp",
|
"language": "cpp",
|
||||||
},
|
},
|
||||||
"espidf": {
|
"espidf": {
|
||||||
"include": "#include <stdio.h>",
|
"include": "#include <stdio.h>",
|
||||||
"object": "",
|
"object": "",
|
||||||
"putchar": "putchar(c)",
|
"putchar": "putchar(c);",
|
||||||
"flush": "fflush(stdout)",
|
"flush": "fflush(stdout);",
|
||||||
"begin": "",
|
"begin": "",
|
||||||
"end": "",
|
"end": "",
|
||||||
},
|
},
|
||||||
"zephyr": {
|
"zephyr": {
|
||||||
"include": "#include <sys/printk.h>",
|
"include": "#include <sys/printk.h>",
|
||||||
"object": "",
|
"object": "",
|
||||||
"putchar": 'printk("%c", c)',
|
"putchar": 'printk("%c", c);',
|
||||||
"flush": "",
|
"flush": "",
|
||||||
"begin": "",
|
"begin": "",
|
||||||
"end": "",
|
"end": "",
|
||||||
@ -59,18 +59,18 @@ TRANSPORT_OPTIONS = {
|
|||||||
"native": {
|
"native": {
|
||||||
"include": "#include <stdio.h>",
|
"include": "#include <stdio.h>",
|
||||||
"object": "",
|
"object": "",
|
||||||
"putchar": "putchar(c)",
|
"putchar": "putchar(c);",
|
||||||
"flush": "fflush(stdout)",
|
"flush": "fflush(stdout);",
|
||||||
"begin": "",
|
"begin": "",
|
||||||
"end": "",
|
"end": "",
|
||||||
},
|
},
|
||||||
"custom": {
|
"custom": {
|
||||||
"include": '#include "unittest_transport.h"',
|
"include": '#include "unittest_transport.h"',
|
||||||
"object": "",
|
"object": "",
|
||||||
"putchar": "unittest_uart_putchar(c)",
|
"putchar": "unittest_uart_putchar(c);",
|
||||||
"flush": "unittest_uart_flush()",
|
"flush": "unittest_uart_flush();",
|
||||||
"begin": "unittest_uart_begin()",
|
"begin": "unittest_uart_begin();",
|
||||||
"end": "unittest_uart_end()",
|
"end": "unittest_uart_end();",
|
||||||
"language": "cpp",
|
"language": "cpp",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -174,22 +174,22 @@ class TestProcessorBase(object):
|
|||||||
"void output_start(unsigned int baudrate)",
|
"void output_start(unsigned int baudrate)",
|
||||||
"#endif",
|
"#endif",
|
||||||
"{",
|
"{",
|
||||||
" $begin;",
|
" $begin",
|
||||||
"}",
|
"}",
|
||||||
"",
|
"",
|
||||||
"void output_char(int c)",
|
"void output_char(int c)",
|
||||||
"{",
|
"{",
|
||||||
" $putchar;",
|
" $putchar",
|
||||||
"}",
|
"}",
|
||||||
"",
|
"",
|
||||||
"void output_flush(void)",
|
"void output_flush(void)",
|
||||||
"{",
|
"{",
|
||||||
" $flush;",
|
" $flush",
|
||||||
"}",
|
"}",
|
||||||
"",
|
"",
|
||||||
"void output_complete(void)",
|
"void output_complete(void)",
|
||||||
"{",
|
"{",
|
||||||
" $end;",
|
" $end",
|
||||||
"}",
|
"}",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user