Norimasa Okamoto
/
pymite
python-on-a-chip online compiler
- http://pymbed.appspot.com/
- https://code.google.com/p/python-on-a-chip/
- http://www.youtube.com/watch?v=Oyqc2bFRW9I
- https://bitbucket.org/va009039/pymbed/
more info: python-on-a-chip
vm/img.h@15:94ca5c8003e5, 2016-04-14 (annotated)
- Committer:
- va009039
- Date:
- Thu Apr 14 22:32:57 2016 +0000
- Revision:
- 15:94ca5c8003e5
- Parent:
- 0:65f1469d6bfb
update Nucleo-F401RE.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:65f1469d6bfb | 1 | /* |
va009039 | 0:65f1469d6bfb | 2 | # This file is Copyright 2002 Dean Hall. |
va009039 | 0:65f1469d6bfb | 3 | # This file is part of the PyMite VM. |
va009039 | 0:65f1469d6bfb | 4 | # This file is licensed under the MIT License. |
va009039 | 0:65f1469d6bfb | 5 | # See the LICENSE file for details. |
va009039 | 0:65f1469d6bfb | 6 | */ |
va009039 | 0:65f1469d6bfb | 7 | |
va009039 | 0:65f1469d6bfb | 8 | |
va009039 | 0:65f1469d6bfb | 9 | #ifndef __IMG_H__ |
va009039 | 0:65f1469d6bfb | 10 | #define __IMG_H__ |
va009039 | 0:65f1469d6bfb | 11 | |
va009039 | 0:65f1469d6bfb | 12 | |
va009039 | 0:65f1469d6bfb | 13 | /** |
va009039 | 0:65f1469d6bfb | 14 | * \file |
va009039 | 0:65f1469d6bfb | 15 | * \brief Image header |
va009039 | 0:65f1469d6bfb | 16 | * |
va009039 | 0:65f1469d6bfb | 17 | * Created to eliminate a circular include |
va009039 | 0:65f1469d6bfb | 18 | * among mem, string and obj. |
va009039 | 0:65f1469d6bfb | 19 | */ |
va009039 | 0:65f1469d6bfb | 20 | |
va009039 | 0:65f1469d6bfb | 21 | |
va009039 | 0:65f1469d6bfb | 22 | /** The maximum number of paths available in PmImgPaths */ |
va009039 | 0:65f1469d6bfb | 23 | #define PM_NUM_IMG_PATHS 4 |
va009039 | 0:65f1469d6bfb | 24 | |
va009039 | 0:65f1469d6bfb | 25 | |
va009039 | 0:65f1469d6bfb | 26 | typedef struct PmImgPaths_s |
va009039 | 0:65f1469d6bfb | 27 | { |
va009039 | 0:65f1469d6bfb | 28 | PmMemSpace_t memspace[PM_NUM_IMG_PATHS]; |
va009039 | 0:65f1469d6bfb | 29 | uint8_t const *pimg[PM_NUM_IMG_PATHS]; |
va009039 | 0:65f1469d6bfb | 30 | uint8_t pathcount; |
va009039 | 0:65f1469d6bfb | 31 | } |
va009039 | 0:65f1469d6bfb | 32 | PmImgPaths_t, *pPmImgPaths_t; |
va009039 | 0:65f1469d6bfb | 33 | |
va009039 | 0:65f1469d6bfb | 34 | |
va009039 | 0:65f1469d6bfb | 35 | /** |
va009039 | 0:65f1469d6bfb | 36 | * Code image object |
va009039 | 0:65f1469d6bfb | 37 | * |
va009039 | 0:65f1469d6bfb | 38 | * A type to hold code images in the heap. |
va009039 | 0:65f1469d6bfb | 39 | * A code image with an object descriptor at the front. |
va009039 | 0:65f1469d6bfb | 40 | * Used for storing image objects during ipm; |
va009039 | 0:65f1469d6bfb | 41 | * the code object keeps a reference to this object. |
va009039 | 0:65f1469d6bfb | 42 | */ |
va009039 | 0:65f1469d6bfb | 43 | typedef struct PmCodeImgObj_s |
va009039 | 0:65f1469d6bfb | 44 | { |
va009039 | 0:65f1469d6bfb | 45 | /** Object descriptor */ |
va009039 | 0:65f1469d6bfb | 46 | PmObjDesc_t od; |
va009039 | 0:65f1469d6bfb | 47 | |
va009039 | 0:65f1469d6bfb | 48 | /** Null-term? char array */ |
va009039 | 0:65f1469d6bfb | 49 | uint8_t val[1]; |
va009039 | 0:65f1469d6bfb | 50 | } PmCodeImgObj_t, |
va009039 | 0:65f1469d6bfb | 51 | *pPmCodeImgObj_t; |
va009039 | 0:65f1469d6bfb | 52 | |
va009039 | 0:65f1469d6bfb | 53 | |
va009039 | 0:65f1469d6bfb | 54 | /** |
va009039 | 0:65f1469d6bfb | 55 | * Iterates over all paths in the paths array until the named module is found. |
va009039 | 0:65f1469d6bfb | 56 | * Returns the memspace,address of the head of the module. |
va009039 | 0:65f1469d6bfb | 57 | * |
va009039 | 0:65f1469d6bfb | 58 | * @param pname Pointer to the name of the desired module |
va009039 | 0:65f1469d6bfb | 59 | * @param r_memspace Return by reference the memory space of the module |
va009039 | 0:65f1469d6bfb | 60 | * @param r_imgaddr Return by reference the address of the module's image |
va009039 | 0:65f1469d6bfb | 61 | * @return Return status |
va009039 | 0:65f1469d6bfb | 62 | */ |
va009039 | 0:65f1469d6bfb | 63 | PmReturn_t img_findInPaths(pPmObj_t pname, PmMemSpace_t *r_memspace, |
va009039 | 0:65f1469d6bfb | 64 | uint8_t const **r_imgaddr); |
va009039 | 0:65f1469d6bfb | 65 | |
va009039 | 0:65f1469d6bfb | 66 | /** |
va009039 | 0:65f1469d6bfb | 67 | * Appends the given memspace and address to the image path array |
va009039 | 0:65f1469d6bfb | 68 | * |
va009039 | 0:65f1469d6bfb | 69 | * @param memspace The memspace |
va009039 | 0:65f1469d6bfb | 70 | * @param paddr The address |
va009039 | 0:65f1469d6bfb | 71 | * @return Return status |
va009039 | 0:65f1469d6bfb | 72 | */ |
va009039 | 0:65f1469d6bfb | 73 | PmReturn_t img_appendToPath(PmMemSpace_t memspace, uint8_t const * const paddr); |
va009039 | 0:65f1469d6bfb | 74 | |
va009039 | 0:65f1469d6bfb | 75 | #endif /* __IMG_H__ */ |