Error while building uPython for STM32F407 discovery board

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
Domantas
Posts: 4
Joined: Mon Dec 01, 2014 11:17 am

Error while building uPython for STM32F407 discovery board

Post by Domantas » Mon Dec 01, 2014 11:32 am

Hi. I am trying to build uPython for STM32 discovery board. I work in debian. When I try this:

Code: Select all

root@debian:/home/siaubas/Downloads/micropython-master/micropython-master/stmhal# make BOARD=STM32F4DISC V=1
I get this output:

Code: Select all

mkdir -p build-STM32F4DISC/genhdr
Create build-STM32F4DISC/genhdr/pins.h
python boards/make-pins.py --board boards/STM32F4DISC/pins.csv --af boards/stm32f4xx_af.csv --prefix boards/stm32f4xx_prefix.c --hdr build-STM32F4DISC/genhdr/pins.h --qstr build-STM32F4DISC/pins_qstr.h --af-const build-STM32F4DISC/genhdr/pins_af_const.h --af-py build-STM32F4DISC/pins_af.py > build-STM32F4DISC/pins_STM32F4DISC.c
make: *** No rule to make target `qstrdefsport.h', needed by `build-STM32F4DISC/genhdr/qstrdefs.generated.h'.  Stop.
Any help appreciated

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

Re: Error while building uPython for STM32F407 discovery boa

Post by dhylands » Tue Dec 02, 2014 8:12 am

Which version of the git tree are you using?

Which version of make are you using?

I'm using ubuntu 14.04, running the latest master, and my make version is 3.81 (output of make --version).

Could you try:

Code: Select all

make BOARD=STM32F4DISC clean
and then do

Code: Select all

make BOARD=STM32F4DISC V=1
When I do:

Code: Select all

make BOARD=STM32F4DISC V=1
from a clean build then I get this output:

Code: Select all

mkdir -p build-STM32F4DISC/genhdr
Create build-STM32F4DISC/genhdr/pins.h
python boards/make-pins.py --board boards/STM32F4DISC/pins.csv --af boards/stm32f4xx_af.csv --prefix boards/stm32f4xx_prefix.c --hdr build-STM32F4DISC/genhdr/pins.h --qstr build-STM32F4DISC/pins_qstr.h --af-const build-STM32F4DISC/genhdr/pins_af_const.h --af-py build-STM32F4DISC/pins_af.py > build-STM32F4DISC/pins_STM32F4DISC.c
CPP ../py/qstrdefs.h
arm-none-eabi-gcc -E -I. -I../py -Ibuild-STM32F4DISC -Icmsis/inc -Icmsis/devinc -Ihal/inc -Iusbdev/core/inc -Iusbdev/class/cdc_msc_hid/inc -Ifatfs/src -Wall -Wpointer-arith -Werror -ansi -std=gnu99 -nostdlib  -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion -Os -DNDEBUG -Iboards/STM32F4DISC -fdata-sections -ffunction-sections ../py/qstrdefs.h -o build-STM32F4DISC/genhdr/qstrdefs.preprocessed.h
makeqstrdata ../py/qstrdefs.h qstrdefsport.h build-STM32F4DISC/pins_qstr.h
python ../py/makeqstrdata.py build-STM32F4DISC/genhdr/qstrdefs.preprocessed.h qstrdefsport.h build-STM32F4DISC/pins_qstr.h > build-STM32F4DISC/genhdr/qstrdefs.generated.h
../py/py-version.sh > build-STM32F4DISC/genhdr/py-version.h.tmp
if [ -f "build-STM32F4DISC/genhdr/py-version.h" ] && cmp -s build-STM32F4DISC/genhdr/py-version.h build-STM32F4DISC/genhdr/py-version.h.tmp; then rm build-STM32F4DISC/genhdr/py-version.h.tmp; else echo "Generating build-STM32F4DISC/genhdr/py-version.h"; mv build-STM32F4DISC/genhdr/py-version.h.tmp build-STM32F4DISC/genhdr/py-version.h; fi
Generating build-STM32F4DISC/genhdr/py-version.h
mkdir -p build-STM32F4DISC/fatfs/src
mkdir -p build-STM32F4DISC/fatfs/src/option
mkdir -p build-STM32F4DISC/hal/src
mkdir -p build-STM32F4DISC/lib/libm
mkdir -p build-STM32F4DISC/py
mkdir -p build-STM32F4DISC/py/../extmod
mkdir -p build-STM32F4DISC/usbdev/class/cdc_msc_hid/src
mkdir -p build-STM32F4DISC/usbdev/core/src
CC ../py/nlrx86.S
arm-none-eabi-gcc -I. -I../py -Ibuild-STM32F4DISC -Icmsis/inc -Icmsis/devinc -Ihal/inc -Iusbdev/core/inc -Iusbdev/class/cdc_msc_hid/inc -Ifatfs/src -Wall -Wpointer-arith -Werror -ansi -std=gnu99 -nostdlib  -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion -Os -DNDEBUG -Iboards/STM32F4DISC -fdata-sections -ffunction-sections -c -o build-STM32F4DISC/py/nlrx86.o ../py/nlrx86.S
...

Domantas
Posts: 4
Joined: Mon Dec 01, 2014 11:17 am

Re: Error while building uPython for STM32F407 discovery boa

Post by Domantas » Tue Dec 02, 2014 10:34 am

I am using Debian wheezy

Code: Select all

Linux version 3.2.0-4-686-pae (debian-kernel@lists.debian.org) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.63-2+deb7u1
make version is 3.81

I downloaded git zip from this url:

https://github.com/micropython/micropython

I assume, the issue must be related to some libs or something, as every example I found was on ubuntu. I managed to download debian package for arm-none-eabi-gcc from here:

https://packages.debian.org/sid/libs/li ... -none-eabi

Thanks for your quick response

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: Error while building uPython for STM32F407 discovery boa

Post by Damien » Wed Dec 10, 2014 12:13 am

Downloading the latest micropython-master.zip file from micropython.org/download, and running make BOARD=STM32F4DISC in the stmhal directory works fine for me.

I suspect that your build process can't find arm-none-eabi-gcc. Is it in your path? Can you execute arm-none-eabi-gcc on the command line?

Domantas
Posts: 4
Joined: Mon Dec 01, 2014 11:17 am

Re: Error while building uPython for STM32F407 discovery boa

Post by Domantas » Thu Dec 11, 2014 9:36 am

Got fed up with dealing with debian, setted up VM for ubuntu 14 and now I have everything working. The problem was (I guess) with toolchain and path, but when I repeated same steps for ubuntu, everything worked instantly.

Anyway, thank you guys for quick response and your help

rmq
Posts: 10
Joined: Thu May 21, 2015 5:21 am

Re: Error while building uPython for STM32F407 discovery board

Post by rmq » Mon May 25, 2015 10:13 am

Hello

I am trying to compile the sources for STM32F4 discovery kit on Fedora machine bit I get a compilation error . The path of the tool chain seems to be correct . The logs are as below :

[root@zinga stmhal]# make BOARD=STM32F4DISC V=1
CPP ../py/qstrdefs.h
arm-none-eabi-gcc -E -I. -I.. -Ibuild-STM32F4DISC -Icmsis/inc -Icmsis/devinc -Ihal/inc -Iusbdev/core/inc -Iusbdev/class/inc -I../lib/mp-readline -I../lib/netutils -I../lib/timeutils -Wall -Wpointer-arith -Werror -ansi -std=gnu99 -nostdlib -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion -Os -DNDEBUG -Iboards/STM32F4DISC -fdata-sections -ffunction-sections ../py/qstrdefs.h -o build-STM32F4DISC/genhdr/qstrdefs.preprocessed.h
In file included from cmsis/inc/core_cm4.h:168:0,
from cmsis/devinc/stm32f407xx.h:184,
from cmsis/devinc/stm32f4xx.h:126,
from hal/inc/stm32f4xx_hal_def.h:48,
from hal/inc/stm32f4xx_hal_rcc.h:47,
from boards/STM32F4DISC/stm32f4xx_hal_conf.h:236,
from hal/inc/stm32f4xx_hal.h:48,
from ./mpconfigport.h:199,
from ../py/mpconfig.h:45,
from ../py/qstrdefs.h:27:
/usr/lib64/gcc/arm-none-eabi/4.7.3/include/stdint.h:3:26: fatal error: stdint.h: No such file or directory

I tried to find the path for stdint.h with the following command and I see it is present as below log.
[root@zinga include]# find $(dirname $(type -p arm-none-eabi-gcc))/.. -name stdint.h
/usr/bin/../lib64/gcc/arm-none-eabi/4.7.3/include/stdint.h
/usr/bin/../include/stdint.h
/usr/bin/../include/c++/4.8.2/tr1/stdint.h
/usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.2/include/stdint.h

Can you please point out my mistake ? The version of arm-none-eabi is

arm-none-eabi-gcc --version
arm-none-eabi-gcc (Fedora 2013.05.23-1.fc20) 4.7.3
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The version of Fedora machine is

uname -a
Linux zinga.dlh.com 3.11.10-301.fc20.x86_64 #1 SMP Thu Dec 5 14:01:17 UTC 2013 x86_64 x86_64 x86_64 GNU/Linu

Your support would be appreciated

Regards
RMQ

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

Re: Error while building uPython for STM32F407 discovery board

Post by dhylands » Mon May 25, 2015 4:45 pm

Sometimes installing the corresponding libc sorts this out.

Perhaps try install libnewlib-arm-none-eabi

If that fails, you should be able to install the linaro toolchain (which is what I've been using). It's self contained and all of the required bits and pieces.

https://launchpad.net/gcc-arm-embedded

It comes as a tarball which you unpack and then add the appropriate thing to your PATH. For me, I decided to put it into ~/stm

So I created ~/stm, and untarred the tarball while inside that directory and then added /home/dhylands/stm/gcc-arm-none-eabi-4_9-2014q4/bin to my PATH. The 4_(_2014q4 portion changes every quarter), so use the part that matches what you actually downloaded.

rmq
Posts: 10
Joined: Thu May 21, 2015 5:21 am

Re: Error while building uPython for STM32F407 discovery board

Post by rmq » Thu May 28, 2015 4:02 am

Thanks for the precious inputs . Your second advise worked out (https://launchpad.net/gcc-arm-embedded). I am able to compile the sources now.

Regards
RMQ

Post Reply