Building spark/firmware "locally" on a cloud development server

I would appreciate anyone’s help on this. I am stuck.

Goal

I am attempting to follow the adafruit guide for ARM GCC and the DFU Bootloader (Offline) on a cloud development machine hosted by [c9.io] (https://c9.io). I had to obtain GNU Tools for ARM and install the files.

Motivation

I think that getting this working on in a c9 environment would greatly benefit a lot of people. By setting it up in a c9.io workspace it could easily be cloned by other users and then used. The workspace is publicly available to view and I would be happy to share edit rights with a few people.

Current Roadblock

Currently I am running into an error when I try to run make on the master branch of spark/firmware.

>>make PLATFORM=photon clean all

Results in the the error:

make -C ./communication 
make[1]: Entering directory `/home/ubuntu/workspace/firmware/communication'
Building file: lib/mbedtls/library/aes.c
Invoking: ARM GCC C Compiler
mkdir -p ../build/target/communication/platform-6-prod-6/./lib/mbedtls/library/
arm-none-eabi-gcc -DSTM32_DEVICE -DSTM32F2XX -DPLATFORM_THREADING=1 -DPLATFORM_ID=6 -DPLATFORM_NAME=photon -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD006 -DUSBD_PID_CDC=0xC006 -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb -DPRODUCT_ID=6 -DPRODUCT_FIRMWARE_VERSION=65535 -DSYSTEM_VERSION_STRING=0.5.1 -DRELEASE_BUILD -Werror -I./src -I../hal/inc -I../hal/shared -I../hal/src/photon -I../hal/src/stm32f2xx -I../hal/src/stm32 -I../hal/src/photon/api -I../dynalib/inc -I../services/inc -I./lib/mbedtls/include -I./lib/tropicssl/include -Ilib/tropicssl/include -I. -MD -MP -MF ../build/target/communication/platform-6-prod-6/./lib/mbedtls/library/aes.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DMBEDTLS_CONFIG_FILE="<mbedtls_config.h>" -D_GNU_SOURCE -D_WINSOCK_H  -Wno-pointer-sign -std=gnu99 -c -o ../build/target/communication/platform-6-prod-6/./lib/mbedtls/library/aes.o lib/mbedtls/library/aes.c
In file included from /usr/local/lib/gcc/arm-none-eabi/5.4.1/include-fixed/syslimits.h:7:0,
                 from /usr/local/lib/gcc/arm-none-eabi/5.4.1/include-fixed/limits.h:34,
                 from ./lib/mbedtls/include/mbedtls/check_config.h:36,
                 from ./src/mbedtls_config.h:2529,
                 from lib/mbedtls/library/aes.c:31:
/usr/local/lib/gcc/arm-none-eabi/5.4.1/include-fixed/limits.h:168:61: error: no include path in which to search for limits.h
lib/mbedtls/library/aes.c:38:20: fatal error: string.h: No such file or directory
compilation terminated.
make[1]: *** [../build/target/communication/platform-6-prod-6/./lib/mbedtls/library/aes.o] Error 1

Previous Work

It would seem that ARM-gcc installed correctly.

>>arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 5.4.1 20160609 (release) [ARM/embedded-5-branch revision 237715]
Copyright (C) 2015 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.

Ping @wgbartley

I don’t have an actual answer, but in my working local compile installation, there are 4 copies of limits.h in my gcc-arm directory:

find . -name limits.h -print
./arm-none-eabi/include/c++/5.2.1/tr1/limits.h
./arm-none-eabi/include/limits.h
./lib/gcc/arm-none-eabi/5.2.1/include-fixed/limits.h
./lib/gcc/arm-none-eabi/5.2.1/install-tools/include/limits.h

And string.h:

find . -name string.h -print
./arm-none-eabi/include/string.h
./arm-none-eabi/include/sys/string.h

I think it would be best to use po-util in this case. It lets you easily install the Particle Toolchain and compile code.

I set up a Cloud 9 workspace today and I managed to install po-util on it and compile firmware.

Awesome job!

I will read more about po-util; it looks like a very easy way to install all the dependencies. I will look to your c9 workspace if I get stuck.

I definitely think that the docs for particle should mention this great utility.

1 Like