Anonymous avatar Anonymous committed cf8deb5

#116: Mainlining directly

Comments (0)

Files changed (4)

 :Author:    Dean Hall
 :Copyright: Copyright 2002 Dean Hall.
             See `License`_ for details.
-:Release:   04
+:Release:   05
 :Site:      http://pymite.python-hosting.com/
 :Id:        $Id: README 116 2006-08-24 13:42:09Z dwhall $
 
 PyMite is a flyweight Python interpreter written from scratch to execute
 on 8-bit and larger microcontrollers with resources as limited as 64 KiB
 of program memory (flash) and 4 KiB of RAM. PyMite supports a subset of
-the Python syntax and can execute a subset of the Python bytecodes.
+the Python 2.5 syntax and can execute a subset of the Python 2.5 bytecodes.
 PyMite can also be compiled, tested and executed on a desktop computer.
 
 License
 
 To build for AVR targets like the ATmega103 (refer to the Makefile for others):
 
-    1. In the project root, run ``make clean; make check TARGET=AVR``
-       to make an executable for ``src/tests/t003.*``
+    1. In the project root, run ``make clean; make TARGET=AVR``
+    2. In ``src/sample/avr`` run ``make`` to build a sample program for the AVR.
 
 The development system should have installed the GNU Compiler
-Collection version 3.4 or later and Python 2.4 or later.
+Collection version 3.4 or later and Python 2.5 or later.
 The author also uses avr-gcc to target Atmel AVR microcontrollers.
 
 PyMite is developed on Mac OS X and should also compile on
 When compiling for the AVR, it will need avr-libc.
 
 PyMite builds as an archive.  The user should then build his
-own main() function following examples in ``src/samples/`` and link in
+own main() function following examples in ``src/sample/`` and link to
 ``libpmvm.a`` and the appropriate PyMite native libraries.
 
 Discussion
 
 My personal thanks go out to these people for their contribution to PyMite:
 
+    - Philipp Adelt: Threading, enhancements to pmImgCreator.py, issues and
+      fixes.
     - Josh Lifton: Used PyMite in PhD work, donated many code fixes and tests.
-    - Philipp Adelt: Enhancements to pmImgCreator.py, issues and fixes.
     - www.webfaction.com: for providing quality, free project hosting on
       www.python-hosting.com
 
 Release Notes
 -------------
 
-This is PyMite release 04
+This is PyMite release 05
+
+* Release 05, 2007/05/10
+
+    - #116: Created Release 05 package
+    - #109: Created check to ensure stack is empty after RETURN_VALUE pops last 
+      item
+    - #114: Created platform file for Atmel's ARM7
+    - #112: Forced Dict keys to be of hashable type
+    - #105: Moved OBJ_TYPE_THR to some value before OBJ_TYPE_HASHABLE_MAX
+    - #108: Cleaned up *_POWER bytecodes
+    - #113: Fixed the implementation of builtin map()
+    - #68:  Cleaned up code to meet standards
+    - #102: Implemented the remaining IMPORT_ bytecodes
+    - #46:  Finalized design of string objects
+    - #69:  Fixed bitwise operators to prevent automatic promotion
+    - #32:  Used GNU indent for code formatting
+    - #64:  Renamed MEMSPACE_FLASH to MEMSPACE_PROGMEM
+    - #85:  Created new avr sample project
+    - #100: Removed od_const bit from object descriptor
+    - #103: Implemented obj_print() for other object types
+    - #98:  Fixed writing image file for win32 target
+    - #99:  Designed a way for ipm to be able to receive images larger than 
+      HEAP_MAX_CHUNK_SIZE
+    - #90:  Created new lib function to return system time
+    - #63:  Created mmb sample project
+    - #91:  Fixed vm so that error codes are returned by the main() function
+    - #93:  Changed ifdef from TARGET_DESKTOP to a debug-oriented definition 
+      where it is appropriate
+    - #70:  Fixed incorrect exception for chr('a')
+    - #96:  Created library function to spawn a new thread
+    - #82:  Fixed namespace issue
+    - #95:  Fixed sys.heap() so it doesn't overwrite the static const 0 integer 
+      obj
+    - #94:  Fixed integer loading from image so it re-uses static ints (-1,0,1).
+    - #89:  Moved plat module functions into sys module
+    - #88:  Created library function to return heap stats
+    - #84:  Fixed bus error when using ipm
+    - #87:  Redesigned the heap
+    - #86:  Moved as much platform-specific code to the platform implementation 
+      file
+    - #83:  Updated documentation to reflect new size requirement
+    - #74:  Added to pmImgCreator a filter to catch constants of unsupported 
+      types
+    - #65:  Created plat module with put and get routines
+    - #71:  Added support for builtin function eval()
+    - #80:  Fixed DUP_TOPX bytecode
+    - #81:  Implemented list_setItem()
+    - #67:  Created interactive interface
+    - #78:  Fixed import module yields None
+    - #76:  Printed always escapes special characters and puts quotes around it
+    - #75:  Supported multiple (green) threads inside PyMite
 
 * Release 04, 2006/12/14
 

docs/src/HowToReleasePyMite.txt

         - ``make html``
         - ``make TAGS``
         - ``make check``
-        - ``make clean; make TARGET=AT91SAM7S``
-        - ``cd src/sample/at91sam7s; make``
+        - ``make clean; make TARGET=AT91SAM7``
+        - ``cd src/sample/at91sam7; make``
         - ``cd ../../..; make clean; make TARGET=AVR``
         - ``cd src/sample/avr; make; cd ../../..``
         - Record the size of the AVR sample app in the ticket

src/vm/plat/at91sam7.c

+/*
+ * PyMite - A flyweight Python interpreter for 8-bit microcontrollers and more.
+ * Copyright 2007 Dean Hall
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#undef __FILE_ID__
+#define __FILE_ID__ 0x52
+
+/**
+ * PyMite platform-specific routines for ARM7 target
+ *
+ * Log
+ * ---
+ *
+ * 2007/04/29   #114: Create platform file for ARM
+ */
+
+#include "../pm.h"
+
+#include "AT91SAM7S64.h"
+#include "lib_AT91SAM7S64.h"
+
+
+/***************************************************************
+ * Constants
+ **************************************************************/
+
+#define RTTC_INTERRUPT_LEVEL 0
+
+/** 200 ms for 48 MHz */
+#define PIV_200_MS 600000  
+
+
+/***************************************************************
+ * Functions
+ **************************************************************/
+
+static void
+at91sam7_pit_handler(void)
+{
+    PmReturn_t retval;
+
+    retval = pm_vmPeriodic(200);
+    PM_REPORT_IF_ERROR(retval);
+}
+
+
+PmReturn_t
+plat_init(void)
+{
+    /* Configure PIT interrupt */
+    AT91F_AIC_ConfigureIt(AT91C_BASE_AIC,
+                          AT91C_ID_SYS,
+                          RTTC_INTERRUPT_LEVEL,
+                          AT91C_AIC_SRCTYPE_EXT_POSITIVE_EDGE,
+                          (void*)at91sam7_pit_handler);
+
+    /* Enable PIT interrupt */
+    AT91C_BASE_PITC->PITC_PIMR = AT91C_PITC_PITEN
+                                 | AT91C_PITC_PITIEN
+                                 | PIV_200_MS;
+    AT91F_AIC_EnableIt(AT91C_BASE_AIC, AT91C_ID_SYS);
+
+    return PM_RET_OK;
+}
+
+
+/*
+ * Gets a byte from the address in the designated memory space
+ * Post-increments *paddr.
+ */
+uint8_t
+plat_memGetByte(PmMemSpace_t memspace, uint8_t const **paddr)
+{
+    uint8_t b = 0;
+
+    switch (memspace)
+    {
+        case MEMSPACE_RAM:
+        case MEMSPACE_PROG:
+            b = **paddr;
+            *paddr += 1;
+            return b;
+
+        case MEMSPACE_EEPROM:
+        case MEMSPACE_SEEPROM:
+        case MEMSPACE_OTHER0:
+        case MEMSPACE_OTHER1:
+        case MEMSPACE_OTHER2:
+        case MEMSPACE_OTHER3:
+        default:
+            return 0;
+    }
+}
+
+
+/* ARM7 target shall use stdio for I/O routines */
+PmReturn_t
+plat_getByte(uint8_t *b)
+{
+    int c;
+    PmReturn_t retval = PM_RET_OK;
+
+    c = getchar();
+    *b = c & 0xFF;
+
+    if (c == EOF)
+    {
+        PM_RAISE(retval, PM_RET_EX_IO);
+    }
+
+    return retval;
+}
+
+
+/* ARM7 target shall use stdio for I/O routines */
+PmReturn_t
+plat_putByte(uint8_t b)
+{
+    int i;
+    PmReturn_t retval = PM_RET_OK;
+
+    i = putchar(b);
+    fflush(stdout);
+
+    if ((i != b) || (i == EOF))
+    {
+        PM_RAISE(retval, PM_RET_EX_IO);
+    }
+
+    return retval;
+}
+
+
+PmReturn_t
+plat_getMsTicks(uint32_t *r_ticks)
+{
+    /* TODO: make access atomic */
+    *r_ticks = pm_timerMsTicks;
+    
+    return PM_RET_OK;
+}
+
+
+void 
+plat_reportError(PmReturn_t result)
+{
+}
  * It helps locate a defect when used in conjunction with a fileID
  * and line number.
  */
-#define PM_RELEASE 4
+#define PM_RELEASE 5
 
 
 /***************************************************************
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.