main.c

Go to the documentation of this file.
00001 /*
00002 # This file is Copyright 2007, 2009 Dean Hall.
00003 #
00004 # This file is part of the Python-on-a-Chip program.
00005 # Python-on-a-Chip is free software: you can redistribute it and/or modify
00006 # it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
00007 # 
00008 # Python-on-a-Chip is distributed in the hope that it will be useful,
00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00011 # A copy of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
00012 # is seen in the file COPYING up one directory from this.
00013 */
00014 
00020 #include "pm.h"
00021 #include "pic24_all.h"
00022 
00023 extern unsigned char usrlib_img[];
00024 
00025 int main(void)
00026 {
00027     PmReturn_t retval;
00028 
00029     retval = pm_init(MEMSPACE_PROG, usrlib_img);
00030     printf("Python initialized; result was 0x%02x.\n", retval);
00031     PM_RETURN_IF_ERROR(retval);
00032 
00033     printf("Running Python...\n");
00034     retval = pm_run((uint8_t *)"main");
00035 
00036     printf("\n\nPython finished, return of 0x%02x.\nResetting...\n\n", retval);
00037     // Wait a bit, so reset so flash by too fast.
00038     DELAY_MS(1000);
00039     asm("reset");
00040 
00041     return (int)retval;
00042 }

Generated on Mon Oct 18 07:40:46 2010 for Python-on-a-chip by  doxygen 1.5.9