Naive new user of Photon

Naive new user of Photon
(but very experienced with C/C++ on ARM Cortex in traditional C lib development)

Web IDE:
How can one see the linker output summary from the map file? sizes of code, rodata, rwdata? How much flash,ram is left?
How do I see/control the stack and heap sizes?
How do I create a multi-file project with mixes of .c, .c++ and .h?

stdio
Searching posts here, it seems no one has documented how to bypass the Arduino-like Serial.println() and use printf, scanf et al, via the simple stdio __write() et al so stdin, stdout can be used on USB or hardware serial. Essential for me.

Use of CLI
Instructions need a rewrite- by someone who empathizes with a newbie to Photon. As is, the instructions “start in the middle”.

local compiler.
My oh my, from other projects, I must have 5 versions of GCC on this Windows 7 PC. I tried to find clear and concise instructions on how to use a local IDE/compiler for Photon. Web IDE will do for a while. Much better than mbed did with Keil.
Most of my work has been with IAR’s EWARM and ST’s HAL (not the depreciated Standard Peripheral Libraries/SPL).
But too, I’ve used the heck out of Visual Micro’s free IDE with the free Visual Studio 2013. It’s very good. I’ve used it with Teensy 3 (ARM Cortex).
And there’s Visual GDB Excellent. This and the above are Windows-only, so for the Mac people, and the 1.3% Linux people, they don’t get on to the radar.

Hindsight will show the above dumb newbie questions, but alas.

1 Like

Hi @stevech

Welcome! I will take a shot at some of your questions.

The linker output was previously visible in the web IDE but when Photon came with modular build of just the user code, I think they took it out until they could make it right. I am sure it will come back. For now, a local build will tell you with the make target "size".

The stack and heap sizes are baked in but could be changed in a local build.

For a multi-file project in the web IDE, look for the small "circle-plus" in the upper right hand corner. Clicking this add a pair of new tabs (.h and .cpp) to your project where you can paste in code. The assumption is that your main file (.ino or sketch in Arduino-speak) gets a preprocessor applied to it to make writing C easier. This preprocessor is not robust against C++ currently and so the assumption is that you put your C++ headers and code in these tabs and the preprocessor is not applied. There has been a persistent web IDE bug with duplicated tabs that the team has been fighting, but I believe it is currently in remission.

I am sure you could hook up stdio if you built locally, but code size might swell. Arduino has a different way of handling printing and input which is easy to learn if you choose to.

I don't know much about installing the CLI on a PC--the Mac instructions worked OK for me.

The current web IDE uses arm-none-eabi-gcc 4.8.4 20140526. They tried 4.9.3 last week but it had a strong negative impact on binary size when compiling for the Particle Core (previous product) and so they reverted. You could start by reading here

2 Likes