maple mini port (STM32F103)

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
KN Yeoh
Posts: 2
Joined: Sun Sep 27, 2015 9:46 am

maple mini port (STM32F103)

Post by KN Yeoh » Sun Sep 27, 2015 9:55 am

Anyone interested to port micropython to maple mini? I try to port it but fail in the pin part, I wish someone could continue the effort. I have uploaded the file to:

https://drive.google.com/file/d/0BwIWlm ... sp=sharing

Thanks,
KN

Code: Select all

Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
mkdir -p build-STM32F4DISC/genhdr
Create build-STM32F4DISC/genhdr/pins.h
GEN build-STM32F4DISC/genhdr/qstrdefs.generated.h
Generating build-STM32F4DISC/genhdr/mpversion.h
mkdir -p build-STM32F4DISC/hal/src
mkdir -p build-STM32F4DISC/lib/fatfs
mkdir -p build-STM32F4DISC/lib/fatfs/option
mkdir -p build-STM32F4DISC/lib/libc
mkdir -p build-STM32F4DISC/lib/libm
mkdir -p build-STM32F4DISC/lib/mp-readline
mkdir -p build-STM32F4DISC/lib/netutils
mkdir -p build-STM32F4DISC/lib/timeutils
mkdir -p build-STM32F4DISC/py
mkdir -p build-STM32F4DISC/py/../extmod
mkdir -p build-STM32F4DISC/usbdev/class/src
mkdir -p build-STM32F4DISC/usbdev/core/src
CC ../py/mpstate.c
CC ../py/nlrx86.S
CC ../py/nlrx64.S
CC ../py/nlrthumb.S
CC ../py/nlrxtensa.S
CC ../py/nlrsetjmp.c
CC ../py/malloc.c
CC ../py/gc.c
CC ../py/qstr.c
CC ../py/vstr.c
CC ../py/mpprint.c
CC ../py/unicode.c
CC ../py/mpz.c
CC ../py/lexer.c
CC ../py/lexerstr.c
CC ../py/lexerunix.c
CC ../py/parse.c
CC ../py/scope.c
CC ../py/compile.c
CC ../py/emitcommon.c
CC ../py/emitcpy.c
CC ../py/emitbc.c
CC ../py/asmx64.c
CC ../py/emitnative.c
CC ../py/asmx86.c
CC ../py/emitnative.c
CC ../py/asmthumb.c
CC ../py/emitnative.c
CC ../py/emitinlinethumb.c
CC ../py/asmarm.c
CC ../py/emitnative.c
CC ../py/formatfloat.c
CC ../py/parsenumbase.c
CC ../py/parsenum.c
CC ../py/emitglue.c
CC ../py/runtime.c
CC ../py/nativeglue.c
CC ../py/stackctrl.c
CC ../py/argcheck.c
CC ../py/warning.c
CC ../py/map.c
CC ../py/obj.c
CC ../py/objarray.c
CC ../py/objattrtuple.c
CC ../py/objbool.c
CC ../py/objboundmeth.c
CC ../py/objcell.c
CC ../py/objclosure.c
CC ../py/objcomplex.c
CC ../py/objdict.c
CC ../py/objenumerate.c
CC ../py/objexcept.c
CC ../py/objfilter.c
CC ../py/objfloat.c
CC ../py/objfun.c
CC ../py/objgenerator.c
CC ../py/objgetitemiter.c
CC ../py/objint.c
CC ../py/objint_longlong.c
CC ../py/objint_mpz.c
CC ../py/objlist.c
CC ../py/objmap.c
CC ../py/objmodule.c
CC ../py/objobject.c
CC ../py/objproperty.c
CC ../py/objnone.c
CC ../py/objnamedtuple.c
CC ../py/objrange.c
CC ../py/objreversed.c
CC ../py/objset.c
CC ../py/objsingleton.c
CC ../py/objslice.c
CC ../py/objstr.c
CC ../py/objstrunicode.c
CC ../py/objstringio.c
CC ../py/objtuple.c
CC ../py/objtype.c
CC ../py/objzip.c
CC ../py/opmethods.c
CC ../py/sequence.c
CC ../py/stream.c
CC ../py/binary.c
CC ../py/builtinimport.c
CC ../py/builtinevex.c
CC ../py/modarray.c
CC ../py/modbuiltins.c
CC ../py/modcollections.c
CC ../py/modgc.c
CC ../py/modio.c
CC ../py/modmath.c
CC ../py/modcmath.c
CC ../py/modmicropython.c
CC ../py/modstruct.c
CC ../py/modsys.c
CC ../py/vm.c
CC ../py/bc.c
CC ../py/showbc.c
CC ../py/repl.c
CC ../py/smallint.c
CC ../py/frozenmod.c
CC ../py/../extmod/moductypes.c
CC ../py/../extmod/modujson.c
CC ../py/../extmod/modure.c
CC ../py/../extmod/moduzlib.c
CC ../py/../extmod/moduheapq.c
CC ../py/../extmod/moduhashlib.c
CC ../py/../extmod/modubinascii.c
CC ../py/../extmod/modmachine.c
CC ../lib/libc/string0.c
CC ../lib/libm/math.c
CC ../lib/libm/asinfacosf.c
CC ../lib/libm/atanf.c
CC ../lib/libm/atan2f.c
CC ../lib/libm/fmodf.c
CC ../lib/libm/roundf.c
CC ../lib/libm/log1pf.c
CC ../lib/libm/acoshf.c
CC ../lib/libm/asinhf.c
CC ../lib/libm/atanhf.c
CC ../lib/libm/kf_rem_pio2.c
CC ../lib/libm/kf_sin.c
CC ../lib/libm/kf_cos.c
CC ../lib/libm/kf_tan.c
CC ../lib/libm/ef_rem_pio2.c
CC ../lib/libm/erf_lgamma.c
CC ../lib/libm/sf_sin.c
CC ../lib/libm/sf_cos.c
CC ../lib/libm/sf_tan.c
CC ../lib/libm/sf_frexp.c
CC ../lib/libm/sf_modf.c
CC ../lib/libm/sf_ldexp.c
CC ../lib/libm/sf_erf.c
CC ../lib/libm/wf_lgamma.c
CC ../lib/libm/wf_tgamma.c
CC ../lib/fatfs/ff.c
CC ../lib/fatfs/option/ccsbcs.c
CC ../lib/mp-readline/readline.c
CC ../lib/netutils/netutils.c
CC ../lib/timeutils/timeutils.c
Create build-STM32F4DISC/genhdr/pybcdc.inf
Create build-STM32F4DISC/genhdr/pybcdc_inf.h
CC main.c
CC system_stm32f1xx.c
CC stm32f103_it.c
CC usbd_conf.c
CC usbd_desc.c
CC usbd_cdc_interface.c
CC usbd_msc_storage.c
CC mphal.c
CC irq.c
CC pendsv.c
CC systick.c
CC timer.c
CC led.c
CC pin.c
In file included from ../py/mpstate.h:34:0,
                 from ../py/runtime.h:29,
                 from pin.c:32:
build-STM32F4DISC/genhdr/pins_af_const.h:1:65: error: 'GPIO_AF1_TIM1' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF1_TIM1),   MP_OBJ_NEW_SMALL_INT(GPIO_AF1_TIM1) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
build-STM32F4DISC/genhdr/pins_af_const.h:2:65: error: 'GPIO_AF1_TIM2' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF1_TIM2),   MP_OBJ_NEW_SMALL_INT(GPIO_AF1_TIM2) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
build-STM32F4DISC/genhdr/pins_af_const.h:3:65: error: 'GPIO_AF2_TIM3' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF2_TIM3),   MP_OBJ_NEW_SMALL_INT(GPIO_AF2_TIM3) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
build-STM32F4DISC/genhdr/pins_af_const.h:4:65: error: 'GPIO_AF2_TIM4' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF2_TIM4),   MP_OBJ_NEW_SMALL_INT(GPIO_AF2_TIM4) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
build-STM32F4DISC/genhdr/pins_af_const.h:5:65: error: 'GPIO_AF2_TIM5' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF2_TIM5),   MP_OBJ_NEW_SMALL_INT(GPIO_AF2_TIM5) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
build-STM32F4DISC/genhdr/pins_af_const.h:6:65: error: 'GPIO_AF3_TIM10' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF3_TIM10),  MP_OBJ_NEW_SMALL_INT(GPIO_AF3_TIM10) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
build-STM32F4DISC/genhdr/pins_af_const.h:7:65: error: 'GPIO_AF3_TIM11' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF3_TIM11),  MP_OBJ_NEW_SMALL_INT(GPIO_AF3_TIM11) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
build-STM32F4DISC/genhdr/pins_af_const.h:8:65: error: 'GPIO_AF3_TIM9' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF3_TIM9),   MP_OBJ_NEW_SMALL_INT(GPIO_AF3_TIM9) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
build-STM32F4DISC/genhdr/pins_af_const.h:10:65: error: 'GPIO_AF4_I2C1' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF4_I2C1),   MP_OBJ_NEW_SMALL_INT(GPIO_AF4_I2C1) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
build-STM32F4DISC/genhdr/pins_af_const.h:13:65: error: 'GPIO_AF4_I2C2' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF4_I2C2),   MP_OBJ_NEW_SMALL_INT(GPIO_AF4_I2C2) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
build-STM32F4DISC/genhdr/pins_af_const.h:25:65: error: 'GPIO_AF5_SPI1' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF5_SPI1),   MP_OBJ_NEW_SMALL_INT(GPIO_AF5_SPI1) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
build-STM32F4DISC/genhdr/pins_af_const.h:28:65: error: 'GPIO_AF5_SPI2' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF5_SPI2),   MP_OBJ_NEW_SMALL_INT(GPIO_AF5_SPI2) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
build-STM32F4DISC/genhdr/pins_af_const.h:49:65: error: 'GPIO_AF7_USART1' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF7_USART1), MP_OBJ_NEW_SMALL_INT(GPIO_AF7_USART1) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
build-STM32F4DISC/genhdr/pins_af_const.h:52:65: error: 'GPIO_AF7_USART2' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF7_USART2), MP_OBJ_NEW_SMALL_INT(GPIO_AF7_USART2) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
build-STM32F4DISC/genhdr/pins_af_const.h:55:65: error: 'GPIO_AF8_USART6' undeclared here (not in a function)
     { MP_OBJ_NEW_QSTR(MP_QSTR_AF8_USART6), MP_OBJ_NEW_SMALL_INT(GPIO_AF8_USART6) },
                                                                 ^
../py/obj.h:79:66: note: in definition of macro 'MP_OBJ_NEW_SMALL_INT'
 #define MP_OBJ_NEW_SMALL_INT(small_int) ((mp_obj_t)((((mp_int_t)(small_int)) << 1) | 1))
                                                                  ^
make: *** [build-STM32F4DISC/pin.o] Error 1


User avatar
dhylands
Posts: 3203
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: maple mini port (STM32F103)

Post by dhylands » Sun Sep 27, 2015 4:00 pm

I don't mean to discourage you, but the Maple Mini only has 120K flash. So you're going to need to cut a huge amount of stuff (no internal file system, turn off floating point, etc). The default stmhal image is around 275K of flash right now). It looks like even the minimal image is quite large (around 140K), so I'm not sure you'll be able to get it to fit in 120K.

Personally, I'd recommend using something like this instead: https://www.ghielectronics.com/catalog/product/450

If you still want to pursue this, I can take a look at the pins compilation problem that you're having, although I'd prefer to look at a guthub branch rather than a tarball.

KN Yeoh
Posts: 2
Joined: Sun Sep 27, 2015 9:46 am

Re: maple mini port (STM32F103)

Post by KN Yeoh » Mon Sep 28, 2015 1:02 pm

ya, I notice that too when I try to map the device during the initial porting, seem like F103 really limited... too bad...

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: maple mini port (STM32F103)

Post by pfalcon » Fri Oct 09, 2015 8:52 pm

I once did a Maple Mini port, purposely to prove that what's written in FAQ - that it's possible to run MicroPython on an MCU with 128K flash. With bloated Maple bootloader (~20K) and bloated USB driver (~25K), minimal port barely fit there, but still fit.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

Post Reply