Local building for Core+Photon

Thank you for the two answers.

Here the tests I've conducted so far.


Configuration

Tool-chain and SDK located at
/Users/ReiVilo/Library/embedXcode/gcc-arm-none-eabi-4_9-2015q2 /Users/ReiVilo/Library/embedXcode/Particle-new with firmware-latest branch

Projects are located at
/Users/ReiVilo/Desktop/particle-1 /Users/ReiVilo/Desktop/particle-2 /Users/ReiVilo/Desktop/particle-3


Test 1

The particle-1 folder contains
/Users/ReiVilo/Desktop/particle-1/LocalLibrary.cpp /Users/ReiVilo/Desktop/particle-1/LocalLibrary.h /Users/ReiVilo/Desktop/particle-1/main.cpp

Test 1a

  • Launch cd ~/Library/embedXcode/Particle-new/firmware/modules

  • Launch make v=1 GCC_ARM_PATH=/Users/ReiVilo/Library/embedXcode/gcc-arm-none-eabi-4_9-2015q2/bin/ COMPILE_LTO=n PLATFORM_ID=6 APPDIR=/Users/ReiVilo/Desktop/particle-1 TARGET_DIR=/Users/ReiVilo/Desktop/particle-1/Builds TARGET_FILE=embeddedcomputing clean all program-dfu > ~/Desktop/particle-1/1a.txt

  • Result: OK.

Test 1b

Change the number of blinks, e.g. blink(myLED, 1, 333); for blink(myLED, 2, 333);

  • Launch make v=1 GCC_ARM_PATH=/Users/ReiVilo/Library/embedXcode/gcc-arm-none-eabi-4_9-2015q2/bin/ COMPILE_LTO=n PLATFORM_ID=6 APPDIR=/Users/ReiVilo/Desktop/particle-1 TARGET_DIR=/Users/ReiVilo/Desktop/particle-1/Builds TARGET_FILE=embeddedcomputing program-dfu > ~/Desktop/particle-1/1b.txt

  • Result: NOK

Omitting clean all fails: old code is kept, new code not taken into account. The LED still blinks once, not twice.

Test 1c

  • Launch make v=1 GCC_ARM_PATH=/Users/ReiVilo/Library/embedXcode/gcc-arm-none-eabi-4_9-2015q2/bin/ COMPILE_LTO=n PLATFORM_ID=6 APPDIR=/Users/ReiVilo/Desktop/particle-1 TARGET_DIR=/Users/ReiVilo/Desktop/particle-1/Builds TARGET_FILE=embeddedcomputing clean all program-dfu > ~/Desktop/particle-1/1c.txt

  • Result: OK.

Question 1

Is clean all compulsory? Why to build the whole framework each time? Why to upload 3 packages each time, when only the latest one changes?
Downloading to address = 0x08020000, size = 249148 Downloading to address = 0x08060000, size = 169036 Downloading to address = 0x080a0000, size = 2272

Question 2

How to get rid of those messages?
fatal: Not a git repository (or any of the parent directories): .git

Question 3

What is the meaning of COMPILE_LTO=n, which is not documented at https://github.com/spark/firmware/blob/develop/docs/build.md?


Test 2

The particle-2 folder contains
/Users/ReiVilo/Desktop/particle-2/blink.ino /Users/ReiVilo/Desktop/particle-2/LocalLibrary.cpp /Users/ReiVilo/Desktop/particle-2/LocalLibrary.h /Users/ReiVilo/Desktop/particle-2/main.cpp

Test 2a

Sketch uses an .ino extension. main.cpp mentions #include "blink.ino"

  • Launch make v=1 GCC_ARM_PATH=/Users/ReiVilo/Library/embedXcode/gcc-arm-none-eabi-4_9-2015q2/bin/ COMPILE_LTO=n PLATFORM_ID=6 APPDIR=/Users/ReiVilo/Desktop/particle-2 TARGET_DIR=/Users/ReiVilo/Desktop/particle-2/Builds TARGET_FILE=embeddedcomputing clean all program-dfu > ~/Desktop/particle-2/2a.txt
  • Result: OK.

Question 1, Question 2, Question 3

Same as per Test 1.

Test 2b

Change the number of blinks, e.g. blink(myLED, 1, 333); for blink(myLED, 2, 333);

  • Launch make v=1 GCC_ARM_PATH=/Users/ReiVilo/Library/embedXcode/gcc-arm-none-eabi-4_9-2015q2/bin/ COMPILE_LTO=n PLATFORM_ID=6 APPDIR=/Users/ReiVilo/Desktop/particle-2 TARGET_DIR=/Users/ReiVilo/Desktop/particle-2/Builds TARGET_FILE=embeddedcomputing program-dfu > ~/Desktop/particle-2/2b.txt
  • Result: NOK.

Test 2c

Separating building and linking from uploading. Uploading done through USB or OTA.

  • Launch make v=1 GCC_ARM_PATH=/Users/ReiVilo/Library/embedXcode/gcc-arm-none-eabi-4_9-2015q2/bin/ COMPILE_LTO=n PLATFORM_ID=6 APPDIR=/Users/ReiVilo/Desktop/particle-2 TARGET_DIR=/Users/ReiVilo/Desktop/particle-2/Builds TARGET_FILE=embeddedcomputing clean all > ~/Desktop/particle-2/2c.txt

  • Launch particle flash ABCDEFGHIJKLMNOPQRSTUVWX /Users/ReiVilo/Desktop/particle-2/Builds/embeddedcomputing.bin

  • Result: Success rate = 60%.

Connection fails although the LED pulses cyan and the board is listed as online. Error message is

Flash device failed
[object Object]

  • Launch particle flash --usb /Users/ReiVilo/Desktop/particle-2/Builds/embeddedcomputing.bin
  • Result: OK.

Question 4

How to upload the program OTA with success rate = 100%?


Test 3

The particle-3 folder contains
/Users/ReiVilo/Desktop/particle-3/blink.ino /Users/ReiVilo/Desktop/particle-3/LocalLibrary.cpp /Users/ReiVilo/Desktop/particle-3/LocalLibrary.h /Users/ReiVilo/Desktop/particle-3/main.cpp /Users/ReiVilo/Desktop/particle-3/Particle_fast.mk

Particle_fast.mk include a variable definition MY_IDE, which is tested on main.cpp and blink.ino
CPPFLAGS += -DMY_IDE=310 CFLAGS += -DMY_IDE=310

  • Launch make v=1 GCC_ARM_PATH=/Users/ReiVilo/Library/embedXcode/gcc-arm-none-eabi-4_9-2015q2/bin/ COMPILE_LTO=n PLATFORM_ID=6 APPDIR=/Users/ReiVilo/Desktop/particle-3 TARGET_DIR=/Users/ReiVilo/Desktop/particle-3/Builds TARGET_FILE=embeddedcomputing USER_MAKEFILE=Particle_fast.mk clean all program-dfu > ~/Desktop/particle-3/3a.txt
  • Result: NOK.

Question 5

How to specify variables in the makefile?

Thank you!