examples/embedding-full: Enable floating point numbers and math module.

Signed-off-by: Christian Walther <cwalther@gmx.ch>
pull/11430/head
Christian Walther 2023-05-03 22:56:59 +02:00
rodzic 124b2dbfe0
commit 5a1638986f
3 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -22,7 +22,7 @@ SRC += $(filter-out $(EMBED_DIR)/lib/%.c,$(wildcard $(EMBED_DIR)/*/*/*.c))
OBJ += $(SRC:.c=.o)
$(PROG): $(OBJ)
$(CC) -o $@ $^
$(CC) -o $@ $^ -lm
clean:
/bin/rm -f $(OBJ) $(PROG)

Wyświetl plik

@ -8,7 +8,7 @@
// This is example 1 script, which will be compiled and executed.
static const char *example_1 =
"print('hello world!', list(x + 1 for x in range(10)), end='eol\\n')";
"print('hello world!', list(x + 1.5 for x in range(10)), end='eol\\n')";
// This is example 2 script, which will be compiled and executed.
static const char *example_2 =
@ -35,6 +35,8 @@ static const char *example_2 =
"help(random)\n"
"import time\n"
"help(time)\n"
"import math\n"
"help(math)\n"
"import frozenhello\n"
"help(frozenhello)\n"
"print('frozenhello.hello():', frozenhello.hello())\n"

Wyświetl plik

@ -19,6 +19,9 @@
#define MICROPY_HW_BOARD_NAME "embedded"
#define MICROPY_HW_MCU_NAME "C"
// Enable floating point numbers and the math module.
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
// Requires shared/readline/readline.h, don't bother as we have no input.
#define MICROPY_PY_BUILTINS_INPUT (0)