Page 1 of 2

MicroPython on STM32F7

Posted: Wed Sep 12, 2018 1:20 am
by terrancepeiris
I am new to micropython, I am using Windows 7 with MinGW and install all drivers from MinGW and MSys.
I am getting this error

Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
mkdir -p build-STM32F7DISC/genhdr
Create build-STM32F7DISC/genhdr/pins.h
/bin/sh: python: command not found

Is anyone had a same problem before and any suggestion or solution, please share with me.

Re: MicroPython on STM32F7

Posted: Wed Sep 12, 2018 5:34 am
by dhylands
Install the MinGW version of python (as the error is 'bin/sh: python: command not found'

Re: MicroPython on STM32F7

Posted: Thu Sep 13, 2018 7:22 am
by terrancepeiris
Thanks for the reply, I install all option of MinGW then have issue
make V=1 BOARD=STM32F769DISC
python ../../py/makeversionhdr.py build-STM32F769DISC/genhdr/mpversion.h
MPY modules/dht.py
mkdir -p build-STM32F769DISC/frozen_mpy/
../../mpy-cross/mpy-cross -o build-STM32F769DISC/frozen_mpy/dht.mpy -s dht.py modules/dht.py
Traceback (most recent call last):
File "modules/dht.py", line 1
SyntaxError: invalid syntax
make: *** [build-STM32F769DISC/frozen_mpy/dht.mpy] Error 1


Please help me

Re: MicroPython on STM32F7

Posted: Thu Sep 13, 2018 9:07 am
by dhylands
I'd make a guess that this has something to do with line endings.

Re: MicroPython on STM32F7

Posted: Thu Sep 13, 2018 11:04 am
by terrancepeiris
i tried with two separate windows machine one with windows 7 and the other windows 10 and both yield the same result

Re: MicroPython on STM32F7

Posted: Thu Sep 13, 2018 3:12 pm
by pagano.paganino
The problem is simbolic link under mingw e msys2.
Replace linked files with originals if you need it, else remove unused.

Regards,
D.

Re: MicroPython on STM32F7

Posted: Thu Sep 13, 2018 11:30 pm
by terrancepeiris
Hi Pagano, thanks. Could you elaborate little more what to do that as I am new to this environment, please?

Re: MicroPython on STM32F7

Posted: Thu Sep 13, 2018 11:47 pm
by terrancepeiris
Hi Guys, this the last message before error
DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool -DMICROPY_MODULE_FROZEN_MPY -c -MD -o build-STM32F769DISC/lib/utils/printf.o ../../lib/utils/printf.c
/usr/bin/sed: -e expression #4, char 1: unknown command: `C'
MPY modules/dht.py
mkdir -p build-STM32F769DISC/frozen_mpy/
../../mpy-cross/mpy-cross -o build-STM32F769DISC/frozen_mpy/dht.mpy -s dht.py modules/dht.py
Traceback (most recent call last):
File "modules/dht.py", line 1
SyntaxError: invalid syntax
make: *** [build-STM32F769DISC/frozen_mpy/dht.mpy] Error 1

Re: MicroPython on STM32F7

Posted: Fri Sep 14, 2018 10:10 am
by terrancepeiris
https://github.com/MarkR42/micropython/ ... l/Makefile

I notice that the latest (2018 Sep 2018) STM32hal make file is slightly different from 2016

2018 make file

ifneq ($(FROZEN_DIR),)
# To use frozen source modules, put your .py files in a subdirectory (eg scripts/)
# and then invoke make with FROZEN_DIR=scripts (be sure to build from scratch).
CFLAGS += -DMICROPY_MODULE_FROZEN_STR
endif


2016 make file
ifneq ($(FROZEN_MPY_DIR),)

# To use frozen bytecode, put your .py files in a subdirectory (eg frozen/) and

# then invoke make with FROZEN_MPY_DIR=frozen (be sure to build from scratch).

FROZEN_MPY_PY_FILES := $(shell find $(FROZEN_MPY_DIR) -type f -name '*.py')

FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy))

CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool

CFLAGS += -DMICROPY_MODULE_FROZEN_MPY

OBJ += $(BUILD)/$(BUILD)/frozen_mpy.o

MPY_CROSS = ../mpy-cross/mpy-cross

MPY_TOOL = ../tools/mpy-tool.py

$(BUILD)/$(FROZEN_MPY_DIR)/%.mpy: $(FROZEN_MPY_DIR)/%.py

@$(ECHO) "MPY $<"

$(Q)$(MKDIR) -p $(dir $@)

$(Q)$(MPY_CROSS) -o $@ -s $(^:$(FROZEN_MPY_DIR)/%=%) $^

$(BUILD)/frozen_mpy.c: $(FROZEN_MPY_MPY_FILES) $(BUILD)/genhdr/qstrdefs.generated.h

@$(ECHO) "Creating $@"

$(Q)$(PYTHON) $(MPY_TOOL) -f -q $(BUILD)/genhdr/qstrdefs.preprocessed.h $(FROZEN_MPY_MPY_FILES) > $@
endif

Re: MicroPython on STM32F7

Posted: Sat Sep 15, 2018 10:08 pm
by pagano.paganino
The problem is that the content of the file "modules/dht.py" is not python code but the text "../../../drivers/dht/dht.py" which represents a symbolic link on unix systems.
You are compiling with mingw (but the same problem is with msys2) which does not understand that "modules/dht.py" file is not a regular file but a symbolic link.

The solutions can be many, but try one of the following:

1) If you do not need those modules do not use the "modules" folder as FROZEN_MPY_DIR folder but specify your own

Code: Select all

make V=1 BOARD=STM32F769DISC FROZEN_MPY_DIR="scripts"
where "scripts" is a folder pre-existent and must at least contain one .py file (even empty is fine).


2) remove all the .py files in the "modules" folder and create an empty .py file (touch modules/__ empty__.py)


Regards,
D.