Commits

Anonymous committed e33e81e

issue #12 mainlined directly

Comments (0)

Files changed (25)

docs/src/HowToPortPyMite.txt

 
 - Copy an existing platform directory that most closely resembles the new target
   platform.  For the rest of this document, the new directory is referred to as
-  ``<plat>``.  The core files needed for the port are ``main.c``, ``plat.c``
-  and ``Makefile``.  Other files that might be useful are `` main.py`` and
-  ``SConscript``.  Remove all the extraneous files.
+  ``<plat>``.  The core files needed for the port are ``main.c``, ``plat.c``,
+  ``pmfeatures.h`` and ``Makefile``.  Other files that might be useful are
+  `` main.py`` and ``SConscript``.  Remove all the extraneous files.
+
+- Edit ``pmfeatures.h`` to include the features that you want the VM to have.
+  Set the size of the platform's heap in ``PM_HEAP_SIZE`` and be sure
+  to leave enough RAM for the C stack.
 
 - Edit the build environment so that it builds the PyMite library,
   ``../../vm/libpmvm_<plat>.a``, and links it to ``main.c``, ``plat.c``
       PM_LIB_FN = lib$(PM_LIB_ROOT).a
       PM_LIB_PATH = ../../vm/$(PM_LIB_FN)
       PM_USR_SOURCES = main.py
-      PM_HEAP_SIZE = 0x3000
       PMIMGCREATOR := ../../tools/pmImgCreator.py
-      PM_UART_BAUD = 19200
       TARGET = main
       SRC = $(TARGET).c plat.c $(TARGET)_nat.c $(TARGET)_img.c
 
-      # PyMite: CDEFS
-      CDEFS += -DHEAP_SIZE=$(PM_HEAP_SIZE) -DUART_BAUD=$(PM_UART_BAUD)
+      # PyMite: CFLAGS
       ifeq ($(DEBUG),true)
           CDEFS += -g -gstabs -D__DEBUG__=1
       endif
+      CINCS += -I$(abspath .)
+      CFLAGS += $(CDEFS) $(CINCS)
 
       # Define the toolchain
       CC = arm-elf-gcc
       .PHONY : pmvm
 
       # PyMite: Export these env variables so the Makefile in ../../vm gets them
-      export CC OBJCOPY NM CFLAGS ALL_CFLAGS AR IPM PM_HEAP_SIZE PM_LIB_FN
+      export CC OBJCOPY NM CFLAGS ALL_CFLAGS AR IPM PM_LIB_FN
 
       # PyMite: Append these intermediate files to the list of things to clean
       clean :
     PmReturn_t retval;
     pPmObj_t pimg;
     pPmObj_t pco;
-    uint8_t const *imgaddr;
 
     /* If wrong number of args, raise TypeError */
     if (NATIVE_GET_NUM_ARGS() != 1)
     }
 
     /* Create a code object from the image */
-    imgaddr = (uint8_t *)&((pPmString_t)pimg)->val;
     retval = obj_loadFromImgObj(pimg, &pco);
     PM_RETURN_IF_ERROR(retval);
 
     PM_RETURN_IF_ERROR(retval);
 
     /* Get the maximum heap size */
-    retval = int_new(HEAP_SIZE, &pmax);
+    retval = int_new(PM_HEAP_SIZE, &pmax);
     PM_RETURN_IF_ERROR(retval);
 
     /* Allocate an int to hold the amount of heap available */

src/platform/at91sam7s-ek/Makefile

 PM_LIB_FN = lib$(PM_LIB_ROOT).a
 PM_LIB_PATH = ../../vm/$(PM_LIB_FN)
 PM_USR_SOURCES = main.py
-PM_HEAP_SIZE = 0x3000
 PMIMGCREATOR := ../../tools/pmImgCreator.py
-PM_UART_BAUD = 19200
 
 FLASH_TOOL = SAM7UTILS
 #FLASH_TOOL = UVISION
 # Place -D or -U options here
 CDEFS =  -D$(RUN_MODE)
 # PyMite CDEFS
-CDEFS += -DHEAP_SIZE=$(PM_HEAP_SIZE) -DUART_BAUD=$(PM_UART_BAUD)
 ifeq ($(DEBUG),true)
 	CDEFS += -g -g$(DEBUG_FMT) -D__DEBUG__=1
 endif
 
 # Place -I options here
-CINCS =
+CINCS = -I$(abspath .)
 
 # Place -D or -U options for ASM here
 ADEFS =  -D$(RUN_MODE)
 build elf hex bin lss sym clean clean_list program pmvm
 
 
-export CC OBJCOPY NM CFLAGS ALL_CFLAGS AR IPM PM_HEAP_SIZE PM_LIB_FN
+export CC OBJCOPY NM CFLAGS ALL_CFLAGS AR IPM PM_LIB_FN

src/platform/at91sam7s-ek/SConscript

 
 Import("vars")
 
-vars.Add("PM_HEAP_SIZE", "Size of the VM's heap.", 0x3000)
-vars.Add("PM_UART_BAUD", "Baud rate of the ipm serial connection.", 19200)
 vars.Add("IPM", "Add the interactive library to the standard lib", True)
 vars.Add("MCU", "Type of ARM device; the arg to -mmcu.", "arm7tdmi")
 vars.Add("SUBMDL", "The sub-model of ARM device.", "AT91SAM7S64")
 vars.Add("OBJDUMP", "", "arm-elf-objdump")
 vars.Add("SIZE", "", "arm-elf-size")
 
-CFLAGS = "-DHEAP_SIZE=$PM_HEAP_SIZE -DUART_BAUD=$PM_UART_BAUD -DROM_RUN" \
+CFLAGS = "-DROM_RUN" \
          " -Wall -Wimplicit -Wpointer-arith -Wswitch" \
          " -Wredundant-decls -Wreturn-type -Wshadow -Wunused" \
          " -mcpu=$MCU -Os -std=gnu99 -Wall -gstabs -Werror"
 PM_LIB_ROOT = ["pmvm_%s" % vars.args["PLATFORM"]]
 
 envarm = Environment(variables = vars,
-                     CPPPATH = "../../vm",
+                     CPPPATH = ["#src/vm", "#src/platform/at91sam7s-ek"],
                      CC = "arm-elf-gcc",
                      CCFLAGS = CFLAGS,
                      CXX = "arm-elf-g++",

src/platform/at91sam7s-ek/plat.c

 /** 200 ms for 48 MHz */
 #define PIV_200_MS 600000
 
+/** Baud rate of serial port */
+#define UART_BAUD 19200
+
 
 static AT91S_USART * pusart0 = AT91C_BASE_US0;
 

src/platform/avr/Makefile

 PM_LIB_FN = lib$(PM_LIB_ROOT).a
 PM_LIB_PATH = ../../vm/$(PM_LIB_FN)
 PM_USR_SOURCES = main.py ../../lib/avr.py
-PM_HEAP_SIZE = 0x0D00
 PMIMGCREATOR := ../../tools/pmImgCreator.py
 IPM=false
 
 FORMAT = ihex
 TARGET = main
 F_CPU = 4000000UL
-UART_BAUD = 19200UL
 SRC = $(TARGET).c plat.c $(TARGET)_nat.c $(TARGET)_img.c
 ASRC =
 OPT = s
 CSTANDARD = -std=gnu99
 
 # Place -D or -U options here
-CDEFS = -DF_CPU=$(F_CPU) -DUART_BAUD=$(UART_BAUD)
+CDEFS = -DF_CPU=$(F_CPU)
 # PyMite CDEFS
-CDEFS += -DHEAP_SIZE=$(PM_HEAP_SIZE)
 ifeq ($(DEBUG),true)
 	CDEFS += -g -g$(DEBUG_FMT) -D__DEBUG__=1
 endif
 
 # Place -I options here
-CINCS = -I../../vm
+CINCS = -I../../vm -I$(abspath .)
 
 
 CDEBUG = -g$(DEBUG_FMT)
 
 .PHONY:	all build elf hex eep lss sym program coff extcoff clean depend pmvm
 
-export CC OBJCOPY NM CFLAGS ALL_CFLAGS AR IPM PM_HEAP_SIZE PM_LIB_FN
+export CC OBJCOPY NM CFLAGS ALL_CFLAGS AR IPM PM_LIB_FN

src/platform/avr/SConscript

 
 Import("vars")
 
-vars.Add("PM_HEAP_SIZE", "Size of the VM's heap.", 0x0D00)
-vars.Add("PM_UART_BAUD", "Baud rate of the ipm serial connection.", "19200UL")
 vars.Add("IPM", "Add the interactive library to the standard lib", True)
 vars.Add("MCU", "Type of AVR device; the arg to -mmcu.", "atmega103")
 vars.Add("F_CPU", "Operating frequency of the AVR device.", "4000000UL")
 vars.Add("OBJDUMP", "", "avr-objdump")
 vars.Add("SIZE", "", "avr-size")
 
-CFLAGS = "-DHEAP_SIZE=$PM_HEAP_SIZE -DF_CPU=$F_CPU -DUART_BAUD=$PM_UART_BAUD" \
+CFLAGS = "-DF_CPU=$F_CPU" \
          " -Wall -Wstrict-prototypes -Wimplicit -Werror" \
          " -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums" \
          " -mmcu=$MCU -Os -std=gnu99"
 PM_LIB_ROOT = ["pmvm_%s" % vars.args["PLATFORM"]]
 
 env = Environment(variables = vars,
-                  CPPPATH = "../../vm",
+                  CPPPATH = ["#src/vm", "#src/platform/avr"],
                   CC = "avr-gcc",
                   CCFLAGS = CFLAGS,
                   CXX = "avr-g++",

src/platform/avr/plat.c

 #include "pm.h"
 
 
+#define UART_BAUD 19200UL
+
+
 /**
  * When defined, the AVR target configures Timer/Counter0 to generate an
  * overflow interrupt to call pm_vmPeriodic().

src/platform/desktop/Makefile

 SOURCES = $(TARGET).c plat.c $(TARGET)_nat.c $(TARGET)_img.c
 OBJS = $(SOURCES:.c=.o)
 
-CDEFS = -DHEAP_SIZE=$(PM_HEAP_SIZE)
 ifeq ($(DEBUG),true)
 	CDEFS += -g -ggdb -D__DEBUG__=1
 endif
-CFLAGS = -Os -Wall -gstabs -Wstrict-prototypes -Werror -I../../vm $(CDEFS)
+CINCS = -I$(abspath .)
+CFLAGS = -Os -Wall -gstabs -Wstrict-prototypes -Werror -I../../vm $(CDEFS) $(CINCS)
 
-export CFLAGS IPM HEAP_SIZE PM_LIB_FN
+export CFLAGS IPM PM_LIB_FN
 
 
 .PHONY: all clean

src/platform/desktop/SConscript

 Import("vars")
 
-vars.Add("HEAP_SIZE", "Size of the VM's heap.", 0x2000)
 vars.Add("IPM", "Add the interactive library to the standard lib", True)
 
-CFLAGS = "-DHEAP_SIZE=$HEAP_SIZE " \
-         "-Os -Wall -gstabs -Wstrict-prototypes -Werror"
+CFLAGS = "-Os -Wall -gstabs -Wstrict-prototypes -Werror"
 if "DEBUG" in vars.args.keys():
     CFLAGS = "-g -ggdb -D__DEBUG__=1 " + CFLAGS
 SOURCES = ["main.c", "plat.c"]
 PM_LIB_ROOT = ["pmvm_%s" % vars.args["PLATFORM"]]
 
 env = Environment(variables = vars,
-                  CPPPATH = "../../vm",
+                  CPPPATH = ["#src/vm", "#src/platform/desktop"],
                   CCFLAGS = CFLAGS)
 
 vmlib = SConscript(["../../vm/SConscript"], ["env", "vars"])

src/platform/mbed/Makefile

 PM_LIB_FN = lib$(PM_LIB_ROOT).a
 PM_LIB_PATH = ../../vm/$(PM_LIB_FN)
 PM_USR_SOURCES = main.py plat.py
-PM_HEAP_SIZE = 0x7000
 PMIMGCREATOR := ../../tools/pmImgCreator.py
-PM_UART_BAUD = 19200
 IPM := true
 
 # Toolchain prefix (i.e arm-elf -> arm-elf-gcc.exe)
 # Place -D or -U options for C here
 CDEFS =  -D$(RUN_MODE)
 # PyMite CDEFS
-CDEFS += -DHEAP_SIZE=$(PM_HEAP_SIZE) -DUART_BAUD=$(PM_UART_BAUD)
 ifeq ($(DEBUG),true)
 	CDEFS += -g -g$(DEBUG_FMT) -D__DEBUG__=1
 endif
 
 # Place -I options here
-CINCS =
+CINCS = -I$(abspath .)
 
 # Place -D or -U options for ASM here
 ADEFS =  -D$(RUN_MODE)
 build elf hex bin lss sym clean clean_list program pmvm zip
 
 
-export CC OBJCOPY NM CFLAGS ALL_CFLAGS AR IPM PM_HEAP_SIZE PM_LIB_FN
+export CC OBJCOPY NM CFLAGS ALL_CFLAGS AR IPM PM_LIB_FN

src/platform/mmb103/Makefile

 PM_LIB_FN = lib$(PM_LIB_ROOT).a
 PM_LIB_PATH = ../../vm/$(PM_LIB_FN)
 PM_USR_SOURCES = main.py mmb.py
-PM_HEAP_SIZE = 0x0D00
 PMIMGCREATOR := ../../tools/pmImgCreator.py
 IPM=false
 
 FORMAT = ihex
 TARGET = main
 F_CPU = 4000000UL
-UART_BAUD = 19200UL
 SRC = $(TARGET).c plat.c $(TARGET)_nat.c $(TARGET)_img.c
 ASRC =
 OPT = s
 CSTANDARD = -std=gnu99
 
 # Place -D or -U options here
-CDEFS = -DF_CPU=$(F_CPU) -DUART_BAUD=$(UART_BAUD)
+CDEFS = -DF_CPU=$(F_CPU)
 # PyMite CDEFS
-CDEFS += -DHEAP_SIZE=$(PM_HEAP_SIZE)
 ifeq ($(DEBUG),true)
 	CDEFS += -g -g$(DEBUG_FMT) -D__DEBUG__=1
 endif
 
 # Place -I options here
-CINCS = -I../../vm
+CINCS = -I../../vm -I$(abspath .)
 
 
 CDEBUG = -g$(DEBUG_FMT)
 
 # Target: clean project.
 clean:
+	$(MAKE) -C ../../vm clean
 	$(REMOVE) $(TARGET).hex $(TARGET).eep $(TARGET).cof $(TARGET).elf \
 	$(TARGET).map $(TARGET).sym $(TARGET).lss \
 	$(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d)
 
 .PHONY:	all build elf hex eep lss sym program coff extcoff clean depend pmvm
 
-export CC OBJCOPY NM CFLAGS ALL_CFLAGS AR IPM PM_HEAP_SIZE PM_LIB_FN
+export CC OBJCOPY NM CFLAGS ALL_CFLAGS AR IPM PM_LIB_FN

src/platform/mmb103/SConscript

 
 Import("vars")
 
-vars.Add("PM_HEAP_SIZE", "Size of the VM's heap.", 0x0D00)
-vars.Add("PM_UART_BAUD", "Baud rate of the ipm serial connection.", "19200UL")
 vars.Add("IPM", "Add the interactive library to the standard lib", True)
 vars.Add("MCU", "Type of AVR device; the arg to -mmcu.", "atmega103")
 vars.Add("F_CPU", "Operating frequency of the AVR device.", "4000000UL")
 vars.Add("OBJDUMP", "", "avr-objdump")
 vars.Add("SIZE", "", "avr-size")
 
-CFLAGS = "-DHEAP_SIZE=$PM_HEAP_SIZE -DF_CPU=$F_CPU -DUART_BAUD=$PM_UART_BAUD" \
+CFLAGS = "-DF_CPU=$F_CPU" \
          " -Wall -Wstrict-prototypes -Wimplicit -Werror" \
          " -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums" \
          " -mmcu=$MCU -Os -std=gnu99"
 PM_LIB_ROOT = ["pmvm_%s" % vars.args["PLATFORM"]]
 
 env = Environment(variables = vars,
-                  CPPPATH = "../../vm",
+                  CPPPATH = ["#src/vm", "#src/platform/mmb103"],
                   CC = "avr-gcc",
                   CCFLAGS = CFLAGS,
                   CXX = "avr-g++",

src/platform/mmb103/plat.c

 #include "pm.h"
 
 
+#define UART_BAUD 19200UL
+
 /**
  * When defined, the AVR target configures Timer/Counter0 to generate an
  * overflow interrupt to call pm_vmPeriodic().

src/tests/system/Makefile

 PM_LIB_FN = lib$(PM_LIB_ROOT).a
 PM_LIB_PATH = ../../vm/$(PM_LIB_FN)
 PM_USR_SOURCES = $(SOURCES:.c=.py)
-PM_HEAP_SIZE = 0x2000
 PMIMGCREATOR := ../../tools/pmImgCreator.py
 DEBUG = false
 
 IMG_SOURCES = $(subst .py,_img.c, $(PM_USR_SOURCES))
 NAT_SOURCES = $(subst .py,_nat.c, $(PM_USR_SOURCES))
 
-CDEFS = -DHEAP_SIZE=$(PM_HEAP_SIZE)
 ifeq ($(DEBUG),true)
 	CDEFS += -g -ggdb -D__DEBUG__=1
 endif
-CFLAGS = -Os -Wall -Wstrict-prototypes -Werror $(CDEFS) -I../../vm
+CINCS = -I../../vm -I$(abspath .)
+CFLAGS = -Os -Wall -Wstrict-prototypes -Werror $(CDEFS) $(CINCS) 
 
 
 # Build an executable from the C sources
 
 .PHONY: all check clean
 
-export CFLAGS HEAP_SIZE PM_LIB_FN
+export CFLAGS PM_LIB_FN
 
 # Default action is to build tests; run tests if target is desktop
 all : check

src/tests/system/SConscript

 
 vars = Variables()
 vars.args["PLATFORM"] = "check"
-vars.Add("PM_HEAP_SIZE", "Size of the VM's heap.", 0x2000)
 vars.Add("IPM", "Add the interactive library to the standard lib", True)
 
 CFLAGS = "-g -ggdb -D__DEBUG__=1 -DHEAP_SIZE=$PM_HEAP_SIZE " \
 PM_LIB_ROOT = ["pmvm_%s" % vars.args["PLATFORM"]]
 
 env = Environment(variables = vars,
-                  CPPPATH = "../../vm",
+                  CPPPATH = ["#src/vm", "#src/tests/system/"],
                   CCFLAGS = CFLAGS)
 
 vmlib = SConscript(["../../vm/SConscript"], ["env", "vars"])

src/tests/unit/Makefile

 PM_LIB_ROOT = pmvm_$(PLATFORM)
 PM_LIB_FN = lib$(PM_LIB_ROOT).a
 PM_LIB_PATH = ../../vm/$(PM_LIB_FN)
-PM_HEAP_SIZE = 0x2000
 DEBUG = true
 
 UT_SOURCES = $(wildcard ut*.c)
 OBJS = $(ALL_SOURCES:.c=.o)
 PRODUCT = runTests.out
 
-CDEFS = -DHEAP_SIZE=$(PM_HEAP_SIZE)
 ifeq ($(DEBUG),true)
 	CDEFS += -g -ggdb -D__DEBUG__=1
 endif
-CFLAGS = -I../../vm $(CDEFS)
+CINCS = -I../../vm -I$(abspath .)
+CFLAGS = $(CDEFS) $(CINCS) 
 
 .PHONY: all check clean $(PRODUCT)
 
-export CFLAGS IPM HEAP_SIZE PM_LIB_FN
+export CFLAGS IPM PM_LIB_FN
 
 # Default action is to build and run tests
 all : check

src/tools/pmImgCreator.py

 
 
     def _float_to_str(self, f):
-        """Convert the float object, f, to a string of four bytes.
+        """Convert the float object, f, to a string of four bytes
+        in little-endian order.
         """
-        return struct.pack("f", f)
+        return struct.pack("<f", f)
 
 
     def _seq_to_str(self, seq):
 # This Makefile is not meant to be invoked directly.
 # This Makefile is meant to be invoked by a Makefile in src/platform/<plat>/
 # and requires the following environment variables to be exported by the caller:
-#   CC OBJCOPY NM CFLAGS AR IPM PM_HEAP_SIZE PM_LIB_FN
+#   CC OBJCOPY NM CFLAGS AR IPM PM_LIB_FN
 #
 # The primary function of this makefile is to:
 #
 #include "pm.h"
 
 
+/** Checks for heap size definition. */
+#ifndef PM_HEAP_SIZE
+#warning PM_HEAP_SIZE not defined in src/platform/<yourplatform>/pmfeatures.h
+#elif PM_HEAP_SIZE & 3
+#error PM_HEAP_SIZE is not a multiple of four
+#endif
+
+
 /**
  * The maximum size a live chunk can be (a live chunk is one that is in use).
  * The live chunk size is limited by the size field in the *object* descriptor.
      * which is specific to GCC
      */
     /** Global declaration of heap. */
-    uint8_t base[HEAP_SIZE];
+    uint8_t base[PM_HEAP_SIZE];
 
     /** Ptr to list of free chunks; sorted smallest to largest. */
     pPmHeapDesc_t pfreelist;
 
     /** The amount of heap space available in free list */
-#if HEAP_SIZE > 65535
+#if PM_HEAP_SIZE > 65535
     uint32_t avail;
 #else
     uint16_t avail;
     fp = fopen(filename, "wb");
 
     /* Write size of heap */
-    i = HEAP_SIZE;
+    i = PM_HEAP_SIZE;
     fwrite(&i, sizeof(int), 1, fp);
 
     /* Write base address of heap */
     fwrite(&i, sizeof(int *), 1, fp);
 
     /* Write contents of heap */
-    fwrite(&pmHeap.base, 1, HEAP_SIZE, fp);
+    fwrite(&pmHeap.base, 1, PM_HEAP_SIZE, fp);
 
     /* Write num roots*/
     i = 10;
 {
     pPmHeapDesc_t pchunk;
 
-#if HEAP_SIZE > 65535
+#if PM_HEAP_SIZE > 65535
     uint32_t hs;
 #else
     uint16_t hs;
 #endif /* HAVE_GC */
 
     /* Create as many max-sized chunks as possible in the freelist */
-    for (pchunk = (pPmHeapDesc_t)pmHeap.base, hs = HEAP_SIZE;
+    for (pchunk = (pPmHeapDesc_t)pmHeap.base, hs = PM_HEAP_SIZE;
          hs >= HEAP_MAX_FREE_CHUNK_SIZE; hs -= HEAP_MAX_FREE_CHUNK_SIZE)
     {
         OBJ_SET_FREE(pchunk, 1);
 
     /* Ensure the chunk falls within the heap */
     C_ASSERT(((uint8_t *)ptr >= pmHeap.base)
-             && ((uint8_t *)ptr < pmHeap.base + HEAP_SIZE));
+             && ((uint8_t *)ptr < pmHeap.base + PM_HEAP_SIZE));
 
     /* Insert the chunk into the freelist */
     OBJ_SET_FREE(ptr, 1);
 
 
 /* Returns, by reference, the number of bytes available in the heap */
-#if HEAP_SIZE > 65535
+#if PM_HEAP_SIZE > 65535
 uint32_t
 #else
 uint16_t
 
     /* The pointer must be within the heap (native frame is special case) */
     C_ASSERT((((uint8_t *)pobj >= &pmHeap.base[0])
-              && ((uint8_t *)pobj <= &pmHeap.base[HEAP_SIZE]))
+              && ((uint8_t *)pobj <= &pmHeap.base[PM_HEAP_SIZE]))
              || ((uint8_t *)pobj == (uint8_t *)&gVmGlobal.nativeframe));
 
     /* The object must not already be free */
 
     /* Start at the base of the heap */
     pobj = (pPmObj_t)pmHeap.base;
-    while ((uint8_t *)pobj < &pmHeap.base[HEAP_SIZE])
+    while ((uint8_t *)pobj < &pmHeap.base[PM_HEAP_SIZE])
     {
         /* Skip to the next unmarked or free chunk within the heap */
         while (!OBJ_GET_FREE(pobj)
                && (OBJ_GET_GCVAL(pobj) == pmHeap.gcval)
-               && ((uint8_t *)pobj < &pmHeap.base[HEAP_SIZE]))
+               && ((uint8_t *)pobj < &pmHeap.base[PM_HEAP_SIZE]))
         {
             pobj = (pPmObj_t)((uint8_t *)pobj + OBJ_GET_SIZE(pobj));
         }
 
         /* Stop if reached the end of the heap */
-        if ((uint8_t *)pobj >= &pmHeap.base[HEAP_SIZE])
+        if ((uint8_t *)pobj >= &pmHeap.base[PM_HEAP_SIZE])
         {
             break;
         }
                 ((uint8_t *)pchunk + OBJ_GET_SIZE(pchunk));
 
             /* Stop if it's past the end of the heap */
-            if ((uint8_t *)pchunk >= &pmHeap.base[HEAP_SIZE])
+            if ((uint8_t *)pchunk >= &pmHeap.base[PM_HEAP_SIZE])
             {
                 break;
             }
 PmReturn_t heap_freeChunk(pPmObj_t ptr);
 
 /** @return  Return number of bytes available in the heap */
-#if HEAP_SIZE > 65535
+#if PM_HEAP_SIZE > 65535
 uint32_t
 #else
 uint16_t
     }
     v;
 
-    /* PyMite is little endian; get low byte first */
+#ifdef PM_FLOAT_BIG_ENDIAN
     v.c[0] = mem_getByte(memspace, paddr);
     v.c[1] = mem_getByte(memspace, paddr);
     v.c[2] = mem_getByte(memspace, paddr);
     v.c[3] = mem_getByte(memspace, paddr);
 
+#else
+    v.c[3] = mem_getByte(memspace, paddr);
+    v.c[2] = mem_getByte(memspace, paddr);
+    v.c[1] = mem_getByte(memspace, paddr);
+    v.c[0] = mem_getByte(memspace, paddr);
+
+#ifndef PM_FLOAT_LITTLE_ENDIAN
+#warning Neither PM_FLOAT_LITTLE_ENDIAN nor PM_FLOAT_BIG_ENDIAN is defined \
+         for this platform; defaulting to little endian.
+#endif
+#endif
+
     return v.f;
 }
 #endif /* HAVE_FLOAT */
  */
 #define PM_RELEASE 7
 
-/** Static initial size of the heap. */
-#ifndef HEAP_SIZE
-#warning HEAP_SIZE not defined by the build environment, defaulting to 0x7000
-#define HEAP_SIZE 0x7000
-#endif
-#if HEAP_SIZE & 3
-#error HEAP_SIZE is not a multiple of four
-#endif
-
 
 /** null for C code */
 #define C_NULL 0

src/vm/pmfeatures.h

-/*
- * PyMite - A flyweight Python interpreter for 8-bit and larger microcontrollers.
- * Copyright 2002 Dean Hall.  All rights reserved.
- * PyMite is offered through one of two licenses: commercial or open-source.
- * See the LICENSE file at the root of this package for licensing details.
- */
-
-
-/**
- * VM feature configuration
- *
- * Compile time switches to include features or save space.
- *
- * IMPORTANT: All of the HAVE_* items in this file should also exist in the
- * PM_FEATURES dict in src/tools/pmImgCreator.py.  If the item is defined here,
- * the corresponding dict value should be True; False otherwise.
- */
-
-
-#ifndef FEATURES_H_
-#define FEATURES_H_
-
-/**
- * When defined, bytecodes PRINT_ITEM and PRINT_NEWLINE are supported. Along
- * with these, helper routines in the object type are compiled in that allow
- * printing of the object.
- */
-#define HAVE_PRINT
-
-
-/**
- * When defined, the code to perform mark-sweep garbage collection is included
- * in the build and automatic GC is enabled.  When undefined the allocator
- * will distribute memory until none is left, after which a memory exception
- * will occur.
- */
-#define HAVE_GC
-
-
-/* #148 Create configurable float datatype */
-/**
- * When defined, the code to support floating point objects is included
- * in the build.
- */
-/*#define HAVE_FLOAT*/
-
-/**
- * When defined, the code to support the keyword del is included in the build.
- * This involves the bytecodes: DELETE_SUBSCR, DELETE_NAME, DELETE_ATTR,
- * DELETE_GLOBAL and DELETE_FAST.
- */
-#define HAVE_DEL
-
-/**
- * When defined, the code to support the IMPORT_FROM and IMPORT_STAR styles
- * is included in the build.
- */
-#define HAVE_IMPORTS
-
-/**
- * When defined, the code to support the assert statement is included
- * in the build.
- */
-#define HAVE_ASSERT
-
-/* #157 Support default args */
-/**
- * When defined, the code to support default arguments to functions is included
- * in the build.
- */
-#define HAVE_DEFAULTARGS
-
-/* #160 Add support for string and tuple replication */
-/**
- * When defined, the code to support sequence (list, tuple, string) replcation
- * is included in the build.
- * This feature is required by the builtin function __bi.map().
- */
-#define HAVE_REPLICATION
-
-#endif /* FEATURES_H_ */