mirror of
https://github.com/G42makes/mp-s7.git
synced 2025-01-18 02:32:08 +00:00
It compiles at least...
This commit is contained in:
parent
47c2090c8e
commit
f03c789088
1
.gitignore
vendored
1
.gitignore
vendored
@ -199,3 +199,4 @@ dmypy.json
|
||||
# End of https://www.gitignore.io/api/c,c++,cmake,python
|
||||
|
||||
testcode/
|
||||
build/
|
||||
|
50
mp-s7-src/CMakeLists.txt
Normal file
50
mp-s7-src/CMakeLists.txt
Normal file
@ -0,0 +1,50 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(MPTests VERSION 0.1 LANGUAGES C CXX)
|
||||
|
||||
add_library(RetroConsole
|
||||
retro/Console.cc
|
||||
retro/Console.h
|
||||
retro/ConsoleWindow.cc
|
||||
retro/ConsoleWindow.h
|
||||
retro/MacUtils.h
|
||||
retro/InitConsole.cc
|
||||
)
|
||||
set_target_properties(RetroConsole
|
||||
PROPERTIES
|
||||
COMPILE_OPTIONS -ffunction-sections)
|
||||
|
||||
# different library name for Carbon
|
||||
# (Carbon shares the powerpc-apple-macos/ directory with Classic PPC)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES RetroCarbon)
|
||||
set_target_properties(RetroConsole PROPERTIES OUTPUT_NAME RetroConsoleCarbon)
|
||||
endif()
|
||||
target_include_directories(RetroConsole PUBLIC .)
|
||||
|
||||
install(TARGETS RetroConsole DESTINATION lib)
|
||||
|
||||
|
||||
#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
|
||||
mpconfigport.h
|
||||
mphalport.h
|
||||
stringio.c
|
||||
main.c
|
||||
)
|
||||
add_application(MPTests ${micropython_py_SRC})
|
||||
|
||||
target_include_directories(MPTests
|
||||
PUBLIC ../micropython/
|
||||
../micropython/ports/minimal/build/
|
||||
./
|
||||
)
|
||||
|
||||
target_link_libraries(MPTests
|
||||
RetroConsole
|
||||
# MP
|
||||
)
|
||||
|
@ -1,3 +1,4 @@
|
||||
//#include "retro/Console.h"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -31,7 +32,15 @@ static char *stack_top;
|
||||
static char heap[2048];
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
/*
|
||||
namespace retro
|
||||
{
|
||||
void InitConsole();
|
||||
}
|
||||
*/
|
||||
|
||||
int main()
|
||||
{
|
||||
int stack_dummy;
|
||||
stack_top = (char*)&stack_dummy;
|
||||
|
||||
@ -39,25 +48,21 @@ int main(int argc, char **argv) {
|
||||
gc_init(heap, heap + sizeof(heap));
|
||||
#endif
|
||||
mp_init();
|
||||
#if MICROPY_ENABLE_COMPILER
|
||||
#if MICROPY_REPL_EVENT_DRIVEN
|
||||
pyexec_event_repl_init();
|
||||
for (;;) {
|
||||
int c = mp_hal_stdin_rx_chr();
|
||||
if (pyexec_event_repl_process_char(c)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
pyexec_friendly_repl();
|
||||
#endif
|
||||
//do_str("print('hello world!', list(x+1 for x in range(10)), end='eol\\n')", MP_PARSE_SINGLE_INPUT);
|
||||
//do_str("for i in range(10):\r\n print(i)", MP_PARSE_FILE_INPUT);
|
||||
#else
|
||||
pyexec_frozen_module("frozentest.py");
|
||||
#endif
|
||||
mp_deinit();
|
||||
|
||||
/*
|
||||
retro::InitConsole();
|
||||
std::string out = "Hello, world.\nEnter \"exit\" to quit.\n";
|
||||
retro::Console::currentInstance->write(out.data(), out.size());
|
||||
|
||||
std::string in;
|
||||
do
|
||||
{
|
||||
in = retro::Console::currentInstance->ReadLine();
|
||||
out = "You Entered: " + in;
|
||||
retro::Console::currentInstance->write(out.data(), out.size());
|
||||
} while(in != "exit\n");
|
||||
return 0;
|
||||
*/
|
||||
}
|
||||
|
||||
void gc_collect(void) {
|
||||
@ -97,4 +102,3 @@ void MP_WEAK __assert_func(const char *file, int line, const char *func, const c
|
||||
__fatal_error("Assertion failed");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
// will still be able to execute pre-compiled scripts, compiled with mpy-cross.
|
||||
#define MICROPY_ENABLE_COMPILER (1)
|
||||
|
||||
#define MICROPY_ENABLE_EXTERNAL_IMPORT (0) //removed for first compile. TODO remove this line to default to enabled
|
||||
|
||||
#define MICROPY_QSTR_BYTES_IN_HASH (1)
|
||||
#define MICROPY_QSTR_EXTRA_POOL mp_qstr_frozen_const_pool
|
||||
#define MICROPY_ALLOC_PATH_MAX (256)
|
||||
@ -74,6 +76,7 @@ typedef unsigned mp_uint_t; // must be pointer size
|
||||
typedef long mp_off_t;
|
||||
|
||||
#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
|
||||
//TODO: make the above call to a new function that will deal with macos linefeeds
|
||||
|
||||
// extra built in names to add to the global namespace
|
||||
#define MICROPY_PORT_BUILTINS \
|
||||
|
Loading…
x
Reference in New Issue
Block a user