[pypy-svn] r34907 - in pypy/branch/mininal-c-backend/pypy/translator: c c/src goal
ale at codespeak.net
ale at codespeak.net
Thu Nov 23 16:18:52 CET 2006
Author: ale
Date: Thu Nov 23 16:18:50 2006
New Revision: 34907
Added:
pypy/branch/mininal-c-backend/pypy/translator/goal/targetreallynopstandalone.py
- copied, changed from r34885, pypy/branch/mininal-c-backend/pypy/translator/goal/targetnopstandalone.py
Modified:
pypy/branch/mininal-c-backend/pypy/translator/c/genc.py
pypy/branch/mininal-c-backend/pypy/translator/c/src/g_include.h
pypy/branch/mininal-c-backend/pypy/translator/c/src/g_prerequisite.h
pypy/branch/mininal-c-backend/pypy/translator/c/src/ll_math.h
pypy/branch/mininal-c-backend/pypy/translator/c/src/main.h
pypy/branch/mininal-c-backend/pypy/translator/c/src/standalone.h
Log:
to compile to avr architecture use
python translate.py --batch --cc=avr-gcc --gc=none --vanilla targetreallynopstandalone.py
Unfortunately this generates more code than avr accomodates - so it compiles but can't link :-(
Modified: pypy/branch/mininal-c-backend/pypy/translator/c/genc.py
==============================================================================
--- pypy/branch/mininal-c-backend/pypy/translator/c/genc.py (original)
+++ pypy/branch/mininal-c-backend/pypy/translator/c/genc.py Thu Nov 23 16:18:50 2006
@@ -275,6 +275,8 @@
if self.config.translation.cc:
cc = self.config.translation.cc
+# if cc == 'avr-gcc':
+# compiler.compile_extra.append('-DAVR')
else:
cc = 'gcc'
Modified: pypy/branch/mininal-c-backend/pypy/translator/c/src/g_include.h
==============================================================================
--- pypy/branch/mininal-c-backend/pypy/translator/c/src/g_include.h (original)
+++ pypy/branch/mininal-c-backend/pypy/translator/c/src/g_include.h Thu Nov 23 16:18:50 2006
@@ -16,8 +16,12 @@
#include "src/mem.h"
#include "src/exception.h"
-#include "src/trace.h"
#include "src/support.h"
+#ifndef AVR
+#include "src/trace.h"
+#else
+ #define PY_LONG_LONG long long
+#endif
#ifndef PYPY_STANDALONE
# include "src/module.h"
@@ -26,9 +30,11 @@
#include "src/int.h"
#include "src/char.h"
-#include "src/unichar.h"
#include "src/float.h"
+#ifndef AVR
+#include "src/unichar.h"
#include "src/address.h"
+#endif
#include "src/instrument.h"
@@ -40,6 +46,7 @@
/*** modules ***/
#ifdef HAVE_RTYPER /* only if we have an RTyper */
# include "src/rtyper.h"
+#ifndef AVR
# include "src/ll_os.h"
# include "src/ll_time.h"
# include "src/ll_math.h"
@@ -48,8 +55,11 @@
# include "src/ll_thread.h"
# endif
#endif
+#endif
+#ifndef AVR
#include "src/stack.h"
+#endif
#ifdef PYPY_STANDALONE
# include "src/main.h"
Modified: pypy/branch/mininal-c-backend/pypy/translator/c/src/g_prerequisite.h
==============================================================================
--- pypy/branch/mininal-c-backend/pypy/translator/c/src/g_prerequisite.h (original)
+++ pypy/branch/mininal-c-backend/pypy/translator/c/src/g_prerequisite.h Thu Nov 23 16:18:50 2006
@@ -6,10 +6,12 @@
* executables (which are *not* linked against CPython then),
* to get the convenient macro definitions
*/
+#ifndef AVR
#include "Python.h"
#include "thread.h" /* needs to be included early to define the
struct RPyOpaque_ThreadLock */
+#endif
#include <stddef.h>
Modified: pypy/branch/mininal-c-backend/pypy/translator/c/src/ll_math.h
==============================================================================
--- pypy/branch/mininal-c-backend/pypy/translator/c/src/ll_math.h (original)
+++ pypy/branch/mininal-c-backend/pypy/translator/c/src/ll_math.h Thu Nov 23 16:18:50 2006
@@ -9,6 +9,7 @@
/* xxx macro from pyport.h, at some point define our owns */
/* xxx this 2.3 name is later deprecated */
+#include <errno.h>
#define LL_MATH_SET_ERANGE_IF_MATH_ERROR Py_SET_ERANGE_IF_OVERFLOW
#define LL_MATH_ERROR_RESET errno = 0
Modified: pypy/branch/mininal-c-backend/pypy/translator/c/src/main.h
==============================================================================
--- pypy/branch/mininal-c-backend/pypy/translator/c/src/main.h (original)
+++ pypy/branch/mininal-c-backend/pypy/translator/c/src/main.h Thu Nov 23 16:18:50 2006
@@ -37,8 +37,10 @@
exitcode = STANDALONE_ENTRY_POINT(list);
if (RPyExceptionOccurred()) {
/* fish for the exception type, at least */
+#ifndef AVR
fprintf(stderr, "Fatal PyPy error: %s\n",
RPyFetchExceptionType()->ov_name->items);
+#endif
exitcode = 1;
}
return exitcode;
@@ -46,7 +48,9 @@
memory_out:
errmsg = "out of memory";
error:
+#ifndef AVR
fprintf(stderr, "Fatal error during initialization: %s\n", errmsg);
+#endif
return 1;
}
Modified: pypy/branch/mininal-c-backend/pypy/translator/c/src/standalone.h
==============================================================================
--- pypy/branch/mininal-c-backend/pypy/translator/c/src/standalone.h (original)
+++ pypy/branch/mininal-c-backend/pypy/translator/c/src/standalone.h Thu Nov 23 16:18:50 2006
@@ -5,7 +5,11 @@
#include <math.h>
#ifndef PYPY_NOT_MAIN_FILE
-
+#ifdef AVR
+ #ifndef NO_OBMALLOC
+ #define NO_OBMALLOC
+ #endif
+#endif
#ifdef NO_OBMALLOC
void *PyObject_Malloc(size_t n) { return malloc(n); }
void *PyObject_Realloc(void *p, size_t n) { return realloc(p, n); }
More information about the Pypy-commit
mailing list