Build Failed For Micro Python With STM32F407 Discovery
Build Failed For Micro Python With STM32F407 Discovery
Attempting to build Micro Python for the STM32F407 Discovery but end up with the following errors:
make BOARD=STM32F4DISC
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
CPP ../py/qstrdefs.h
In file included from ../py/mpconfig.h:31:0,
from ../py/qstrdefs.h:27:
./mpconfigport.h:106:20: fatal error: alloca.h: No such file or directory
#include <alloca.h>
^
compilation terminated.
make: *** [build-STM32F4DISC/genhdr/qstrdefs.generated.h] Error 1
Following the instructions from the official wiki on a page titled Board STM32F407 Discovery.
make BOARD=STM32F4DISC
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
CPP ../py/qstrdefs.h
In file included from ../py/mpconfig.h:31:0,
from ../py/qstrdefs.h:27:
./mpconfigport.h:106:20: fatal error: alloca.h: No such file or directory
#include <alloca.h>
^
compilation terminated.
make: *** [build-STM32F4DISC/genhdr/qstrdefs.generated.h] Error 1
Following the instructions from the official wiki on a page titled Board STM32F407 Discovery.
Re: Build Failed For Micro Python With STM32F407 Discovery
Hmm.
It seems to be working fine for me.
Are you on the latest tree?
Try running: to see what version you're on and let us know. f3de62... is the latest as of the time I wrote this message.
I normally do: to make sure I don't have any edited files, and then: and that should update to the latest.
Then do:
Which version of arm-none-eabi-gcc do you have?
Mine reports:
Executing this command (under linux): should find an alloca.h file. Mine was here: If it doesn't find one, then there is something wrong with your toolchain installation (well perhaps - it may depend on the actual location of you arm-none-eabi-gcc)
It seems to be working fine for me.
Are you on the latest tree?
Try running:
Code: Select all
git rev-parse HEAD
f3de62e6c248a4ac6db9e68ed9534e0ec1093a2e
I normally do:
Code: Select all
git status
Code: Select all
git checkout master
git pull
Then do:
Code: Select all
make BOARD=STM32F4DISC clean
make BOARD=STM32F4DISC
Mine reports:
Code: Select all
arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.8.3 20131129 (release) [ARM/embedded-4_8-branch revision 205641]
Copyright (C) 2013 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.
Code: Select all
find $(dirname $(type -p arm-none-eabi-gcc))/.. -name alloca.h
Code: Select all
/home/dhylands/stm/gcc-arm-none-eabi-4_8-2013q4/bin/../arm-none-eabi/include/alloca.h
Re: Build Failed For Micro Python With STM32F407 Discovery
Using the following version of the GCC compiler for ARM:
arm-none-eabi-gcc (4.8.2-14ubuntu1+6) 4.8.2
The find command found alloca.h in /usr/bin/../arm-linux-gnueabi/include. Already using the latest Git revision of the Micro Python repository. Tried running make again but ended up with the same errors.
arm-none-eabi-gcc (4.8.2-14ubuntu1+6) 4.8.2
The find command found alloca.h in /usr/bin/../arm-linux-gnueabi/include. Already using the latest Git revision of the Micro Python repository. Tried running make again but ended up with the same errors.
Re: Build Failed For Micro Python With STM32F407 Discovery
This is very strange.
On my ubuntu 14.04 machine, I did:
And it reports:
Perhaps you could try the following: and report back the output.
It's starting to sound like you have an environment variable set which is overriding the compiler or something.
Perhaps try (just in case it got screwed up):
I took a look in buid-STM32F4DISC/file.P and it reports alloca.h is in /usr/include/newlib/alloca.h
On my other computer I did something like this:
On my ubuntu 14.04 machine, I did:
Code: Select all
sudo apt-get install gcc-arm-none-eabi
Code: Select all
arm-none-eabi-gcc --version
arm-none-eabi-gcc (4.8.2-14ubuntu1+6) 4.8.2
Copyright (C) 2013 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.
Code: Select all
make BOARD=STM32F4DISC V=1
It's starting to sound like you have an environment variable set which is overriding the compiler or something.
Perhaps try (just in case it got screwed up):
Code: Select all
sudo apt-get install libnewlib-arm-none-eabi
On my other computer I did something like this:
Code: Select all
mkdir ~/stm
cd ~/stm
wget 'https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q2-update/+download/gcc-arm-none-eabi-4_8-2014q2-20140609-linux.tar.bz2'
tar xf gcc-arm-none-eabi-4_8-2014q2-20140609-linux.tar.bz2
and added ~/stm/gcc-arm-none-eabi-4_8-2014q2/bin to my PATH
Re: Build Failed For Micro Python With STM32F407 Discovery
Installing the libnewlib-arm-none-eabi package did the trick ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)
-
- Posts: 4
- Joined: Sat Nov 08, 2014 1:44 am
Re: Build Failed For Micro Python With STM32F407 Discovery
I also had a problem building for the STM32F4 discovery board.digiPixel wrote:Installing the libnewlib-arm-none-eabi package did the trick
![Sad :(](./images/smilies/icon_e_sad.gif)
The error I got was:
Code: Select all
$ make BOARD=STM32F4DISC
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
mkdir -p build-STM32F4DISC/genhdr
Create build-STM32F4DISC/pins_qstr.h
CPP ../py/qstrdefs.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:136,
from ../py/mpconfig.h:43,
from ../py/qstrdefs.h:27:
/usr/lib/gcc/arm-none-eabi/4.8.2/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory
# include_next <stdint.h>
^
compilation terminated.
make: *** [build-STM32F4DISC/genhdr/qstrdefs.generated.h] Error 1
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
-
- Posts: 2
- Joined: Wed Feb 11, 2015 9:57 pm
Re: Build Failed For Micro Python With STM32F407 Discovery
I saw this thread and figured it would help me fix my Micro Python build error:
root@hplinuxmint:/home/primo/MicroPython/micropython/stmhal# make
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
CPP ../py/qstrdefs.h
In file included from cmsis/inc/core_cm4.h:168:0,
from cmsis/devinc/stm32f405xx.h:181,
from cmsis/devinc/stm32f4xx.h:122,
from hal/inc/stm32f4xx_hal_def.h:48,
from hal/inc/stm32f4xx_hal_rcc.h:47,
from boards/PYBV10/stm32f4xx_hal_conf.h:236,
from hal/inc/stm32f4xx_hal.h:48,
from ./mpconfigport.h:182,
from ../py/mpconfig.h:45,
from ../py/qstrdefs.h:27:
/usr/lib/gcc/arm-none-eabi/4.8.2/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory
# include_next <stdint.h>
^
compilation terminated.
make: *** [build-PYBV10/genhdr/qstrdefs.generated.h] Error 1
Updating the arm library like so should do the trick, I hoped.
sudo apt-get install libnewlib-arm-none-eabi
Unfortunately, no joy with this fix since apt-get has indigestion with libnewlib-arm-none-eabi:
root@hplinuxmint:/home/primo/MicroPython/micropython/stmhal# sudo apt-get install libnewlib-arm-none-eabi
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libnewlib-arm-none-eabi is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libnewlib-arm-none-eabi' has no installation candidate
Any suggestions gratefully received.
root@hplinuxmint:/home/primo/MicroPython/micropython/stmhal# make
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
CPP ../py/qstrdefs.h
In file included from cmsis/inc/core_cm4.h:168:0,
from cmsis/devinc/stm32f405xx.h:181,
from cmsis/devinc/stm32f4xx.h:122,
from hal/inc/stm32f4xx_hal_def.h:48,
from hal/inc/stm32f4xx_hal_rcc.h:47,
from boards/PYBV10/stm32f4xx_hal_conf.h:236,
from hal/inc/stm32f4xx_hal.h:48,
from ./mpconfigport.h:182,
from ../py/mpconfig.h:45,
from ../py/qstrdefs.h:27:
/usr/lib/gcc/arm-none-eabi/4.8.2/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory
# include_next <stdint.h>
^
compilation terminated.
make: *** [build-PYBV10/genhdr/qstrdefs.generated.h] Error 1
Updating the arm library like so should do the trick, I hoped.
sudo apt-get install libnewlib-arm-none-eabi
Unfortunately, no joy with this fix since apt-get has indigestion with libnewlib-arm-none-eabi:
root@hplinuxmint:/home/primo/MicroPython/micropython/stmhal# sudo apt-get install libnewlib-arm-none-eabi
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libnewlib-arm-none-eabi is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libnewlib-arm-none-eabi' has no installation candidate
Any suggestions gratefully received.
Re: Build Failed For Micro Python With STM32F407 Discovery
I installed the toolchain found here: https://launchpad.net/gcc-arm-embedded and it works fine for me.
More specifically, I did:
I normally edit my .bashrc file and add the export line from above so that it's done automatically for me everytime I launch a terminal.
More specifically, I did:
Code: Select all
mkdir ~/stm
cd ~/stm
wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2014-q4-major/+download/gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2
tar xf gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2
export PATH=$PATH:$HOME/stm/gcc-arm-none-eabi-4_9-2014q4/bin
cd ~/micropython/micropython/stmhal
make BOARD=STM32F4DISC
-
- Posts: 2
- Joined: Wed Feb 11, 2015 9:57 pm
Re: Build Failed For Micro Python With STM32F407 Discovery
Thanks for the speedy tip. I followed your recipe but I still fall at the last fence.
It seems to be something to do with file permissions which is beyond my understanding as a Linux cross-compilation newbie.
It seems to be something to do with file permissions which is beyond my understanding as a Linux cross-compilation newbie.
Code: Select all
primo@hplinuxmint:~/MicroPython/micropython$ mkdir ~/stm
primo@hplinuxmint:~/MicroPython/micropython$ cd ~/stm
primo@hplinuxmint:~/stm$ wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2014-q4-major/+download/gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2
--2015-02-13 22:33:12-- https://launchpad.net/gcc-arm-embedded/4.9/4.9-2014-q4-major/+download/gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2
Resolving launchpad.net (launchpad.net)... 91.189.89.222, 91.189.89.223
Connecting to launchpad.net (launchpad.net)|91.189.89.222|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://launchpadlibrarian.net/192227997/gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2 [following]
--2015-02-13 22:33:12-- https://launchpadlibrarian.net/192227997/gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2
Resolving launchpadlibrarian.net (launchpadlibrarian.net)... 91.189.89.229, 91.189.89.228
Connecting to launchpadlibrarian.net (launchpadlibrarian.net)|91.189.89.229|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 66355541 (63M) [application/x-tar]
Saving to: ‘gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2’
100%[==============================================================================================================================>] 66,355,541 1.07MB/s in 42s
2015-02-13 22:33:54 (1.51 MB/s) - ‘gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2’ saved [66355541/66355541]
primo@hplinuxmint:~/stm$ tar xf gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2
primo@hplinuxmint:~/stm$ export PATH=$PATH:$HOME/stm/gcc-arm-none-eabi-4_9-2014q4/bin
primo@hplinuxmint:~/stm$ cd ~/MicroPython/micropython/stmhal
primo@hplinuxmint:~/MicroPython/micropython/stmhal$ make V=1 BOARD=STM32F4DISC
CPP ../py/qstrdefs.h
arm-none-eabi-gcc -E -I. -I.. -Ibuild-STM32F4DISC -Icmsis/inc -Icmsis/devinc -Ihal/inc -Iusbdev/core/inc -Iusbdev/class/cdc_msc_hid/inc -I../lib/fatfs -I../lib/mp-readline -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
cc1: fatal error: opening output file build-STM32F4DISC/genhdr/qstrdefs.preprocessed.h: Permission denied
compilation terminated.
make: *** [build-STM32F4DISC/genhdr/qstrdefs.generated.h] Error 1
primo@hplinuxmint:~/MicroPython/micropython/stmhal$
Re: Build Failed For Micro Python With STM32F407 Discovery
Perhaps you previously tried to do a make using sudo?
From within the stmhal directory, try doing:. If that gives a permission error then try doing: and then redo the make.
You should never have to use sudo with make (for micropython).
Once you get your build done, you may get permission errors trying to flash (make BOARD=STM32F4DISC deploy). If you add your user to the dialout group, logout an log back in again, then the deploy should work.
From within the stmhal directory, try doing:
Code: Select all
rm -rf build-STM32F4DISC
Code: Select all
sudo rm -rf build-STM32F4DISC
You should never have to use sudo with make (for micropython).
Once you get your build done, you may get permission errors trying to flash (make BOARD=STM32F4DISC deploy). If you add your user to the dialout group, logout an log back in again, then the deploy should work.