From b372bfca21ccab593359ef25a0a0c6bf697c8586 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 3 Jan 2014 17:15:53 +0200 Subject: Rename default config file to mpconfig.h, and port's to mpconfigport.h. mpconfig.h will automatically pull mpconfigport.h. --- py/defaultconfig.h | 7 ------- py/malloc.c | 1 - py/mpconfig.h | 13 +++++++++++++ stm/Makefile | 2 +- stm/mpconfig.h | 19 ------------------- stm/mpconfigport.h | 21 +++++++++++++++++++++ unix/Makefile | 4 ++-- unix/mpconfig.h | 31 ------------------------------- unix/mpconfigport.h | 31 +++++++++++++++++++++++++++++++ 9 files changed, 68 insertions(+), 61 deletions(-) delete mode 100644 py/defaultconfig.h create mode 100644 py/mpconfig.h delete mode 100644 stm/mpconfig.h create mode 100644 stm/mpconfigport.h delete mode 100644 unix/mpconfig.h create mode 100644 unix/mpconfigport.h diff --git a/py/defaultconfig.h b/py/defaultconfig.h deleted file mode 100644 index 9829bf707..000000000 --- a/py/defaultconfig.h +++ /dev/null @@ -1,7 +0,0 @@ -// This file contains default configuration settings for MicroPython. -// You can override any of these options in mpconfig.h for your port. - -// Whether to collect memory allocation stats -#ifndef MICROPY_MEM_STATS -#define MICROPY_MEM_STATS (1) -#endif diff --git a/py/malloc.c b/py/malloc.c index 1765eb674..4f01dc63f 100644 --- a/py/malloc.c +++ b/py/malloc.c @@ -3,7 +3,6 @@ #include "misc.h" #include "mpconfig.h" -#include "defaultconfig.h" #if MICROPY_MEM_STATS static int total_bytes_allocated = 0; diff --git a/py/mpconfig.h b/py/mpconfig.h new file mode 100644 index 000000000..17c5a770c --- /dev/null +++ b/py/mpconfig.h @@ -0,0 +1,13 @@ +// This file contains default configuration settings for MicroPython. +// You can override any of these options using mpconfigport.h file located +// in a directory of your port. + +#include + +// Any options not explicitly set in mpconfigport.h will get default +// values below. + +// Whether to collect memory allocation stats +#ifndef MICROPY_MEM_STATS +#define MICROPY_MEM_STATS (1) +#endif diff --git a/stm/Makefile b/stm/Makefile index 018d31f49..d6c77e2bd 100644 --- a/stm/Makefile +++ b/stm/Makefile @@ -187,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/mpconfig.h b/stm/mpconfig.h deleted file mode 100644 index 1f9529e11..000000000 --- a/stm/mpconfig.h +++ /dev/null @@ -1,19 +0,0 @@ -// options to control how Micro Python is built - -#define MICROPY_ENABLE_FLOAT (1) -#define MICROPY_EMIT_CPYTHON (0) -#define MICROPY_EMIT_X64 (0) -#define MICROPY_EMIT_THUMB (1) -#define MICROPY_EMIT_INLINE_THUMB (1) - -// type definitions for the specific machine - -#define BYTES_PER_WORD (4) - -typedef int32_t machine_int_t; // must be pointer size -typedef uint32_t machine_uint_t; // must be pointer size -typedef void *machine_ptr_t; // must be of pointer size -typedef const void *machine_const_ptr_t; // must be of pointer size -typedef float machine_float_t; - -machine_float_t machine_sqrt(machine_float_t x); diff --git a/stm/mpconfigport.h b/stm/mpconfigport.h new file mode 100644 index 000000000..4cea332f3 --- /dev/null +++ b/stm/mpconfigport.h @@ -0,0 +1,21 @@ +#include + +// options to control how Micro Python is built + +#define MICROPY_ENABLE_FLOAT (1) +#define MICROPY_EMIT_CPYTHON (0) +#define MICROPY_EMIT_X64 (0) +#define MICROPY_EMIT_THUMB (1) +#define MICROPY_EMIT_INLINE_THUMB (1) + +// type definitions for the specific machine + +#define BYTES_PER_WORD (4) + +typedef int32_t machine_int_t; // must be pointer size +typedef uint32_t machine_uint_t; // must be pointer size +typedef void *machine_ptr_t; // must be of pointer size +typedef const void *machine_const_ptr_t; // must be of pointer size +typedef float machine_float_t; + +machine_float_t machine_sqrt(machine_float_t x); diff --git a/unix/Makefile b/unix/Makefile index 271cf2265..fd5b6b43e 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -79,7 +79,7 @@ $(BUILD)/%.o: %.c $(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)/emitnx64.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h @@ -92,7 +92,7 @@ $(BUILD)/emitnthumb.o: $(PYSRC)/emitnative.c $(PYSRC)/emit.h $(BUILD)/vm.o: $(PYSRC)/vm.c $(CC) $(CFLAGS) -O3 -c -o $@ $< -$(BUILD)/main.o: mpconfig.h +$(BUILD)/main.o: mpconfigport.h $(BUILD)/parse.o: $(PYSRC)/grammar.h $(BUILD)/compile.o: $(PYSRC)/grammar.h $(BUILD)/emitcpy.o: $(PYSRC)/emit.h diff --git a/unix/mpconfig.h b/unix/mpconfig.h deleted file mode 100644 index 3d0dc8a56..000000000 --- a/unix/mpconfig.h +++ /dev/null @@ -1,31 +0,0 @@ -// options to control how Micro Python is built - -#define MICROPY_ENABLE_FLOAT (1) -#define MICROPY_EMIT_CPYTHON (0) -#define MICROPY_EMIT_X64 (1) -#define MICROPY_EMIT_THUMB (0) -#define MICROPY_EMIT_INLINE_THUMB (0) - -// type definitions for the specific machine - -#ifdef __LP64__ -typedef long machine_int_t; // must be pointer size -typedef unsigned long machine_uint_t; // must be pointer size -#define UINT_FMT "%lu" -#define INT_FMT "%ld" -#else -// These are definitions for machines where sizeof(int) == sizeof(void*), -// regardless for actual size. -typedef int machine_int_t; // must be pointer size -typedef unsigned int machine_uint_t; // must be pointer size -#define UINT_FMT "%u" -#define INT_FMT "%d" -#endif - -#define BYTES_PER_WORD sizeof(machine_int_t) - -typedef void *machine_ptr_t; // must be of pointer size -typedef const void *machine_const_ptr_t; // must be of pointer size -typedef double machine_float_t; - -machine_float_t machine_sqrt(machine_float_t x); diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h new file mode 100644 index 000000000..3d0dc8a56 --- /dev/null +++ b/unix/mpconfigport.h @@ -0,0 +1,31 @@ +// options to control how Micro Python is built + +#define MICROPY_ENABLE_FLOAT (1) +#define MICROPY_EMIT_CPYTHON (0) +#define MICROPY_EMIT_X64 (1) +#define MICROPY_EMIT_THUMB (0) +#define MICROPY_EMIT_INLINE_THUMB (0) + +// type definitions for the specific machine + +#ifdef __LP64__ +typedef long machine_int_t; // must be pointer size +typedef unsigned long machine_uint_t; // must be pointer size +#define UINT_FMT "%lu" +#define INT_FMT "%ld" +#else +// These are definitions for machines where sizeof(int) == sizeof(void*), +// regardless for actual size. +typedef int machine_int_t; // must be pointer size +typedef unsigned int machine_uint_t; // must be pointer size +#define UINT_FMT "%u" +#define INT_FMT "%d" +#endif + +#define BYTES_PER_WORD sizeof(machine_int_t) + +typedef void *machine_ptr_t; // must be of pointer size +typedef const void *machine_const_ptr_t; // must be of pointer size +typedef double machine_float_t; + +machine_float_t machine_sqrt(machine_float_t x); -- cgit v1.2.3