Particle compile fails with no error messages

argon
Tags: #<Tag:0x00007f038eca18c0>

#1

I’m building using the Particle CLI for the Argon. I am running the latest CLI as well as firmware on my Argon.

I’m noticing that sometimes the Particle build process fails with no error messages. The build system, just stops abruptly, and returns to the terminal. This probably happens if there are errors in the code which would prevent it to compile, but without error messages, it’s hard to say that for certain.

Attached is an example of build output when this occurs. Note the abrupt return to the console.

Any ideas? This is an extremely frustrating issue.

chris@itxdev:~/WorkingRepo1/repo/Embedded/Particle/mcp25625_test$ particle compile argon
 
Compiling code for argon
 
Including:
    src/datatypes.h
    src/mcp25625.h
    src/vesc_can.h
    src/mcp25625_test.ino
    src/mcp25625.ino
    src/vesc_can.cpp
    project.properties
attempting to compile firmware
 
Processing  src/mcp25625.ino
Processing  src/mcp25625_test.ino
make -C ../modules/argon/user-part all
make[1]: Entering directory '/firmware/modules/argon/user-part'
 
make -f ../../../modules/shared/nRF52840/build_linker_script.mk PREBUILD=1
make[2]: Entering directory '/firmware/modules/argon/user-part'
Creating module_user_memory.ld ...
make[2]: Leaving directory '/firmware/modules/argon/user-part'
 
make -C ../../../user
make[2]: Entering directory '/firmware/user'
Building cpp file: src/vesc_can.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/user/platform-12-msrc/
arm-none-eabi-gcc -DSTM32_DEVICE -DnRF52840 -DNRF52840_XXAA -DPLATFORM_THREADING=1 -DPLATFORM_ID=12 -DPLATFORM_NAME=argon -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD00C -DUSBD_PID_CDC=0xC00C -DSPARK_PLATFORM -g3 -gdwarf-2 -Os -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DINCLUDE_PLATFORM=1 -DSOFTDEVICE_PRESENT=1 -DS140 -DPRODUCT_ID=12 -DPRODUCT_FIRMWARE_VERSION=65535 -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"openthread-config-project.h\" -DENABLE_FEM=1 -DNRF_802154_PROJECT_CONFIG=\"openthread-platform-config.h\" -DRAAL_SOFTDEVICE=1 -D_WIZCHIP_=W5500 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DLFS_CONFIG=lfs_config.h -DSYSTEM_VERSION_STRING=0.8.0-rc.27 -DRELEASE_BUILD -I./inc -I../wiring/inc -I../system/inc -I../third_party/miniz/miniz -I../services/inc -I../third_party/nanopb/nanopb -I../communication/src -I../hal/inc -I../hal/shared -I../hal/src/argon -I../hal/network/lwip/esp32 -I../hal/src/nRF52840 -I../hal/src/armv7 -I../hal/src/nRF52840 -I../hal/src/nRF52840/lwip -I../hal/src/nRF52840/freertos -I../hal/src/nRF52840/openthread -I../hal/src/nRF52840/mbedtls -I../hal/src/nRF52840/littlefs -I../hal/network/api -I../hal/network/lwip -I../hal/network/lwip/posix -I../hal/network/openthread -I../hal/network/lwip/wiznet -I../hal/network/ncp -I../hal/network/ncp/at_parser -I../third_party/lwip/lwip/src/include -I../third_party/freertos/freertos/FreeRTOS/Source/include -I../third_party/nrf5_sdk/nrf5_sdk/external/freertos/portable/GCC/nrf52 -I../third_party/nrf5_sdk/nrf5_sdk/external/freertos/portable/CMSIS/nrf52 -I../third_party/openthread/openthread/include -I../third_party/openthread/openthread/src/core -I../third_party/openthread/openthread/examples/platforms -I../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio -I../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/hal -I../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/raal -I../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/raal/softdevice -I../third_party/wiznet_driver/wiznet_driver/Ethernet -I../gsm0710muxer/gsm0710muxer/include -I../platform/shared/inc -I../third_party/nrf5_sdk -I../third_party/nrf5_sdk/nrf5_sdk/components/toolchain/cmsis/include -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers/include -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/hal -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/mdk -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/hal -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers/src/prs -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/util -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers/nrf52 -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/common -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/fstorage -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/experimental_section_vars -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/crc32 -I../third_party/nrf5_sdk/nrf5_sdk/components/drivers_nrf/usbd -I../third_party/nrf5_sdk/nrf5_sdk/integration/nrfx/legacy -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/delay -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/experimental_log -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/experimental_log -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/experimental_log/src -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/experimental_section_vars -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/delay -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/queue -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/common -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/mbr/nrf52840/headers -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140 -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers/nrf52 -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/fifo -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic_fifo -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/strerror -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/fstorage -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic_flags -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/usbd -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/usbd/class/cdc -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/usbd/class/cdc/acm -I../third_party/nrf5_sdk/nrf5_sdk/components/ble/common -I../third_party/nrf5_sdk/nrf5_sdk/components/ble/nrf_ble_gatt -I../third_party/nrf5_sdk/nrf5_sdk/components/ble/ble_advertising -I../third_party/nrf5_sdk/nrf5_sdk/external/nrf_cc310/include -I../third_party/littlefs/littlefs -I../platform/MCU/nRF52840/inc -I../dynalib/inc -Isrc -I./libraries -I. -MD -MP -MF ../build/target/user/platform-12-msrc/vesc_can.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -Wundef -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DSPARK_PLATFORM_NET=ESP32 -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc  -DLOG_INCLUDE_SOURCE_INFO=1 -DPARTICLE_USER_MODULE -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0xD4000 -DMODULAR_FIRMWARE=1 -DMODULE_VERSION=5 -DMODULE_FUNCTION=5 -DMODULE_INDEX=1 -DMODULE_DEPENDENCY=4,1,326 -DMODULE_DEPENDENCY2=0,0,0 -D_WINSOCK_H -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="\"app\""  -fno-exceptions -fno-rtti -fcheck-new -std=gnu++11 -c -o ../build/target/user/platform-12-msrc/vesc_can.o src/vesc_can.cpp
 
Building cpp file: src/mcp25625.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/user/platform-12-msrc/
arm-none-eabi-gcc -DSTM32_DEVICE -DnRF52840 -DNRF52840_XXAA -DPLATFORM_THREADING=1 -DPLATFORM_ID=12 -DPLATFORM_NAME=argon -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD00C -DUSBD_PID_CDC=0xC00C -DSPARK_PLATFORM -g3 -gdwarf-2 -Os -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DINCLUDE_PLATFORM=1 -DSOFTDEVICE_PRESENT=1 -DS140 -DPRODUCT_ID=12 -DPRODUCT_FIRMWARE_VERSION=65535 -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"openthread-config-project.h\" -DENABLE_FEM=1 -DNRF_802154_PROJECT_CONFIG=\"openthread-platform-config.h\" -DRAAL_SOFTDEVICE=1 -D_WIZCHIP_=W5500 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DLFS_CONFIG=lfs_config.h -DSYSTEM_VERSION_STRING=0.8.0-rc.27 -DRELEASE_BUILD -I./inc -I../wiring/inc -I../system/inc -I../third_party/miniz/miniz -I../services/inc -I../third_party/nanopb/nanopb -I../communication/src -I../hal/inc -I../hal/shared -I../hal/src/argon -I../hal/network/lwip/esp32 -I../hal/src/nRF52840 -I../hal/src/armv7 -I../hal/src/nRF52840 -I../hal/src/nRF52840/lwip -I../hal/src/nRF52840/freertos -I../hal/src/nRF52840/openthread -I../hal/src/nRF52840/mbedtls -I../hal/src/nRF52840/littlefs -I../hal/network/api -I../hal/network/lwip -I../hal/network/lwip/posix -I../hal/network/openthread -I../hal/network/lwip/wiznet -I../hal/network/ncp -I../hal/network/ncp/at_parser -I../third_party/lwip/lwip/src/include -I../third_party/freertos/freertos/FreeRTOS/Source/include -I../third_party/nrf5_sdk/nrf5_sdk/external/freertos/portable/GCC/nrf52 -I../third_party/nrf5_sdk/nrf5_sdk/external/freertos/portable/CMSIS/nrf52 -I../third_party/openthread/openthread/include -I../third_party/openthread/openthread/src/core -I../third_party/openthread/openthread/examples/platforms -I../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio -I../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/hal -I../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/raal -I../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/raal/softdevice -I../third_party/wiznet_driver/wiznet_driver/Ethernet -I../gsm0710muxer/gsm0710muxer/include -I../platform/shared/inc -I../third_party/nrf5_sdk -I../third_party/nrf5_sdk/nrf5_sdk/components/toolchain/cmsis/include -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers/include -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/hal -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/mdk -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/hal -I../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers/src/prs -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/util -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers/nrf52 -I../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/common -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/fstorage -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/experimental_section_vars -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/crc32 -I../third_party/nrf5_sdk/nrf5_sdk/components/drivers_nrf/usbd -I../third_party/nrf5_sdk/nrf5_sdk/integration/nrfx/legacy -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/delay -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/experimental_log -I../third_party/nrf5_sdk/nrf5_sdk/components/libraries/experimental_log -I../third_party/nrfchris@itxdev:~/WorkingRepo1/LiftLab/Embedded/Particle/mcp25625_test$

#2

You have two *.ino files in your project - that’s not allowed.

You can only have one (or none) .ino and that’s also the one that has to hold the one and only set of setup()/loop() functions.
You can have as many .cpp files as you wish, but the one set of setup()/loop() functions still applies.


#3

Thanks,

Renaming the other file fixed the issue. I really wish this was covered somewhere, or a warning added in the build system. Under plenty of circumstances, the build does actually work with multiple ino files… Under some circumstances it does not, however. This is why this issue was very confusing for me to debug.


#4

Ok, I guess I spoke too soon.

This issue seems to be directly affected by including Particle.h. Removing inclusion of this file seems to fix this sometimes. Ideas?

EDIT: Or rather, adding the file allows the compiler to get further into the compilation process where iit then fails with no error message. Maybe a linking problem?


#5

This sounds like the preprocessor tripping.

If you have a .ino file then this will first be treated by the Particle Preprocessor which will add an include statement for Particle.h (and also create function prototypes for any function lacking such) - .cpp & .h files don’t undergo that extra treatment.
The actual reasons for the preprocessor tripping aren’t clear, but sometimes reordering includes, (re)moving leading comment blocks, system macros helps.

Without knowing your code it’s difficult to say more.


#6

So I basically see two main compiler failures.

The first is when I get something like this:


In file included from ../hal/src/nRF52840/interrupts_irq.h:26:0,
                 from ../hal/inc/interrupts_hal.h:33,
                 from ../wiring/inc/spark_wiring.h:29,
                 from ./inc/application.h:40,
                 from src/mcp25625_test.cpp:1:
../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/mdk/nrf52840.h:2406:67: error: expected ')' before '*' token
 #define NRF_POWER                       ((NRF_POWER_Type          *) NRF_POWER_BASE)
                                                                   ^
src/datatypes.h:379:3: note: in expansion of macro 'NRF_POWER'
 } NRF_POWER;
   ^
../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/mdk/nrf52840.h:2406:67: error: expected ')' before '*' token
 #define NRF_POWER                       ((NRF_POWER_Type          *) NRF_POWER_BASE)
                                                                   ^
src/datatypes.h:379:3: note: in expansion of macro 'NRF_POWER'
 } NRF_POWER;
   ^
../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/mdk/nrf52840.h:2406:67: error: expected ')' before '*' token
 #define NRF_POWER                       ((NRF_POWER_Type          *) NRF_POWER_BASE)
                                                                   ^
src/datatypes.h:414:2: note: in expansion of macro 'NRF_POWER'
  NRF_POWER power;
  ^
../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/mdk/nrf52840.h:2406:67: error: expected ')' before '*' token
 #define NRF_POWER                       ((NRF_POWER_Type          *) NRF_POWER_BASE)
                                                                   ^
src/datatypes.h:414:2: note: in expansion of macro 'NRF_POWER'
  NRF_POWER power;

It’s fairly clear that this mode is due to something bad in the files included immediately before the system files which are generating the errors, but without any other clues, I’m pretty blind to debug this.

The second is the hard bail with no error text.

In every cpp file, I am including Particle.h

Changing the code seemingly randomly changes the compile output between one of the two.

The code is fairly simplistic and not proprietary, though I’d prefer to not post it publicly. Can I PM it to you?


#7

Sure

BTW, have you thought of using Particel Workbench?
This offers local building and consequently some more degree of output in case of failure.


#8

Actually, I just found at least part of the problem!

I had an included file which contained definitions for an nrf device. The file was enormous, but eventually I isolated this to several definitions which collided with part of the BT SoC SDK. What’s really strange is that the compiler didn’t say anything about naming collisions, and the failure wasn’t totally consistent.

I’ll check out Particle Workbench, thanks for the tip!


#9

Ok, one more update.

It seems like there are are quite a few syntax or compilation issues which will cause the build process to bail with no output.

For example, trying to call, say delay.test() will result in a build with no output. Is there any good way to set error and warning flags on a per project basis?


#10

After another day of development, I can definitely say that this comes from random compile time problems. there’s an 80% chance that anything from a syntax error to use of an undeclared variable will cause the compiler to bail without an error message. This has become a serious bottleneck in my ability to get things done quickly with this platform. I’ve submitted a ticket with Particle, but no solution yet.

This issue comes and goes, and can be affected by editing completely unrelated parts of code. This makes it unbelievably difficult to track down compile time problems.

Anyone have any ideas?


#11

As said


#12

I’d really rather not use a UI based development tool. We have prebuild and post build scripts which need a Linux host, but I have to do my development on Windows because some of my test gear requires Windows only software. So, I just work SSH/SCP’d into a Linux host. I swear, it’s a lot less cumbersome than it sounds.

I’ve been working with ARM-GNU-GCC for years and never encountered anything like this, so I’m guessing it’s certainly in the Particle CLI build system. The output of ARM-GNU-GCC should be more than sufficient.

I guess that I didn’t realize that the cli uploads code to the Particle infrastructure to build it. Is that what you’re implying?

I get the sense that the cli is not really supported much. Are there plans to deprecate it?


#13

Exactly. CLI is building in the cloud, hence I could imagine that it’s some kind of timeout issue when the cloud build takes too long and hence CLI may just stop “listening” to the data stream from the cloud.


#14

Is there any hope for this to be fixed, or to use a relatively easy to setup local build system?


#15

Maybe @jvanier can chime in on the CLI question whether my suspicion that this might be a timeout issue has some merit and if so, whether this will be fixable.

Maybe he can even look into the logs to see what makes your build fail in this way.

In order to setup a local toolchain you could try these instructions


#16

You’ll probably like po-util, a popular tool I’ve been developing for a few years. It installs all the required dependencies for the local toolchain and provides a CLI interface for building/flashing firmware locally.

It works best with Ubuntu systems and macOS.

You can install it with:

bash <(curl -sL get.po-util.com)

After installation to configure po-util for mesh and create an argon project you would do:

po config v0.8.0-rc.27
po setup-mesh
po argon init myArgonProject
cd myArgonProject

Once in the project folder, there are several commands you can run to build, clean, flash via usb and ota:

po argon build # Builds the firmware/ directory and produces a binary
po argon flash # Builds the firmware/ directory and flashes the binary via usb
po argon dfu # Flashes the binary via usb
po argon ota deviceName # Flashes the binary ota with particle cli to the specifed deviceName
po argon clean # Cleans the firmware, can be necessary sometimes

Most of these commands can take the project path as an additional argument.

Example:

po argon build /home/user/myArgonProject

#17

Thanks! This looks great. I’ll install it now.


#18

Just a note that I would really like to have this working in the cli too. This is an extremely frustrating issue. Anyone at Particle who may be able to look at this? I am a commercial client, and the reason why we’re using this over my preferred platform of a bare metal microcontroller is due to the “turn key” OTA capabilities. Right now, my worst concerns of the platform are being realized, where the tools have fundamental issues and there is limited support and due to the nature of the system, I am helpless to fix anything myself.