1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-24 15:28:10 +00:00

embed: cleanup unused modules

This commit is contained in:
Pavol Rusnak 2018-01-02 19:59:40 +01:00
parent fa95f0a037
commit b98a1db6ee
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
6 changed files with 14 additions and 31 deletions

View File

@ -100,10 +100,10 @@ build_reflash: ## build reflash firmware + reflash image
build_firmware: res build_cross ## build firmware with frozen modules build_firmware: res build_cross ## build firmware with frozen modules
$(SCONS) CFLAGS="$(CFLAGS)" $(FIRMWARE_BUILD_DIR)/firmware.bin $(SCONS) CFLAGS="$(CFLAGS)" $(FIRMWARE_BUILD_DIR)/firmware.bin
build_unix: ## build unix port build_unix: res ## build unix port
$(SCONS) CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/micropython $(UNIX_PORT_OPTS) $(SCONS) CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/micropython $(UNIX_PORT_OPTS)
build_unix_noui: ## build unix port without UI support build_unix_noui: res ## build unix port without UI support
$(SCONS) CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/micropython $(UNIX_PORT_OPTS) TREZOR_NOUI=1 $(SCONS) CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/micropython $(UNIX_PORT_OPTS) TREZOR_NOUI=1
build_cross: ## build mpy-cross port build_cross: ## build mpy-cross port

View File

@ -107,7 +107,6 @@ SOURCE_MICROPYTHON = [
'vendor/micropython/extmod/moductypes.c', 'vendor/micropython/extmod/moductypes.c',
'vendor/micropython/extmod/moduheapq.c', 'vendor/micropython/extmod/moduheapq.c',
'vendor/micropython/extmod/modutimeq.c', 'vendor/micropython/extmod/modutimeq.c',
'vendor/micropython/extmod/moduzlib.c',
'vendor/micropython/extmod/utime_mphal.c', 'vendor/micropython/extmod/utime_mphal.c',
'vendor/micropython/lib/embed/abort_.c', 'vendor/micropython/lib/embed/abort_.c',
'vendor/micropython/lib/libc/string0.c', 'vendor/micropython/lib/libc/string0.c',
@ -168,16 +167,11 @@ SOURCE_MICROPYTHON = [
'vendor/micropython/py/map.c', 'vendor/micropython/py/map.c',
'vendor/micropython/py/modarray.c', 'vendor/micropython/py/modarray.c',
'vendor/micropython/py/modbuiltins.c', 'vendor/micropython/py/modbuiltins.c',
'vendor/micropython/py/modcmath.c',
'vendor/micropython/py/modcollections.c',
'vendor/micropython/py/modgc.c', 'vendor/micropython/py/modgc.c',
'vendor/micropython/py/modio.c',
'vendor/micropython/py/modmath.c', 'vendor/micropython/py/modmath.c',
'vendor/micropython/py/modmicropython.c', 'vendor/micropython/py/modmicropython.c',
'vendor/micropython/py/modstruct.c', 'vendor/micropython/py/modstruct.c',
'vendor/micropython/py/modsys.c', 'vendor/micropython/py/modsys.c',
'vendor/micropython/py/modthread.c',
'vendor/micropython/py/moduerrno.c',
'vendor/micropython/py/mpprint.c', 'vendor/micropython/py/mpprint.c',
'vendor/micropython/py/mpstate.c', 'vendor/micropython/py/mpstate.c',
'vendor/micropython/py/mpz.c', 'vendor/micropython/py/mpz.c',

View File

@ -103,9 +103,9 @@ SOURCE_MOD += [
] ]
# modutime # modutime
# SOURCE_MOD += [ SOURCE_MOD += [
# 'embed/firmware/modutime.c', 'vendor/micropython/ports/unix/modtime.c',
# ] ]
SOURCE_MICROPYTHON = [ SOURCE_MICROPYTHON = [
'vendor/micropython/extmod/modubinascii.c', 'vendor/micropython/extmod/modubinascii.c',
@ -114,7 +114,6 @@ SOURCE_MICROPYTHON = [
'vendor/micropython/extmod/modutimeq.c', 'vendor/micropython/extmod/modutimeq.c',
'vendor/micropython/extmod/utime_mphal.c', 'vendor/micropython/extmod/utime_mphal.c',
'vendor/micropython/lib/mp-readline/readline.c', 'vendor/micropython/lib/mp-readline/readline.c',
'vendor/micropython/lib/timeutils/timeutils.c',
'vendor/micropython/py/argcheck.c', 'vendor/micropython/py/argcheck.c',
'vendor/micropython/py/asmarm.c', 'vendor/micropython/py/asmarm.c',
'vendor/micropython/py/asmbase.c', 'vendor/micropython/py/asmbase.c',
@ -141,16 +140,11 @@ SOURCE_MICROPYTHON = [
'vendor/micropython/py/map.c', 'vendor/micropython/py/map.c',
'vendor/micropython/py/modarray.c', 'vendor/micropython/py/modarray.c',
'vendor/micropython/py/modbuiltins.c', 'vendor/micropython/py/modbuiltins.c',
'vendor/micropython/py/modcmath.c',
'vendor/micropython/py/modcollections.c',
'vendor/micropython/py/modgc.c', 'vendor/micropython/py/modgc.c',
'vendor/micropython/py/modio.c',
'vendor/micropython/py/modmath.c', 'vendor/micropython/py/modmath.c',
'vendor/micropython/py/modmicropython.c', 'vendor/micropython/py/modmicropython.c',
'vendor/micropython/py/modstruct.c', 'vendor/micropython/py/modstruct.c',
'vendor/micropython/py/modsys.c', 'vendor/micropython/py/modsys.c',
'vendor/micropython/py/modthread.c',
'vendor/micropython/py/moduerrno.c',
'vendor/micropython/py/mpprint.c', 'vendor/micropython/py/mpprint.c',
'vendor/micropython/py/mpstate.c', 'vendor/micropython/py/mpstate.c',
'vendor/micropython/py/mpz.c', 'vendor/micropython/py/mpz.c',
@ -222,10 +216,7 @@ SOURCE_UNIX = [
'vendor/micropython/ports/unix/main.c', 'vendor/micropython/ports/unix/main.c',
'vendor/micropython/ports/unix/gccollect.c', 'vendor/micropython/ports/unix/gccollect.c',
'vendor/micropython/ports/unix/unix_mphal.c', 'vendor/micropython/ports/unix/unix_mphal.c',
'vendor/micropython/ports/unix/mpthreadport.c',
'vendor/micropython/ports/unix/input.c', 'vendor/micropython/ports/unix/input.c',
'vendor/micropython/ports/unix/file.c',
'vendor/micropython/ports/unix/modtime.c',
'vendor/micropython/ports/unix/alloc.c', 'vendor/micropython/ports/unix/alloc.c',
'embed/unix/common.c', 'embed/unix/common.c',
'embed/unix/flash.c', 'embed/unix/flash.c',

View File

@ -100,6 +100,7 @@
#define MICROPY_PY_BUILTINS_HELP_MODULES (0) #define MICROPY_PY_BUILTINS_HELP_MODULES (0)
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1) #define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1) #define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
#define MICROPY_PY_COLLECTIONS (0)
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0) #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0)
#define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (0) #define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (0)
#define MICROPY_PY_CMATH (0) #define MICROPY_PY_CMATH (0)
@ -141,8 +142,7 @@
#define MICROPY_PY_TREZORUTILS (1) #define MICROPY_PY_TREZORUTILS (1)
// extra built in names to add to the global namespace // extra built in names to add to the global namespace
#define MICROPY_PORT_BUILTINS \ #define MICROPY_PORT_BUILTINS
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
// extra built in modules to add to the list of known ones // extra built in modules to add to the list of known ones
extern const struct _mp_obj_module_t mp_module_utime; extern const struct _mp_obj_module_t mp_module_utime;

View File

@ -94,15 +94,17 @@
#else #else
#define MICROPY_PY_SYS_PLATFORM "linux" #define MICROPY_PY_SYS_PLATFORM "linux"
#endif #endif
#define MICROPY_PY_SYS_MAXSIZE (1) #define MICROPY_PY_SYS_MAXSIZE (0)
#define MICROPY_PY_SYS_STDFILES (1) #define MICROPY_PY_SYS_STDFILES (0)
#define MICROPY_PY_SYS_EXC_INFO (1) #define MICROPY_PY_SYS_EXC_INFO (1)
#define MICROPY_PY_COLLECTIONS (0)
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0) #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0)
#ifndef MICROPY_PY_MATH_SPECIAL_FUNCTIONS #ifndef MICROPY_PY_MATH_SPECIAL_FUNCTIONS
#define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (0) #define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (0)
#endif #endif
#define MICROPY_PY_CMATH (0) #define MICROPY_PY_CMATH (0)
#define MICROPY_PY_IO_FILEIO (1) #define MICROPY_PY_IO (0)
#define MICROPY_PY_IO_FILEIO (0)
#define MICROPY_PY_IO_RESOURCE_STREAM (0) #define MICROPY_PY_IO_RESOURCE_STREAM (0)
#define MICROPY_PY_GC_COLLECT_RETVAL (1) #define MICROPY_PY_GC_COLLECT_RETVAL (1)
#define MICROPY_MODULE_FROZEN_STR (0) #define MICROPY_MODULE_FROZEN_STR (0)
@ -330,8 +332,7 @@ void mp_unix_mark_exec(void);
#endif #endif
#endif #endif
#define MICROPY_PORT_BUILTINS \ #define MICROPY_PORT_BUILTINS
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
#define MP_STATE_PORT MP_STATE_VM #define MP_STATE_PORT MP_STATE_VM

View File

@ -8,10 +8,7 @@ def load(name):
''' '''
Loads resource of a given name as bytes. Loads resource of a given name as bytes.
''' '''
if resdata and name in resdata: return resdata[name]
return resdata[name]
with open(name, 'rb') as f:
return f.read()
def gettext(message): def gettext(message):