Question about compiler its version and other configs


I am using Particle cloud compilation to build my P2 target using 5.3.1. The output binary when flashed works fine on my device.

The questions are-
1- How can I find what compiler and version were used?
2- How to find the optimization and warning configurations?

We need this information for project documentation and success.

Appreciate all the help.


Go to Github and switch to the tag for the release you want, in your case v5.3.1.

Open build/

For the C++ compiler flags, look for the CPPFLAGS lines.

The compiler is always gcc-arm. The version is specified in the expected_version_str line. For Device OS 5.3.1, it's gcc-arm 10.2.1.

You could also compile code with an intentional error and read the compiler flags out of the error log but the gcc version isn't listed in that log.

1 Like

I have a different issue. It is clear based on the output that Particle-CLI builds are using gcc and Make.. But that is all occuring inside Particle-CLI as a wrapper. If I am using Make from the outside to run Particle compile - how can I pass defines etc to the build ?

Also the build is actually taking place in the src directory - not the directory I am in when I invoke particle compile. This poses a problem because all the file names in errors and warnings are relative to the src directory, not the project directory.
That completely screws up any automated or other tools that work off the output of the compile as all the paths are wrong.

Normally in Vime I can find and error in the listing and type "gf" to open the file that had the error in it. There are other tools that will take me to the line with the error.
None of this works with particle compile because the compile does not take place in the project directory.

Any ideas how to deal with this ?

We do not recommend attempting to build source in arbitrary directories. You would need to modify the Device OS Makefile for the user binary in order to do that. Using src, including subdirectories of src and pseudo libraries is the recommended method.

To modify CFLAGS, you can add a file in the src directory (not the top level!) and append your flags.