Closed deadprogram closed 5 years ago
I think it is much easier to detect it based on the presence of the {hex}
or {bin}
substrings in target.Flasher. That should be trivial to implement as well, and doesn't require an extra option in the JSON file.
Do you mean to rename the target to something like itsybitsy-m0.bin.json
and then determine the resulting file type by parsing the substring out of the file name?
No, to see whether the "flash" attribute in the JSON file contains {hex}
or {bin}
. For example:
"flash": "bossac -d -i -e -w -v -R --offset=0x2000 {hex}"
vs
"flash": "bossac -d -i -e -w -v -R --offset=0x2000 {bin}"
That makes a lot more sense. OK I will look at creating PR for that.
This code is now in dev
branch. Now closing.
At the moment, the command
tinygo flash
will automatically assume that the target file to be compiled should be a HEX file, due to this parameter here: https://github.com/aykevl/tinygo/blob/master/main.go#L313This is a small problem when using the
bossac
command with the UF2 bootloader.bossac
works as expected only when flashing .BIN files. It will appear to flash theHEX
file, but does not correctly complete the process of setting the user's code for execution. Hence when the MCU restarts, it returns to the bootloader mode, instead of starting up the user's code.What I propose is to add a new key named "outputFormat" to the target.json file, which lets you set a desired output format. The default can be
.hex
if not specified.