MicroPython on STM32F7

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
terrancepeiris
Posts: 9
Joined: Mon Sep 10, 2018 6:05 am

MicroPython on STM32F7

Post by terrancepeiris » Wed Sep 12, 2018 1:20 am

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.

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

Re: MicroPython on STM32F7

Post by dhylands » Wed Sep 12, 2018 5:34 am

Install the MinGW version of python (as the error is 'bin/sh: python: command not found'

terrancepeiris
Posts: 9
Joined: Mon Sep 10, 2018 6:05 am

Re: MicroPython on STM32F7

Post by terrancepeiris » Thu Sep 13, 2018 7:22 am

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

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

Re: MicroPython on STM32F7

Post by dhylands » Thu Sep 13, 2018 9:07 am

I'd make a guess that this has something to do with line endings.

terrancepeiris
Posts: 9
Joined: Mon Sep 10, 2018 6:05 am

Re: MicroPython on STM32F7

Post by terrancepeiris » Thu Sep 13, 2018 11:04 am

i tried with two separate windows machine one with windows 7 and the other windows 10 and both yield the same result

pagano.paganino
Posts: 89
Joined: Fri Sep 11, 2015 10:47 pm
Location: Italy

Re: MicroPython on STM32F7

Post by pagano.paganino » Thu Sep 13, 2018 3:12 pm

The problem is simbolic link under mingw e msys2.
Replace linked files with originals if you need it, else remove unused.

Regards,
D.

terrancepeiris
Posts: 9
Joined: Mon Sep 10, 2018 6:05 am

Re: MicroPython on STM32F7

Post by terrancepeiris » Thu Sep 13, 2018 11:30 pm

Hi Pagano, thanks. Could you elaborate little more what to do that as I am new to this environment, please?

terrancepeiris
Posts: 9
Joined: Mon Sep 10, 2018 6:05 am

Re: MicroPython on STM32F7

Post by terrancepeiris » Thu Sep 13, 2018 11:47 pm

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

terrancepeiris
Posts: 9
Joined: Mon Sep 10, 2018 6:05 am

Re: MicroPython on STM32F7

Post by terrancepeiris » Fri Sep 14, 2018 10:10 am

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

pagano.paganino
Posts: 89
Joined: Fri Sep 11, 2015 10:47 pm
Location: Italy

Re: MicroPython on STM32F7

Post by pagano.paganino » Sat Sep 15, 2018 10:08 pm

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.

Post Reply