Mbed-os: master branch fails to build for NUCLEO_F030R8

Created on 6 Dec 2018  路  13Comments  路  Source: ARMmbed/mbed-os

Description

Attempting to build commit 1c201b4628e346c62e1fbfa7cbcf6aa4e164f0c5 (current master branch) fails due to a missing device.h.

$ MBED_GCC_ARM_PATH=/usr/local/gcc-arm-none-eabi-7-2018-q2-update/bin python build.py -c -v -m NUCLEO_F030R8 -t GCC_ARM --profile release 
Copy: mbed.h
Scan: drivers
Copy: AnalogIn.h
Copy: AnalogOut.h
Copy: BusIn.h
Copy: BusInOut.h
Copy: BusOut.h
Copy: CAN.h
Copy: DigitalIn.h
Copy: DigitalInOut.h
Copy: DigitalOut.h
Copy: Ethernet.h
<snip>
Scan: hal
Building library MBED (NUCLEO_F030R8, GCC_ARM)
Macros: -D__CORTEX_M0 -DCMSIS_VECTAB_VIRTUAL -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -DTARGET_LIKE_MBED -DDEVICE_PORTOUT=1 -DDEVICE_PORTINOUT=1 -D__MBED_CMSIS_RTOS_CM -DTARGET_STM32F0 -DDEVICE_RTC=1 -DCOMPONENT_PSA_SRV_EMUL=1 -DTARGET_NUCLEO_F030R8 -DMBED_BUILD_TIMESTAMP=1544052255.85 -D__CMSIS_RTOS -DTOOLCHAIN_GCC -DDEVICE_CRC=1 -DTARGET_CORTEX_M -DDEVICE_I2C_ASYNCH=1 -DARM_MATH_CM0 -DTARGET_M0 -DCOMPONENT_PSA_SRV_IMPL=1 -DDEVICE_SPI_ASYNCH=1 -DDEVICE_SERIAL=1 -DDEVICE_INTERRUPTIN=1 -DTARGET_CORTEX -DDEVICE_I2C=1 -DTRANSACTION_QUEUE_SIZE_SPI=2 -DDEVICE_STDIO_MESSAGES=1 -DTARGET_FF_MORPHO -DTARGET_FAMILY_STM32 -DTARGET_FF_ARDUINO -DTARGET_RELEASE -DTARGET_STM -DDEVICE_SERIAL_FC=1 -DDEVICE_USTICKER=1 -DDEVICE_PORTIN=1 -DDEVICE_SLEEP=1 -DTOOLCHAIN_GCC_ARM -DDEVICE_SPI=1 -DCOMPONENT_NSPE=1 -DCMSIS_VECTAB_VIRTUAL_HEADER_FILE="cmsis_nvic.h" -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_PWMOUT=1 -DTARGET_STM32F030R8 -DTARGET_LIKE_CORTEX_M0
Compile [  3.1%]: BusIn.cpp
Compile: /usr/local/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-g++ -std=gnu++98 -fno-rtti -Wvla -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -Os -DNDEBUG -g1 -DMBED_RTOS_SINGLE_THREAD -mcpu=cortex-m0 -mthumb -DMBED_ROM_START=0x8000000 -DMBED_ROM_SIZE=0x10000 -DMBED_RAM_START=0x20000000 -DMBED_RAM_SIZE=0x2000 -DMBED_ROM_START=0x8000000 -DMBED_ROM_SIZE=0x10000 -DMBED_RAM_START=0x20000000 -DMBED_RAM_SIZE=0x2000 -DMBED_ROM_START=0x8000000 -DMBED_ROM_SIZE=0x10000 -DMBED_RAM_START=0x20000000 -DMBED_RAM_SIZE=0x2000 -DMBED_ROM_START=0x8000000 -DMBED_ROM_SIZE=0x10000 -DMBED_RAM_START=0x20000000 -DMBED_RAM_SIZE=0x2000 -DMBED_ROM_START=0x8000000 -DMBED_ROM_SIZE=0x10000 -DMBED_RAM_START=0x20000000 -DMBED_RAM_SIZE=0x2000 -DMBED_ROM_START=0x8000000 -DMBED_ROM_SIZE=0x10000 -DMBED_RAM_START=0x20000000 -DMBED_RAM_SIZE=0x2000 -DMBED_ROM_START=0x8000000 -DMBED_ROM_SIZE=0x10000 -DMBED_RAM_START=0x20000000 -DMBED_RAM_SIZE=0x2000 -D__CORTEX_M0 -DCMSIS_VECTAB_VIRTUAL -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -DTARGET_LIKE_MBED -DDEVICE_PORTOUT=1 -DDEVICE_PORTINOUT=1 -D__MBED_CMSIS_RTOS_CM -DTARGET_STM32F0 -DDEVICE_RTC=1 -DCOMPONENT_PSA_SRV_EMUL=1 -DTARGET_NUCLEO_F030R8 -DMBED_BUILD_TIMESTAMP=1544052255.85 -D__CMSIS_RTOS -DTOOLCHAIN_GCC -DDEVICE_CRC=1 -DTARGET_CORTEX_M -DDEVICE_I2C_ASYNCH=1 -DARM_MATH_CM0 -DTARGET_M0 -DCOMPONENT_PSA_SRV_IMPL=1 -DDEVICE_SPI_ASYNCH=1 -DDEVICE_SERIAL=1 -DDEVICE_INTERRUPTIN=1 -DTARGET_CORTEX -DDEVICE_I2C=1 -DTRANSACTION_QUEUE_SIZE_SPI=2 -DDEVICE_STDIO_MESSAGES=1 -DTARGET_FF_MORPHO -DTARGET_FAMILY_STM32 -DTARGET_FF_ARDUINO -DTARGET_RELEASE -DTARGET_STM -DDEVICE_SERIAL_FC=1 -DDEVICE_USTICKER=1 -DDEVICE_PORTIN=1 -DDEVICE_SLEEP=1 -DTOOLCHAIN_GCC_ARM -DDEVICE_SPI=1 -DCOMPONENT_NSPE=1 -DCMSIS_VECTAB_VIRTUAL_HEADER_FILE="cmsis_nvic.h" -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_PWMOUT=1 -DTARGET_STM32F030R8 -DTARGET_LIKE_CORTEX_M0 @/home/adsilva/src/mbed-os/BUILD/mbed/.temp/TARGET_NUCLEO_F030R8/TOOLCHAIN_GCC_ARM/.includes_042fcf182ccb280dadf40a5f6e1ecba5.txt -include /home/adsilva/src/mbed-os/BUILD/mbed/.temp/TARGET_NUCLEO_F030R8/TOOLCHAIN_GCC_ARM/mbed_config.h -MD -MF ../BUILD/mbed/.temp/TARGET_NUCLEO_F030R8/TOOLCHAIN_GCC_ARM/drivers/BusIn.d -o ../BUILD/mbed/.temp/TARGET_NUCLEO_F030R8/TOOLCHAIN_GCC_ARM/drivers/BusIn.o /home/adsilva/src/mbed-os/drivers/BusIn.cpp
[Fatal Error] platform.h@30,10: device.h: No such file or directory
[DEBUG] Return: 1
[DEBUG] Output: In file included from /home/adsilva/src/mbed-os/BUILD/mbed/drivers/BusIn.h:20:0,
[DEBUG] Output:                  from /home/adsilva/src/mbed-os/drivers/BusIn.cpp:17:
[DEBUG] Output: /home/adsilva/src/mbed-os/BUILD/mbed/platform/platform.h:30:10: fatal error: device.h: No such file or directory
[DEBUG] Output:  #include "device.h"
[DEBUG] Output:           ^~~~~~~~~~
[DEBUG] Output: compilation terminated.
Traceback (most recent call last):
  File "build.py", line 223, in <module>
    notify=notifier,
  File "/home/adsilva/src/mbed-os/tools/build_api.py", line 1025, in build_mbed_libs
    objects = toolchain.compile_sources(mbed_resources, incdirs)
  File "/home/adsilva/src/mbed-os/tools/toolchains/__init__.py", line 414, in compile_sources
    return self.compile_queue(queue, objects)
  File "/home/adsilva/src/mbed-os/tools/toolchains/__init__.py", line 477, in compile_queue
    raise ToolException(err)
ToolException: In file included from /home/adsilva/src/mbed-os/BUILD/mbed/drivers/BusIn.h:20:0,
                 from /home/adsilva/src/mbed-os/drivers/BusIn.cpp:17:
/home/adsilva/src/mbed-os/BUILD/mbed/platform/platform.h:30:10: fatal error: device.h: No such file or directory
 #include "device.h"
          ^~~~~~~~~~
compilation terminated.

Issue request type

[ ] Question
[ ] Enhancement
[X] Bug
CLOSED mirrored bug

All 13 comments

Hmm, is tools/build.py supported any more, or should we only build via mbed-cli now?

First commit that breaks it is c29fe896a1b5157fa33aa0c777ba92767f6a61f3

Interesting.

Is there a reason why mbed-cli isn't being used to invoke build.py?

@cmonr Not really, just that is how I used to build it, and I'm dusting off old projects.

Building this way is still documented here: https://os.mbed.com/teams/SDK-Development/wiki/Mbed-SDK-build-script-introduction

It also works(ish) for mbed-os-5.9.7, until it falls over in drivers/UARTSerial.cpp with [Error] UARTSerial.h@69,23: no members matching 'mbed::FileHandle::readable' in 'class mbed::FileHandle' [Error] UARTSerial.h@70,23: no members matching 'mbed::FileHandle::writable' in 'class mbed::FileHandle' [Warning] UARTSerial.cpp@36,18: 'mbed::FileHandle::FileHandle()' is deprecated: The mbed 2 filesystem classes have been superseeded by the FileSystem api, Replaced by File [since mbed-os-5.4] [-Wdeprecated-declarations]

Interesting.

Building this way is still documented here: https://os.mbed.com/teams/SDK-Development/wiki/Mbed-SDK-build-script-introduction

Woah, ok. I was not aware that this still existed. (Fyi @ARMmbed/mbed-docs )

For reference, our up-to-date documentation is located here: https://os.mbed.com/docs/v5.10/
Also, all of our tests use mbed-cli as a frontend, so I would suggest giving that a try.

It seems my target is not supported in mbed-os 5.X, so I'll need to stick with a self-built library (rather than the binary that mbed-cli seems to provide (I need to build a very cut-down library as this is part of a bootloader - https://github.com/InfernoEmbedded/onewire-softdevice).

Trying to build mbed_lib_rev164 results in the same problem (device.h missing for Nucleo F030R8).

$ python build.py -c -v -m NUCLEO_F030R8 -t GCC_ARM -j 4 --profile release
...
Compile: /home/deece/1wire/toolchain/x-tool/arm-none-eabi/bin/arm-none-eabi-g++ -std=gnu++98 -fno-rtti -Wvla -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -Os -DNDEBUG -g1 -DMBED_RTOS_SINGLE_THREAD -mcpu=cortex-m0 -mthumb -DDEVICE_SPISLAVE=1 -DDEVICE_PORTIN=1 -DDEVICE_CRC=1 -D__MBED__=1 -DDEVICE_RTC=1 -DDEVICE_SPI=1 -DTARGET_STM32F030R8 -DDEVICE_SLEEP=1 -DTARGET_STM -DTARGET_STM32F0 -DTARGET_NUCLEO_F030R8 -DDEVICE_I2CSLAVE=1 -DTOOLCHAIN_GCC_ARM -DTARGET_RELEASE -DCMSIS_VECTAB_VIRTUAL_HEADER_FILE="cmsis_nvic.h" -DDEVICE_I2C=1 -DTARGET_CORTEX_M -DTOOLCHAIN_GCC -DTARGET_M0 -DDEVICE_PORTINOUT=1 -DDEVICE_USTICKER=1 -DDEVICE_PWMOUT=1 -D__CORTEX_M0 -DMBED_BUILD_TIMESTAMP=1544094922.4285948 -DDEVICE_ANALOGIN=1 -DDEVICE_SERIAL_FC=1 -DCMSIS_VECTAB_VIRTUAL -DDEVICE_I2C_ASYNCH=1 -DDEVICE_PORTOUT=1 -DTARGET_FF_ARDUINO -DTARGET_LIKE_CORTEX_M0 -D__MBED_CMSIS_RTOS_CM -DTARGET_LIKE_MBED -DDEVICE_SERIAL=1 -DTARGET_CORTEX -D__CMSIS_RTOS -DDEVICE_STDIO_MESSAGES=1 -DTARGET_FAMILY_STM32 -DDEVICE_SPI_ASYNCH=1 -DTARGET_FF_MORPHO -DTRANSACTION_QUEUE_SIZE_SPI=2 -DDEVICE_INTERRUPTIN=1 -DARM_MATH_CM0 @/home/deece/1wire/mbed/mbed-os/BUILD/mbed/.temp/TARGET_NUCLEO_F030R8/TOOLCHAIN_GCC_ARM/.includes_6c827721abb29f7714bc48acef064ede.txt -include /home/deece/1wire/mbed/mbed-os/BUILD/mbed/.temp/TARGET_NUCLEO_F030R8/TOOLCHAIN_GCC_ARM/mbed_config.h -MD -MF ../BUILD/mbed/.temp/TARGET_NUCLEO_F030R8/TOOLCHAIN_GCC_ARM/drivers/AnalogIn.d -o ../BUILD/mbed/.temp/TARGET_NUCLEO_F030R8/TOOLCHAIN_GCC_ARM/drivers/AnalogIn.o /home/deece/1wire/mbed/mbed-os/drivers/AnalogIn.cpp
[Fatal Error] platform.h@29,10: device.h: No such file or directory
[DEBUG] Return: 1
[DEBUG] Output: In file included from /home/deece/1wire/mbed/mbed-os/drivers/AnalogIn.h:19,
[DEBUG] Output:                  from /home/deece/1wire/mbed/mbed-os/drivers/AnalogIn.cpp:17:
[DEBUG] Output: /home/deece/1wire/mbed/mbed-os/platform/platform.h:29:10: fatal error: device.h: No such file or directory
[DEBUG] Output:  #include "device.h"
[DEBUG] Output:           ^~~~~~~~~~
[DEBUG] Output: compilation terminated.
Traceback (most recent call last):
  File "/home/deece/1wire/mbed/mbed-os/tools/toolchains/__init__.py", line 467, in compile_queue
    res['command']
  File "/home/deece/1wire/mbed/mbed-os/tools/toolchains/__init__.py", line 585, in compile_output
    raise ToolException(_stderr)
tools.utils.ToolException: In file included from /home/deece/1wire/mbed/mbed-os/drivers/AnalogIn.h:19,
                 from /home/deece/1wire/mbed/mbed-os/drivers/AnalogIn.cpp:17:
/home/deece/1wire/mbed/mbed-os/platform/platform.h:29:10: fatal error: device.h: No such file or directory
 #include "device.h"
          ^~~~~~~~~~
compilation terminated.


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "build.py", line 210, in <module>
    notify=notifier,
  File "/home/deece/1wire/mbed/mbed-os/tools/build_api.py", line 1011, in build_mbed_libs
    objects = toolchain.compile_sources(mbed_resources, incdirs)
  File "/home/deece/1wire/mbed/mbed-os/tools/toolchains/__init__.py", line 413, in compile_sources
    return self.compile_queue(queue, objects)
  File "/home/deece/1wire/mbed/mbed-os/tools/toolchains/__init__.py", line 476, in compile_queue
    raise ToolException(err)
tools.utils.ToolException: In file included from /home/deece/1wire/mbed/mbed-os/drivers/AnalogIn.h:19,
                 from /home/deece/1wire/mbed/mbed-os/drivers/AnalogIn.cpp:17:
/home/deece/1wire/mbed/mbed-os/platform/platform.h:29:10: fatal error: device.h: No such file or directory
 #include "device.h"
          ^~~~~~~~~~
compilation terminated.

Hmm, is tools/build.py supported any more, or should we only build via mbed-cli now?

@ARMmbed/mbed-os-tools Can you review this use case? Shall this work or not?

From @deece's command it looks like you're trying to build from the tools directory. If you cd up one directory (you should see mbed-os as subdirectory) and modify your command to:

python tools/build.py -c -v -m NUCLEO_F030R8 -t GCC_ARM -j 4 --profile release

It should work fine after that (I tried it locally to make sure).

@bridadan That was it, thanks.

I wonder if build.py should be patched to chdir() appropriately, or otherwise warn if it's started where it doesn't expect to be? (it used to the case that it was documented to be run from the tools dir)

Mbed CLI does the chdir() for you (which is the supported interface). However, Mbed CLI checks to see if the compile target is supported by Mbed OS 5 and this target isn't, so that's why I didn't mention it 馃槃

Thanks, I'll close this as user error then

Thanks for the tag, @cmonr We have a task to clean up some of the outdated teams content. I'll make sure this one goes on the list.

Was this page helpful?
0 / 5 - 0 ratings