summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-02-13 15:26:53 +0000
committerDamien George <damien.p.george@gmail.com>2015-02-13 15:26:53 +0000
commit601c814603801ad3af78e37d26c87a4470156738 (patch)
tree4e6f5b1b6cdd15b8c7c6967da1d66aa90f81115e
parentccf45a42833355100c1cebb5851fa36494914ce1 (diff)
downloadmicropython-601c814603801ad3af78e37d26c87a4470156738.tar.gz
micropython-601c814603801ad3af78e37d26c87a4470156738.zip
minimal: Allow to compile without defining MICROPY_HAL_H.
-rw-r--r--lib/mp-readline/readline.c2
-rw-r--r--minimal/main.c1
-rw-r--r--minimal/mpconfigport.h4
-rw-r--r--minimal/uart_core.c4
-rw-r--r--minimal/uart_extra.c11
-rw-r--r--stmhal/printf.c2
6 files changed, 15 insertions, 9 deletions
diff --git a/lib/mp-readline/readline.c b/lib/mp-readline/readline.c
index 53376708f8..303d95b150 100644
--- a/lib/mp-readline/readline.c
+++ b/lib/mp-readline/readline.c
@@ -30,7 +30,9 @@
#include "py/mpstate.h"
#include "readline.h"
+#ifdef MICROPY_HAL_H
#include MICROPY_HAL_H
+#endif
#if 0 // print debugging info
#define DEBUG_PRINT (1)
diff --git a/minimal/main.c b/minimal/main.c
index c6c8080ade..1d600d5847 100644
--- a/minimal/main.c
+++ b/minimal/main.c
@@ -9,7 +9,6 @@
#include "py/pfenv.h"
#include "py/gc.h"
#include "pyexec.h"
-#include "pybstdio.h"
void do_str(const char *src) {
mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0);
diff --git a/minimal/mpconfigport.h b/minimal/mpconfigport.h
index c2a88734ac..4addae5784 100644
--- a/minimal/mpconfigport.h
+++ b/minimal/mpconfigport.h
@@ -65,6 +65,10 @@ extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
#include <alloca.h>
#define HAL_GetTick() 0
+int mp_hal_stdin_rx_chr(void);
+void mp_hal_stdout_tx_str(const char *str);
+void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len);
+void mp_hal_stdout_tx_strn_cooked(const char *str, mp_uint_t len);
static inline void mp_hal_set_interrupt_char(char c) {}
diff --git a/minimal/uart_core.c b/minimal/uart_core.c
index 92c81ecc9e..48cc27d6de 100644
--- a/minimal/uart_core.c
+++ b/minimal/uart_core.c
@@ -6,7 +6,7 @@
*/
// Receive single character
-int stdin_rx_chr(void) {
+int mp_hal_stdin_rx_chr(void) {
unsigned char c = 0;
#if MICROPY_MIN_USE_STDOUT
int r = read(0, &c, 1);
@@ -16,7 +16,7 @@ int stdin_rx_chr(void) {
}
// Send string of given length
-void stdout_tx_strn(const char *str, mp_uint_t len) {
+void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) {
#if MICROPY_MIN_USE_STDOUT
int r = write(1, str, len);
(void)r;
diff --git a/minimal/uart_extra.c b/minimal/uart_extra.c
index a49bff7b96..e266904be0 100644
--- a/minimal/uart_extra.c
+++ b/minimal/uart_extra.c
@@ -1,7 +1,6 @@
#include <string.h>
#include <unistd.h>
#include "py/mpconfig.h"
-#include "pybstdio.h"
/*
* Extra UART functions
@@ -11,16 +10,16 @@
// Send "cooked" string of length, where every occurance of
// LF character is replaced with CR LF.
-void stdout_tx_strn_cooked(const char *str, mp_uint_t len) {
+void mp_hal_stdout_tx_strn_cooked(const char *str, mp_uint_t len) {
while (len--) {
if (*str == '\n') {
- stdout_tx_strn("\r", 1);
+ mp_hal_stdout_tx_strn("\r", 1);
}
- stdout_tx_strn(str++, 1);
+ mp_hal_stdout_tx_strn(str++, 1);
}
}
// Send zero-terminated string
-void stdout_tx_str(const char *str) {
- stdout_tx_strn(str, strlen(str));
+void mp_hal_stdout_tx_str(const char *str) {
+ mp_hal_stdout_tx_strn(str, strlen(str));
}
diff --git a/stmhal/printf.c b/stmhal/printf.c
index 7af4f659d2..038ee99376 100644
--- a/stmhal/printf.c
+++ b/stmhal/printf.c
@@ -30,7 +30,9 @@
#include "py/obj.h"
#include "py/pfenv.h"
+#ifdef MICROPY_HAL_H
#include MICROPY_HAL_H
+#endif
#if MICROPY_PY_BUILTINS_FLOAT
#include "py/formatfloat.h"