Local Development

So I’ve been playing with local development with the spark core, it’s all pretty self explanatory.

So I started with a directory structure that looks like this.

core-common-lib
core-communication-lib
core-firmware

And pretty soon it started to look like this.

core-common-lib
core-communication-lib
core-firmware
core-firmware-project-1
core-firmware-project-2
core-firmware-project-3
core-firmware-project-4
core-firmware-project-5
core-firmware-project-etc

Basically I’m duplicating the core-firmware and adding in libraries and editing just the application.cpp file.

I’d really prefer one copy of core-firmware to maintain and a dedicated location for libraries and applications (could use the Arduino terminology of sketches to help non programers)

So I’d like to see

core-common-lib
core-communication-lib
core-firmware
spark-examples
user-libraries (same structure as Arduino libraries) e.g. Code and example folders
user-sketches (with a folder per sketch)

unfortunately i’m not enough of a makefile wizard to build this out at this stage.

1 Like

did you actually get it to build then? i keep getting this when i try, like its not finding /usr/include/stdlib.h

In file included from ../CC3000_Host_Driver/cc3000_common.c:46:0:
../CC3000_Host_Driver/cc3000_common.h:41:20: fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>
                    ^
compilation terminated.
make[1]: *** [obj/CC3000_Host_Driver/cc3000_common.o] Error 1
make: *** [check_external_deps] Error 2

this is debian jessie/sid x86_64

Yup i’ve basically followed the walkthrough on https://github.com/spark/core-firmware. I’ve set up the described environment on a couple of machines now with no problems. I’m on OS X.

Note to Spark peoples in the blank space under http://docs.spark.io/#/start/writing-core-firmware-the-spark-command-line you could just put a link to the exiting information at https://github.com/spark/core-firmware.

seems newlib isn’t being found, adding -I/usr/include/newlib to CFLAGS gets me a bit further, but then it seems the debian packaged arm-none-eabi doesn’t include c++ support:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732974

I’ll try rebuilding the cross environment

well c++ support has been enabled in the debian package now but it seems that the makefiles haven’t been tested on 64-bit linux with multilib as now i’m getting:

Building target: core-firmware.elf
Invoking: ARM GCC C++ Linker
arm-none-eabi-g++ -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb  -I../inc -I../../core-common-lib/CMSIS/Include -I../../core-common-lib/CMSIS/Device/ST/STM32F10x/Include -I../../core-common-lib/STM32F10x_StdPeriph_Driver/inc -I../../core-common-lib/STM32_USB-FS-Device_Driver/inc -I../../core-common-lib/CC3000_Host_Driver -I../../core-common-lib/SPARK_Firmware_Driver/inc -I../../core-communication-lib/lib/tropicssl/include -I../../core-communication-lib/src -I. -ffunction-sections -Wall -fmessage-length=0 -MD -MP -MF core-firmware.elf.d -DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DDFU_BUILD_ENABLE  obj/src/application.o obj/src/main.o obj/src/newlib_stubs.o obj/src/spark_utilities.o obj/src/spark_wiring.o obj/src/spark_wiring_i2c.o obj/src/spark_wiring_interrupts.o obj/src/spark_wiring_ipaddress.o obj/src/spark_wiring_network.o obj/src/spark_wiring_print.o obj/src/spark_wiring_servo.o obj/src/spark_wiring_spi.o obj/src/spark_wiring_stream.o obj/src/spark_wiring_string.o obj/src/spark_wiring_tcpclient.o obj/src/spark_wiring_tcpserver.o obj/src/spark_wiring_udp.o obj/src/spark_wiring_usartserial.o obj/src/spark_wiring_usbserial.o obj/src/spark_wlan.o obj/src/stm32_it.o obj/src/usb_desc.o obj/src/usb_endp.o obj/src/usb_istr.o obj/src/usb_prop.o obj/src/wifi_credentials_reader.o obj/startup/startup_stm32f10x_md.o --output core-firmware.elf -T../linker/linker_stm32f10x_md_dfu.ld -nostartfiles -Xlinker --gc-sections  -L../../core-common-lib/build -lcore-common-lib -L../../core-communication-lib/build -lcore-communication-lib -Wl,-Map,core-firmware.map
/usr/bin/arm-none-eabi-ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
make: *** [core-firmware.elf] Error 1

looks like this was resolved: https://github.com/spark/core-firmware/issues/60

well not really solved, but i worked around the problem.

basically the debian packages are useless as even though they now include a c++ compiler they don’t include many libs.

so download [gcc-arm-none-eabi-4_8-2013q4-20131204-linux.tar.bz2][1], untar it and add its bin/ directory to your $PATH, then “make” will succeed. its not a great way of doing things but it works.

p.s. make sure to uninstall the debian packages as they get found first in your $PATH.
[1]: https://launchpad.net/gcc-arm-embedded/4.8/4.8-2013-q4-major/+download/gcc-arm-none-eabi-4_8-2013q4-20131204-linux.tar.bz2

1 Like