python-on-a-chip online compiler

Dependencies:   mbed TSI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002 # This file is Copyright 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 
00015 
00016 #include "pm.h"
00017 
00018 #if defined(TARGET_LPC1768)
00019 #define HEAP_SIZE 0x7000
00020 #define USRLIB_IMG (uint8_t*)77824
00021 
00022 #elif defined(TARGET_LPC1549)||defined(TARGET_LPC11U68)
00023 #define HEAP_SIZE 0x7000
00024 #define USRLIB_IMG (uint8_t*)65536
00025 
00026 #elif defined(TARGET_KL46Z)
00027 #define HEAP_SIZE 0x7000
00028 #define USRLIB_IMG (uint8_t*)77824
00029 
00030 #elif defined(TARGET_KL25Z)
00031 #define HEAP_SIZE 0x3400
00032 #define USRLIB_IMG (uint8_t*)77824
00033 
00034 #elif defined(TARGET_LPC4088)
00035 #define HEAP_SIZE 0xf000
00036 #define USRLIB_IMG (uint8_t*)77824
00037 
00038 #elif defined(TARGET_NUCLEO_F401RE)
00039 #define HEAP_SIZE 0x15000
00040 #define USRLIB_IMG (uint8_t*)73728
00041 
00042 #elif defined(TARGET_NUCLEO_F411RE)
00043 #define HEAP_SIZE 0x1e000
00044 #define USRLIB_IMG (uint8_t*)73728
00045 
00046 #elif defined(TARGET_NUCLEO_F446RE)
00047 #define HEAP_SIZE 0x1e000
00048 #define USRLIB_IMG (uint8_t*)77824
00049 
00050 #elif defined(TARGET_NUCLEO_F103RB)
00051 #define HEAP_SIZE 0x4000
00052 #define USRLIB_IMG (uint8_t*)73728
00053 
00054 #elif defined(TARGET_NUCLEO_L152RE)
00055 #define HEAP_SIZE 0x12000
00056 #define USRLIB_IMG (uint8_t*)73728
00057 
00058 #else
00059 #error "target error"
00060 #endif
00061 
00062 uint8_t heap[HEAP_SIZE];
00063 
00064 int
00065 main(void)
00066 {
00067     PmReturn_t retval;
00068 
00069     retval = pm_init(heap, HEAP_SIZE, MEMSPACE_PROG, USRLIB_IMG);
00070     PM_RETURN_IF_ERROR(retval);
00071 
00072     /* Run the sample program */
00073     retval = pm_run((uint8_t *)"main");
00074 
00075     return (int)retval;
00076 }