diff options
| author | John R. Lenton | 2014-01-03 22:55:16 +0000 |
|---|---|---|
| committer | John R. Lenton | 2014-01-03 22:55:16 +0000 |
| commit | 97334c85d0b53ef1648eb76ec6e9e2b1efab1f97 (patch) | |
| tree | d10f6b6b7ca3394e6f7dc31ca55e0df2b39abe02 /stm | |
| parent | 25f417c08c2cdb5c4a7564d1e69766c0448d7984 (diff) | |
| parent | b7aa72710ee6798c6d2bc2632be24206e526fc1e (diff) | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'stm')
| -rw-r--r-- | stm/Makefile | 5 | ||||
| -rw-r--r-- | stm/audio.c | 1 | ||||
| -rw-r--r-- | stm/lcd.c | 1 | ||||
| -rw-r--r-- | stm/lexerstm.c | 5 | ||||
| -rw-r--r-- | stm/main.c | 48 | ||||
| -rw-r--r-- | stm/mpconfigport.h (renamed from stm/mpconfig.h) | 2 | ||||
| -rw-r--r-- | stm/pybwlan.c | 1 | ||||
| -rw-r--r-- | stm/timer.c | 1 |
8 files changed, 29 insertions, 35 deletions
diff --git a/stm/Makefile b/stm/Makefile index 6868f85ba..d6c77e2bd 100644 --- a/stm/Makefile +++ b/stm/Makefile @@ -82,6 +82,7 @@ PY_O = \ objtuple.o \ objtype.o \ builtin.o \ + builtinimport.o \ vm.o \ repl.o \ @@ -147,7 +148,7 @@ OBJ = $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(SRC_S:.s=.o) $(PY_O) $(SRC_FATFS:. all: $(BUILD) $(BUILD)/flash.dfu $(BUILD)/flash.dfu: $(BUILD)/flash0.bin $(BUILD)/flash1.bin - python2 $(DFU) -b 0x08000000:$(BUILD)/flash0.bin -b 0x08020000:$(BUILD)/flash1.bin $@ + python $(DFU) -b 0x08000000:$(BUILD)/flash0.bin -b 0x08020000:$(BUILD)/flash1.bin $@ $(BUILD)/flash0.bin: $(BUILD)/flash.elf arm-none-eabi-objcopy -O binary -j .isr_vector $^ $@ @@ -186,7 +187,7 @@ $(BUILD)/%.o: $(PYSRC)/%.s $(BUILD)/%.o: $(PYSRC)/%.S $(CC) $(CFLAGS) -c -o $@ $< -$(BUILD)/%.o: $(PYSRC)/%.c mpconfig.h +$(BUILD)/%.o: $(PYSRC)/%.c mpconfigport.h $(CC) $(CFLAGS) -c -o $@ $< $(BUILD)/emitnthumb.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h diff --git a/stm/audio.c b/stm/audio.c index 38e0012b4..34adefbcd 100644 --- a/stm/audio.c +++ b/stm/audio.c @@ -8,7 +8,6 @@ #include "misc.h" #include "mpconfig.h" #include "parse.h" -#include "compile.h" #include "obj.h" #include "runtime.h" @@ -5,7 +5,6 @@ #include "misc.h" #include "mpconfig.h" #include "parse.h" -#include "compile.h" #include "obj.h" #include "runtime.h" diff --git a/stm/lexerstm.c b/stm/lexerstm.c index dfb84cca1..661dfb016 100644 --- a/stm/lexerstm.c +++ b/stm/lexerstm.c @@ -61,3 +61,8 @@ mp_lexer_t *mp_lexer_new_from_file(const char *filename, mp_lexer_file_buf_t *fb fb->pos = 0; return mp_lexer_new(filename, fb, (mp_lexer_stream_next_char_t)file_buf_next_char, (mp_lexer_stream_close_t)file_buf_close); } + +mp_lexer_t *mp_import_open_file(qstr mod_name) { + printf("import not implemented\n"); + return NULL; +} diff --git a/stm/main.c b/stm/main.c index f16ce252d..e8db2be2c 100644 --- a/stm/main.c +++ b/stm/main.c @@ -20,8 +20,8 @@ #include "lexer.h" #include "lexerstm.h" #include "parse.h" -#include "compile.h" #include "obj.h" +#include "compile.h" #include "runtime0.h" #include "runtime.h" #include "repl.h" @@ -489,25 +489,22 @@ void do_repl(void) { mp_lexer_free(lex); if (pn != MP_PARSE_NODE_NULL) { - bool comp_ok = mp_compile(pn, true); - if (comp_ok) { - mp_obj_t module_fun = rt_make_function_from_id(1); - if (module_fun != mp_const_none) { - nlr_buf_t nlr; - uint32_t start = sys_tick_counter; - if (nlr_push(&nlr) == 0) { - rt_call_function_0(module_fun); - nlr_pop(); - // optional timing - if (0) { - uint32_t ticks = sys_tick_counter - start; // TODO implement a function that does this properly - printf("(took %lu ms)\n", ticks); - } - } else { - // uncaught exception - mp_obj_print((mp_obj_t)nlr.ret_val); - printf("\n"); + mp_obj_t module_fun = mp_compile(pn, true); + if (module_fun != mp_const_none) { + nlr_buf_t nlr; + uint32_t start = sys_tick_counter; + if (nlr_push(&nlr) == 0) { + rt_call_function_0(module_fun); + nlr_pop(); + // optional timing + if (0) { + uint32_t ticks = sys_tick_counter - start; // TODO implement a function that does this properly + printf("(took %lu ms)\n", ticks); } + } else { + // uncaught exception + mp_obj_print((mp_obj_t)nlr.ret_val); + printf("\n"); } } } @@ -532,12 +529,7 @@ bool do_file(const char *filename) { return false; } - bool comp_ok = mp_compile(pn, false); - if (!comp_ok) { - return false; - } - - mp_obj_t module_fun = rt_make_function_from_id(1); + mp_obj_t module_fun = mp_compile(pn, false); if (module_fun == mp_const_none) { return false; } @@ -1133,17 +1125,15 @@ soft_reset: printf("pars;al=%u\n", m_get_total_bytes_allocated()); sys_tick_delay_ms(1000); //parse_node_show(pn, 0); - bool comp_ok = mp_compile(pn, false); + mp_obj_t module_fun = mp_compile(pn, false); printf("comp;al=%u\n", m_get_total_bytes_allocated()); sys_tick_delay_ms(1000); - if (!comp_ok) { + if (module_fun == mp_const_none) { printf("compile error\n"); } else { // execute it! - mp_obj_t module_fun = rt_make_function_from_id(1); - // flash once led_state(PYB_LED_G1, 1); sys_tick_delay_ms(100); diff --git a/stm/mpconfig.h b/stm/mpconfigport.h index 1f9529e11..4cea332f3 100644 --- a/stm/mpconfig.h +++ b/stm/mpconfigport.h @@ -1,3 +1,5 @@ +#include <stdint.h> + // options to control how Micro Python is built #define MICROPY_ENABLE_FLOAT (1) diff --git a/stm/pybwlan.c b/stm/pybwlan.c index 6341d0676..6988f1c84 100644 --- a/stm/pybwlan.c +++ b/stm/pybwlan.c @@ -18,7 +18,6 @@ #include "misc.h" #include "lexer.h" #include "parse.h" -#include "compile.h" #include "obj.h" #include "map.h" #include "runtime.h" diff --git a/stm/timer.c b/stm/timer.c index 28148b0c1..2605d4b4b 100644 --- a/stm/timer.c +++ b/stm/timer.c @@ -9,7 +9,6 @@ #include "misc.h" #include "mpconfig.h" #include "parse.h" -#include "compile.h" #include "obj.h" #include "runtime.h" |
