Spark-cli flash minor documentation bug

hey,

when you do a spark flash command, the following shows up as “usage examples”

USE:
    spark flash core_id firmware.bin [--usb]
    spark flash core_id source_folder [--usb]
    spark flash core_id file1.ino file2.cpp file2.h file3.cpp [--usb]

but in my experience, the --usb must be put in after the command “flash”

so it should really be

USE:
    spark flash [--usb] core_id firmware.bin 
    spark flash [--usb] core_id source_folder
    spark flash [--usb] core_id file1.ino file2.cpp file2.h file3.cpp

Hmm…

I’m trying to send a PR to fix this BUT the issue is…

If you use --usb there is no need for core_id.

Wondering how we can better phrase it!

@avidan and @kennethlimcp, spark flash core_id… is used when doing OTA and spark flash --usb is used for doing flash over USB.

I know what you mean but the help stuff seems to suggest that --usb is added to the end of the command when you read it literally.

@kennethlimcp, I just read the Spark CLI flash documentation and it is all over the place. It suggests you can flash files to your core that are not .bin! It also seems to suggest that you can flash a directory of files implying it will compile them but a little further down in the text it does say to use spark compile!

I tried "flashing" a directory of files but it does not compile them first. So I am not sure where that description came from and it needs to be rewritten.

spark flash
Sends a firmware binary, a source file, or a directory of source files, or a known app to your core.

Flashing a directory
You can setup a directory of source files and libraries for your project, and the CLI will use those when compiling remotely. You can also create spark.include and / or a spark.ignore file in that directory that will tell the CLI specifically which files to use or ignore.

Flashing one or more source files

The first part, IMO, is incorrect and should only say "firmware binary and a known app". The second part is garbage and only applies to the spark compile command. The last part is like the second and not applicable. Any thoughts?

I think it should be correct but is broken. Will review the code and see.

@peekay123, i tested and it works fine :wink:

@avidan, here’s the PR for this issue: https://github.com/spark/spark-cli/pull/78

@kennethlimcp, with --usb, it doesn’t send the files for compiling. With core-id, it does so ya, it seems a bit broken. What the documentation does NOT say is that any file other than .bin will be compiled and NOT sent raw to the core.

Yup, that’s why i sent a PR to fix the help text :smiley:

Hey All!

Hmm, that looks like a bug, you should be able to flash via USB DFU source files, that are compiled first, then downloaded, and then flashed locally. I’d rather fix the bug than change the documentation to cover up the bug, so I’ll jump on this as soon as I get a chance. :slight_smile:

Thanks!
David

2 Likes

@Dave,

Looking at the behavior, it seems like the function is looking for a core before performing the compilation. This might help you resolve it faster :wink:

Anyway…the documentation needs to be fixed irregardless. Some minor pointers mentioned in the PR.

1 Like

I like your idea Dave. It would be great to have a folder as an argument and have a complete compile and flash in one…

3 Likes