diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-12-27 01:00:12 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-12-27 01:05:37 +0300 |
commit | 25f44c19f17085a09ad0f857c6ccc0d33d7c0344 (patch) | |
tree | 271adae41a5372e0ba21a648e0ead5e3c3bd48b2 | |
parent | cf96be60dc225603b14c97570596db4f482ef070 (diff) | |
download | micropython-25f44c19f17085a09ad0f857c6ccc0d33d7c0344.tar.gz micropython-25f44c19f17085a09ad0f857c6ccc0d33d7c0344.zip |
cc3200: Re-add support for UART REPL (MICROPY_STDIO_UART setting).
UART REPL support was lost in os.dupterm() refactorings, etc. As
os.dupterm() is there, implement UART REPL support at the high level -
if MICROPY_STDIO_UART is set, make default boot.py contain os.dupterm()
call for a UART. This means that changing MICROPY_STDIO_UART value will
also require erasing flash on a module to force boot.py re-creation.
-rw-r--r-- | cc3200/mptask.c | 7 | ||||
-rw-r--r-- | py/misc.h | 4 |
2 files changed, 10 insertions, 1 deletions
diff --git a/cc3200/mptask.c b/cc3200/mptask.c index eb673b08cf..3c34ceeca0 100644 --- a/cc3200/mptask.c +++ b/cc3200/mptask.c @@ -98,7 +98,12 @@ static FATFS *sflash_fatfs; static const char fresh_main_py[] = "# main.py -- put your code here!\r\n"; static const char fresh_boot_py[] = "# boot.py -- run on boot-up\r\n" - "# can run arbitrary Python, but best to keep it minimal\r\n"; + "# can run arbitrary Python, but best to keep it minimal\r\n" + #if MICROPY_STDIO_UART + "import os, machine\r\n" + "os.dupterm(machine.UART(0, " MP_STRINGIFY(MICROPY_STDIO_UART_BAUD) "))\r\n" + #endif + ; /****************************************************************************** DECLARE PUBLIC FUNCTIONS @@ -46,6 +46,10 @@ typedef unsigned int uint; #define MAX(x, y) ((x) > (y) ? (x) : (y)) #endif +// Classical double-indirection stringification of preprocessor macro's value +#define _MP_STRINGIFY(x) #x +#define MP_STRINGIFY(x) _MP_STRINGIFY(x) + /** memory allocation ******************************************/ // TODO make a lazy m_renew that can increase by a smaller amount than requested (but by at least 1 more element) |