Local Compile using Netbeans giving errors

Hello Everyone,

After some trial and error i got NB setup and building locally. I setup a folder in my application directory and corrected the include paths. It still keep giving me this error on compile. What am i doing wrong?

cd 'C:\Particle\firmware'
C:/Particle/Toolchain/MinGW/msys/1.0/bin/sh.exe -c 'C:/Particle/Toolchain/GCC-ARM/bin/arm-none-eabi-g++.exe' -g -I../../firmware/user/src -I../../firmware/wiring/inc -I../../firmware/hal/inc -I../../firmware/hal/src/stm32f2xx -I../../firmware/platform/MCU/STM32F2xx/CMSIS/Device/ST/Include -I../../firmware/hal/shared -I../../Toolchain/GCC-ARM/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits -I../../firmware/system/inc -I../../firmware/communication/src -I../../firmware/hal/src/photon/api -I../../firmware/user/inc -I../../firmware/platform/MCU/STM32F2xx/CMSIS/Include -I../../firmware/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc -I../../firmware/platform/shared -I../../firmware/platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/inc -I../../firmware/services/inc -I../../firmware/dynalib/inc -I../../firmware/user -I../../firmware/user/inc -o NUL -c '/C/Particle/firmware/user/applications/newFirmware/TimeAlarms.cpp'
In file included from c:/Particle/firmware/user/applications/newFirmware/TimeAlarms.cpp:27:0:
c:/Particle/firmware/user/applications/newFirmware/TimeAlarms.h:6:37: fatal error: ../user/inc/application.h: No such file or directory
 #include "../user/inc/application.h"
                                     ^
compilation terminated.

COMPILE FILE FAILED (exit value 1, total time: 185ms)

I use a Mac and Eclipse, but I’m guessing that you should cd not to the firmware directory, but one level in. I use firmware/modules for the whole thing including system firmware and firmware/main for just the app. That would sort of match with your missing …/user/ include, since it’s looking one level higher than where the user directory is.

Thanks for your suggestion. Im not sure if i fully understand it though.

That’s the way the current structure is laid out.
So what you’re saying is that because the include is one level above it gives me the error.
I do not understand what “use firmware/modules for the whole thing” means?

What makefile are you using.
If you look in your “C:\Particle\firmware” folder, you’ll see a sub-folder “modules” and the makefile in there would be the one to use.

Yes, what ScruffR said. Basically, my Eclipse IDE build runs an external make like this:

cd "$(BASEDIR)/modules" && make all PLATFORM=photon APPDIR="$(CURDIR)"

where BASEDIR is the firmware directory path, and CURDIR is the directory where the application source code resides.

1 Like

Please excuse my noobness. I start a new project in NB by selecting c++ with existing sources. Browse to the location of the firmware folder that i cloned.

Next i select custom and it comes to this page

I dont see a place to enter the path to the makefile in the modules folder. Do i enter the
“make all PLATFORM=photon APPDIR=”$(CURDIR)" in the build command option.

I believe you need something like:

Working Directory: C:/Particle/firmware/modules
Clean Command: $(MAKE) -f makefile clean PLATFORM=photon
Build Command: $(MAKE) -f makefile all PLATFORM=photon APPDIR=?????

The ??? is something, but I don’t know what and I couldn’t find the answer in a quick Google search. It might be something like ${ProjectDir}, though you could just put the path to the directory containing your application source temporarily, because it’s probably not actually ${ProjectDir}, but something similar.

1 Like

Thank you! That’s very very helpful. Maybe @ScruffR can throw some light on the APPDIR = ??? question.

Is it PROJECT_LOC or ${project_loc} you are looking for?

http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fcpathvars.htm

@rickkas7

I followed those instructions when starting a new project. I do not get the option of selecting the device, it only show default config. The project did build and clean successfully.

Update

I built using the command line. First ran make in modules and then make in applications with APP=myapp. And it built as expected. I repeated the same commands in the project options in NB and that worked too. However i cannot hit copile in netbeans without it giving the missing application.h error. Infact the include statement does not even browse to that file.

Any thoughts??

Update 2

I finally figured out how everything works. Read https://github.com/spark/firmware/blob/develop/docs/gettingstarted.md

and

a few times and did everything using the CLI to see if it works before moving into NB.
I flashed OTA using CLI but how would i put that in the run command to flash OTA from wihin NB?

I have been compiling using Netbeans since a few months now. I compile locally but upload using the cloud. So the moment i hit run it runs particle flash. I started receiving this error a few minutes ago. I can flash using the CLI without issues but i cannot get it to run through netbeans. Anyone knows whats going on here?