Skip to content

Commit

Permalink
Merge pull request #497 from particle-iot/feature/deviceos-121
Browse files Browse the repository at this point in the history
Update for Device OS for 1.2.1
  • Loading branch information
technobly authored Jul 12, 2019
2 parents 49e0054 + d227c71 commit da1155f
Show file tree
Hide file tree
Showing 38 changed files with 118 additions and 58 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ Anything after the `--` delimeter is passed directly to the CLI ([docs](https://
- `npm run update-firmware-binaries <version>`
where `<version>` is the newly released system firmware version like 0.7.0

- If a particular device requires `requiresBootloaderAscenderApp: true` found in `src/lib/deviceSpecs/specifications.js` then a manual step is required that replaces the firmware files copied from the above step with the special system firmware required that allows the bootloader to be updated by the ascender.bin user app. There will be a draft release in the `particle-iot/firmware` repo containing these files.

- Test on each platform by doing

```
Expand Down
Binary file added assets/updates/argon-bootloader@1.2.1.bin
Binary file not shown.
Binary file removed assets/updates/argon-system-part1@1.1.1.bin
Binary file not shown.
Binary file added assets/updates/argon-system-part1@1.2.1.bin
Binary file not shown.
Binary file removed assets/updates/ascender-1.1.1-p1.bin
Binary file not shown.
Binary file removed assets/updates/ascender-1.1.1-photon.bin
Binary file not shown.
Binary file added assets/updates/asom-bootloader@1.2.1.bin
Binary file not shown.
Binary file removed assets/updates/asom-system-part1@1.1.1.bin
Binary file not shown.
Binary file added assets/updates/asom-system-part1@1.2.1.bin
Binary file not shown.
Binary file added assets/updates/boron-bootloader@1.2.1.bin
Binary file not shown.
Binary file removed assets/updates/boron-system-part1@1.1.1.bin
Binary file not shown.
Binary file added assets/updates/boron-system-part1@1.2.1.bin
Binary file not shown.
Binary file added assets/updates/bsom-bootloader@1.2.1.bin
Binary file not shown.
Binary file removed assets/updates/bsom-system-part1@1.1.1.bin
Binary file not shown.
Binary file added assets/updates/bsom-system-part1@1.2.1.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions assets/updates/ota-flag-a5.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Binary file added assets/updates/p1-bootloader@1.2.1.bin
Binary file not shown.
Binary file not shown.
Binary file added assets/updates/p1-system-part2@1.2.1.bin
Binary file not shown.
Binary file added assets/updates/photon-bootloader@1.2.1.bin
Binary file not shown.
Binary file not shown.
Binary file added assets/updates/photon-system-part2@1.2.1.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added assets/updates/xenon-bootloader@1.2.1.bin
Binary file not shown.
Binary file removed assets/updates/xenon-system-part1@1.1.1.bin
Binary file not shown.
Binary file added assets/updates/xenon-system-part1@1.2.1.bin
Binary file not shown.
Binary file added assets/updates/xsom-bootloader@1.2.1.bin
Binary file not shown.
Binary file removed assets/updates/xsom-system-part1@1.1.1.bin
Binary file not shown.
Binary file added assets/updates/xsom-system-part1@1.2.1.bin
Binary file not shown.
47 changes: 32 additions & 15 deletions settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,38 +86,55 @@ var settings = {
},
updates: {
'2b04:d006': {
systemFirmwareOne: 'system-part1-1.1.1-photon-no-boot-dep.bin',
systemFirmwareTwo: 'system-part2-1.1.1-photon-no-boot-dep.bin',
userFirmware: 'ascender-1.1.1-photon.bin'
systemFirmwareOne: 'photon-system-part1@1.2.1.bin',
systemFirmwareTwo: 'photon-system-part2@1.2.1.bin',
otaRegion: 'photon-bootloader@1.2.1.bin',
otaFlag: 'ota-flag-a5.bin'
},
'2b04:d008': {
systemFirmwareOne: 'system-part1-1.1.1-p1-no-boot-dep.bin',
systemFirmwareTwo: 'system-part2-1.1.1-p1-no-boot-dep.bin',
userFirmware: 'ascender-1.1.1-p1.bin'
systemFirmwareOne: 'p1-system-part1@1.2.1.bin',
systemFirmwareTwo: 'p1-system-part2@1.2.1.bin',
otaRegion: 'p1-bootloader@1.2.1.bin',
otaFlag: 'ota-flag-a5.bin'
},
'2b04:d00a': {
// The bin files MUST be in this order to be flashed to the correct memory locations
systemFirmwareOne: 'electron-system-part2@1.1.1+debug.bin',
systemFirmwareTwo: 'electron-system-part3@1.1.1+debug.bin',
systemFirmwareThree: 'electron-system-part1@1.1.1+debug.bin'
systemFirmwareOne: 'electron-system-part2@1.2.1+debug.bin',
systemFirmwareTwo: 'electron-system-part3@1.2.1+debug.bin',
systemFirmwareThree: 'electron-system-part1@1.2.1+debug.bin'
// For now, electron still contains the bootloader in system firmware
// otaRegion: 'electron-bootloader@1.2.1.bin',
// otaFlag: 'ota-flag-a5.bin'
},
'2b04:d00c': {
systemFirmwareOne: 'argon-system-part1@1.1.1.bin'
systemFirmwareOne: 'argon-system-part1@1.2.1.bin',
otaRegion: 'argon-bootloader@1.2.1.bin',
otaFlag: 'ota-flag-a5.bin'
},
'2b04:d00d': {
systemFirmwareOne: 'boron-system-part1@1.1.1.bin'
systemFirmwareOne: 'boron-system-part1@1.2.1.bin',
otaRegion: 'boron-bootloader@1.2.1.bin',
otaFlag: 'ota-flag-a5.bin'
},
'2b04:d00e': {
systemFirmwareOne: 'xenon-system-part1@1.1.1.bin'
systemFirmwareOne: 'xenon-system-part1@1.2.1.bin',
otaRegion: 'xenon-bootloader@1.2.1.bin',
otaFlag: 'ota-flag-a5.bin'
},
'2b04:d016': {
systemFirmwareOne: 'asom-system-part1@1.1.1.bin'
systemFirmwareOne: 'asom-system-part1@1.2.1.bin',
otaRegion: 'asom-bootloader@1.2.1.bin',
otaFlag: 'ota-flag-a5.bin'
},
'2b04:d017': {
systemFirmwareOne: 'bsom-system-part1@1.1.1.bin'
systemFirmwareOne: 'bsom-system-part1@1.2.1.bin',
otaRegion: 'bsom-bootloader@1.2.1.bin',
otaFlag: 'ota-flag-a5.bin'
},
'2b04:d018': {
systemFirmwareOne: 'xsom-system-part1@1.1.1.bin'
systemFirmwareOne: 'xsom-system-part1@1.2.1.bin',
otaRegion: 'xsom-bootloader@1.2.1.bin',
otaFlag: 'ota-flag-a5.bin'
},
},
};
Expand Down
32 changes: 1 addition & 31 deletions src/cmd/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const dfu = require('../lib/dfu');
const when = require('when');
const whenNode = require('when/node');
const Spinner = require('cli-spinner').Spinner;
const deviceSpecs = require('../lib/deviceSpecs');
const utilities = require('../lib/utilities');

Spinner.setDefaultSpinnerString(Spinner.spinners[7]);
const spin = new Spinner('Updating system firmware on the device...');
Expand All @@ -33,34 +31,6 @@ function doUpdate(id) {
);
}
const parts = Object.keys(updates);
const specs = deviceSpecs[id];
/**
* Some firmwares also require updating the system bootloader.
*/
if (specs.requiresBootloaderAscenderApp) {
const filename = 'user_firmware_backup.bin';

steps.push((next) => {
utilities.tryDelete(filename);

// save the current user firmware
whenNode.bindCallback(
dfu.read(filename, 'userFirmware', false)
, next);
});

steps.push((next) => {
whenNode.bindCallback(
dfu.write(filename, 'otaRegion', false)
, next);
});

steps.push((next) => {
whenNode.bindCallback(
utilities.tryDelete(filename)
, next);
});
}

parts.forEach((part, partNumber) => {
steps.push((next) => {
Expand All @@ -74,7 +44,7 @@ function doUpdate(id) {

console.log();
console.log(chalk.cyan('>'), 'Your device is ready for a system update.');
console.log(chalk.cyan('>'), 'This process should take about ' + (specs.requiresBootloaderAscenderApp?50:30) + ' seconds. Here it goes!');
console.log(chalk.cyan('>'), 'This process should take about 30 seconds. Here it goes!');
console.log();

if (global.verboseLevel > 0) {
Expand Down
91 changes: 81 additions & 10 deletions src/lib/deviceSpecs/specifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const specs = {
},
'2b04:d006': {
productName: 'Photon',
requiresBootloaderAscenderApp: true,
tcpServerKey: {
address: '2082',
size: 512,
Expand Down Expand Up @@ -99,10 +98,6 @@ const specs = {
alt: '0',
size: 128*1024
},
otaRegion: {
address: '0x080C0000',
alt: '0'
},
systemFirmwareOne: {
address: '0x08020000',
alt: '0'
Expand All @@ -111,6 +106,15 @@ const specs = {
address: '0x08060000',
alt: '0'
},
otaRegion: {
address: '0x080C0000',
alt: '0'
},
otaFlag: {
address: '1753',
alt: '1',
size: '1'
},
knownApps: {
'tinker': 'tinker-0.4.5-photon.bin',
'doctor': 'photon_doctor.bin',
Expand All @@ -133,7 +137,6 @@ const specs = {
},
'2b04:d008': {
productName: 'P1',
requiresBootloaderAscenderApp: true,
tcpServerKey: {
address: '2082',
size: 512,
Expand Down Expand Up @@ -164,10 +167,6 @@ const specs = {
alt: '1',
alg: 'ec'
},
otaRegion: {
address: '0x080C0000',
alt: '0'
},
factoryReset: {
address: '0x080E0000',
alt: '0'
Expand All @@ -185,6 +184,15 @@ const specs = {
address: '0x08060000',
alt: '0'
},
otaRegion: {
address: '0x080C0000',
alt: '0'
},
otaFlag: {
address: '1753',
alt: '1',
size: '1'
},
knownApps: {
'tinker': 'tinker-0.4.5-p1.bin',
'doctor': 'p1_doctor.bin',
Expand Down Expand Up @@ -254,6 +262,15 @@ const specs = {
address: '0x08060000',
alt: '0'
},
otaRegion: {
address: '0x080C0000',
alt: '0'
},
otaFlag: {
address: '1753',
alt: '1',
size: '1'
},
userFirmware: {
address: '0x08080000',
alt: '0'
Expand Down Expand Up @@ -372,6 +389,15 @@ const specs = {
address: '0x00030000',
alt: '0'
},
otaRegion: {
address: '0x80289000',
alt: '2'
},
otaFlag: {
address: '1753',
alt: '1',
size: '1'
},
knownApps: {
'tinker': 'tinker-0.8.0-rc.27-argon.bin'
},
Expand Down Expand Up @@ -426,6 +452,15 @@ const specs = {
address: '0x00030000',
alt: '0'
},
otaRegion: {
address: '0x80289000',
alt: '2'
},
otaFlag: {
address: '1753',
alt: '1',
size: '1'
},
knownApps: {
},
serial: {
Expand Down Expand Up @@ -479,6 +514,15 @@ const specs = {
address: '0x00030000',
alt: '0'
},
otaRegion: {
address: '0x80289000',
alt: '2'
},
otaFlag: {
address: '1753',
alt: '1',
size: '1'
},
knownApps: {
'tinker': 'tinker-0.8.0-rc.27-boron.bin'
},
Expand Down Expand Up @@ -533,6 +577,15 @@ const specs = {
address: '0x00030000',
alt: '0'
},
otaRegion: {
address: '0x80289000',
alt: '2'
},
otaFlag: {
address: '1753',
alt: '1',
size: '1'
},
knownApps: {
},
serial: {
Expand Down Expand Up @@ -586,6 +639,15 @@ const specs = {
address: '0x00030000',
alt: '0'
},
otaRegion: {
address: '0x80289000',
alt: '2'
},
otaFlag: {
address: '1753',
alt: '1',
size: '1'
},
knownApps: {
'tinker': 'tinker-0.8.0-rc.27-xenon.bin'
},
Expand Down Expand Up @@ -641,6 +703,15 @@ const specs = {
address: '0x00030000',
alt: '0'
},
otaRegion: {
address: '0x80289000',
alt: '2'
},
otaFlag: {
address: '1753',
alt: '1',
size: '1'
},
knownApps: {
},
serial: {
Expand Down
3 changes: 3 additions & 0 deletions test/updates.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ describe('the update firmware binaries are all valid', () => {
});

it('has a valid crc ', () => {
if (filename.endsWith('ota-flag-a5.bin') && getFilesizeInBytes(filename) === 1) {
return 0; // this special file is valid
}
return new Parser().parseFile(filename).then(fileInfo => {
if (fileInfo.suffixInfo.suffixSize === 65535) {
throw new Error(fileInfo.filename + ' does not contain inspection information');
Expand Down

0 comments on commit da1155f

Please sign in to comment.