Clear Directions on Local Build for photon firmware

Does anybody has some clear directions on

  1. Where is the Photon Firmware download place (at least one working)
  2. Which is the binary produced (even two binaries)
  3. At what memory address it should be uploaded.
  4. Has somebody tried successfully?
    ???

@yianmar, Plenty of folks have been using the (unreleased and beta) develop branch for testing code. The latest STABLE branch is photon_043 (with 044 soon to be released) which you can get here. The instructions for setting up the local toolchain are all there and the make file does all the work of compiling and flashing your app.

In short, you create an application directory for you app in the “application” folder and put all your files there (I don’t bother with sub-directories for now).

To compile and flash the latest system firmware to the Photon, from the firmware/modules directory, you run:

make clean all PLATFORM=photon program-dfu

This will compile and flash the system parts along with tinker onto your photon which should be in DFU mode prior to running the make.

You can compile and flash your app from the firmware/main directory using:

make clean all APP=appname PLATFORM=photon program-dfu

This assumes you put your photon in DFU mode.

It is important that you be in the correct directory as indicated above. :smile:

1 Like

Thanks but I have already read this…and it is not clear.

@yianmar, what is not clear? If you can be more specific on what you tried and what problems you are having, we may be able to help more :smiley:

  1. Where is the Photon Firmware download place (at least one working)
  2. Which is the binary produced (even two binaries)
  3. At what memory address it should be uploaded.
  4. Has somebody tried successfully?

@yianmar:

  1. I included a github link above for getting the latest STABLE Photon firmware - https://github.com/spark/firmware/tree/photon_043

  2. The binaries produced depend on what you are compiling. For the system firmware, the compiler produces a system-part1.bin and system-part2.bin. For your application, an appname.bin file will be produced. All these files can be found in the firmware/build/target directory structure.

  3. For system parts:

dfu-util -d 2b04:d006 -a 0 -s 0x8020000 -D system-part1.bin
dfu-util -d 2b04:d006 -a 0 -s 0x8060000:leave -D system-part2.bin

I can’t remember the user app target since I let make do all the work. You may want to look at the makefile documentation.
4. Yes, including me!

3 Likes

Just chiming in to say I did this like, 20 times yesterday while we were testing and preparing a new release, so I can attest that it does work. :slight_smile:

Thanks,
David

2 Likes

Please see the build documentation.

2. Which is the binary produced (even two binaries)

The binary location is printed as part of the build output. It’s also described in the documentation. (It’s more detail than I want to reproduce here.)

3. At what memory address it should be uploaded.

Please use the program-dfu goal so you don’t need to remember the internal details of where each module is located.

1 Like

Dear Dave, count it as a good idea, not spending clicks on llikes but writing a good documentation. No other lives in your mind , but you.

Hi @yianmar,

We’re here trying to be helpful, and @peekay123’s and @mdma’s notes are copied from the documentation. It sounds like you’re angry, but we’re here to help you. Please re-read these posts and give it a try! :slight_smile:

Thanks,
David

3 Likes

The instructions at the site you link to say to run ‘make’ from the firmware/main directory (this is in the “How do we build these repositories?” section) but I don’t have that directory in the firmware folder. Should I be running ‘make’ from firmware/applications instead?

@Ric, I believe you may have the wrong firmware then. Did you clone the new photon_043 branch from the firmware repo?

I was following the instructions in the link you posted. I ran this: “git clone https://github.com/spark/firmware.git” Is they not the correct one? I must admit, I’m a little baffled by all this jargon, so I’m not sure what you mean by “photon_043 branch from the firmware repo”.

@Ric, you are correct, that is misleading. You need to run:

git clone -b photon_043 https://github.com/spark/firmware.git

It took me a while to learn github lingo. Repo means repository for example. :smile:

OK, thanks. I’ve done that, so I’ll see if I can make it the rest of the way. Can you point me to any resource for learning about this kind of “stuff” – I’m not even sure what category the “stuff” I’m asking about is in. Things like builds, dependencies, linkers, targets, etc. This aspect of computers is pretty much all Greek to me at this point.

@Ric, there is github documentation out there but it is voluminous. As for compiling, etc. I wonder if the all-knowing @bko can point to a good reference. Is there a reason you want to compile locally versus using Particle DEV?

I don’t have a compelling reason to do it locally right now; I just want to learn to do so if I need to in the future. Is there much of an advantage to compiling locally on the Photon, since flashing over the air is so much quicker now? I haven’t tried Particle DEV yet, I’ve only been using the web based IDE.

@Ric, compiling locally gives you access to the unreleased “develop” branch and allows you to play with the entire firmware. I compile locally to test unreleased code. For most of my project, however, I use Particle CLI and/or Particle DEV since I can do so much with both compiling and cloud stuff. For example, I can monitor a Spark.variable() or call a Spark.function. I encourage you to check these out since they use the Cloud to compile which has the latest stable firmware release. :smile:

Hi @Ric and @peekay123

@peekay123 is right that compiling locally gives you full control over all the code that runs on your Core or Photon, but it comes with some responsibility. If you only change the normal user code, you can’t really do any more harm than with the cloud methods. On the other hand if you start changing system code, you can do a lot a bad things to your device if you don’t know what you are doing.

If you are helping to write or test changes in the system code, compiling locally is the only way to do it, so a lot of us are doing it for that reason.

Compiling locally can also give you a faster debug cycle since everything happens on your computer and over USB but for most things it is about the same.

1 Like

This did not work for me. I downloaded the source files, I followed the build documentation. I did the following:

cd modules
make PLATFORM=photon clean all

This failed here is the last portion of that result (see below)
I went to the folder …/build/target/communication/platform-6-m-lto-prod-6/lib/tropicssl/library/
and there is no files in there.

Any ideas ?

make (e=2): The system cannot find the file specified.
make[2]: *** […/build/target/communication/platform-6-m-lto-prod-6/lib/tropicssl/library/aes.o] Error 2
make[2]: Leaving directory C:/Z/communication' make[1]: *** [communication] Error 2 make[1]: Leaving directoryC:/Z/modules/photon/system-part1’
make: *** [C:/Z/modules/photon/system-part1/makefile] Error 2