re-org a bit on the CMake and some extra code bits

This commit is contained in:
Jared Young 2019-11-02 19:26:38 +00:00
parent 05962cd1b6
commit 5a9f8fda90
3 changed files with 72 additions and 35 deletions

View File

@ -22,20 +22,44 @@ target_include_directories(RetroConsole PUBLIC .)
install(TARGETS RetroConsole DESTINATION lib)
#micropython/lib/utils - library
add_library(mp_lib_utils
../micropython/lib/utils/stdout_helpers.c
)
target_include_directories(mp_lib_utils PUBLIC
../micropython/
../micropython/ports/minimal/build/
./
)
#App parts
file(GLOB micropython_py_SRC
"../micropython/py/*.h"
"../micropython/py/*.c"
../micropython/lib/utils/stdout_helpers.c
../micropython/ports/minimal/build/_frozen_mpy.c
#micropython/py - main codebase
file(GLOB mp_py_SRC
"../micropython/py/*.c"
../micropython/lib/utils/stdout_helpers.c #TODO: can I get rid of this line?
../micropython/ports/minimal/build/_frozen_mpy.c
mpconfigport.h
mphalport.h
stringio.c
)
add_library(mp_py ${mp_py_SRC})
target_include_directories(mp_py PUBLIC
../micropython/
../micropython/ports/minimal/build/
./
)
#App parts
file(GLOB micropython_SRC
#../micropython/ports/minimal/build/_frozen_mpy.c
mpconfigport.h
mphalport.h
mphalport.c
stringio.c
main.c
)
add_application(MPTests ${micropython_py_SRC})
add_application(MPTests ${micropython_SRC})
target_include_directories(MPTests
PUBLIC ../micropython/
@ -45,6 +69,8 @@ target_include_directories(MPTests
target_link_libraries(MPTests
RetroConsole
mp_lib_utils
mp_py
# MP
)

View File

@ -75,30 +75,3 @@ void gc_collect(void) {
gc_dump_info();
}
mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
mp_raise_OSError(MP_ENOENT);
}
mp_import_stat_t mp_import_stat(const char *path) {
return MP_IMPORT_STAT_NO_EXIST;
}
mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
void nlr_jump_fail(void *val) {
while (1);
}
void NORETURN __fatal_error(const char *msg) {
while (1);
}
#ifndef NDEBUG
void MP_WEAK __assert_func(const char *file, int line, const char *func, const char *expr) {
printf("Assertion '%s' failed, at file %s:%d\n", expr, file, line);
__fatal_error("Assertion failed");
}
#endif

38
mp-s7-src/mphalport.c Normal file
View File

@ -0,0 +1,38 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "py/compile.h"
#include "py/runtime.h"
#include "py/repl.h"
#include "py/gc.h"
#include "py/mperrno.h"
#include "lib/utils/pyexec.h"
mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
mp_raise_OSError(MP_ENOENT);
}
mp_import_stat_t mp_import_stat(const char *path) {
return MP_IMPORT_STAT_NO_EXIST;
}
mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
void nlr_jump_fail(void *val) {
while (1);
}
void NORETURN __fatal_error(const char *msg) {
while (1);
}
#ifndef NDEBUG
void MP_WEAK __assert_func(const char *file, int line, const char *func, const char *expr) {
printf("Assertion '%s' failed, at file %s:%d\n", expr, file, line);
__fatal_error("Assertion failed");
}
#endif