Skip to content

Commit

Permalink
1.9.10 introduced blinking led feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
HomeACcessoryKid committed Apr 5, 2020
1 parent 64d9b46 commit 21f21d3
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 23 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
@@ -1,5 +1,9 @@
# Changelog

## 1.9.10 introduced blinking led feedback
- uses the sysparam led_pin and starts blinking only from ota_init onwards
- cosmetic fixes to design diagram

## 1.9.9 increased stack size for logsend and pre-wifi tasks
- these were showing high watermark errors in testing 1.9.8
- cosmetic changes to count-down messages
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -142,7 +142,7 @@ printf "%08x" `cat firmware/main.bin | wc -c`| xxd -r -p >>firmware/main.bin.sig
This design serves to read through the code base.
The actual entry point of the process is the self-updater which is called ota-boot and which is flashed by serial cable.

![](https://github.com/HomeACcessoryKid/life-cycle-manager/blob/master/design-v3.png)
![](https://github.com/HomeACcessoryKid/life-cycle-manager/blob/master/design-v4.png)

### Concepts
```
Expand Down
38 changes: 19 additions & 19 deletions deploy.md
Expand Up @@ -10,30 +10,30 @@ cd life-cycle-manager
- initial steps to be expanded

#### These are the steps if not introducing a new key pair
- create/update the file versions1/latest-pre-release without new-line and setup 1.9.9 version folder
- create/update the file versions1/latest-pre-release without new-line and setup 1.9.10 version folder
```
mkdir versions1/1.9.9v
echo -n 1.9.9 > versions1/1.9.9v/latest-pre-release
cp versions1/certs.sector* versions1/1.9.9v
cp versions1/public*key* versions1/1.9.9v
mkdir versions1/1.9.10v
echo -n 1.9.10 > versions1/1.9.10v/latest-pre-release
cp versions1/certs.sector* versions1/1.9.10v
cp versions1/public*key* versions1/1.9.10v
```
- set local.mk to the ota-main program
```
make -j6 rebuild OTAVERSION=1.9.9
mv firmware/otamain.bin versions1/1.9.9v
make -j6 rebuild OTAVERSION=1.9.10
mv firmware/otamain.bin versions1/1.9.10v
```
- set local.mk back to ota-boot program
```
make -j6 rebuild OTAVERSION=1.9.9
mv firmware/otaboot.bin versions1/1.9.9v
make -j6 rebuild OTAVERSION=1.9.9 OTABETA=1
cp firmware/otaboot.bin versions1/1.9.9v/otabootbeta.bin
make -j6 rebuild OTAVERSION=1.9.10
mv firmware/otaboot.bin versions1/1.9.10v
make -j6 rebuild OTAVERSION=1.9.10 OTABETA=1
cp firmware/otaboot.bin versions1/1.9.10v/otabootbeta.bin
```
- remove the older version files
#
- update Changelog
- commit this as version 1.9.9
- set up a new github release 1.9.9 as a pre-release using the just commited master...
- commit this as version 1.9.10
- set up a new github release 1.9.10 as a pre-release using the just commited master...
- upload the certs and binaries to the pre-release assets on github
#
- erase the flash and upload the privatekey
Expand All @@ -43,18 +43,18 @@ esptool.py -p /dev/cu.usbserial-* --baud 230400 write_flash 0xf9000 versions1-pr
```
- upload the ota-boot BETA program to the device that contains the private key
```
make flash OTAVERSION=1.9.9 OTABETA=1
make flash OTAVERSION=1.9.10 OTABETA=1
```
- power cycle to prevent the bug for software reset after flash
- setup wifi and select the ota-demo repo without pre-release checkbox
- create the 2 signature files next to the bin file and upload to github one by one
- verify the hashes on the computer
```
openssl sha384 versions1/1.9.9v/otamain.bin
xxd versions1/1.9.9v/otamain.bin.sig
openssl sha384 versions1/1.9.10v/otamain.bin
xxd versions1/1.9.10v/otamain.bin.sig
```

- upload the file versions1/1.9.9v/latest-pre-release to the 'latest release' assets on github
- upload the file versions1/1.9.10v/latest-pre-release to the 'latest release' assets on github

#### Testing

Expand Down Expand Up @@ -107,14 +107,14 @@ esptool.py -p /dev/cu.usbserial-* --baud 230400 write_flash 0xf9000 versionsN-1-
```
- collect public-1.key.sig and store it in the new version folder and copy it to versions1
```
cp versions1/1.9.9v/public-1.key.sig versions1
cp versions1/1.9.10v/public-1.key.sig versions1
```
- then flash the new private key
```
esptool.py -p /dev/cu.usbserial-* --baud 230400 write_flash 0xf9000 versions1-privatekey.der
```
- collect cert.sector.sig and store it in the new version folder and copy it to versions1
```
cp versions1/1.9.9v/certs.sector.sig versions1
cp versions1/1.9.10v/certs.sector.sig versions1
```
- continue with a normal deployment to create the 2 signature files next to the bin files
Binary file removed design-v3.png
Binary file not shown.
Binary file added design-v4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion ota.c
Expand Up @@ -185,6 +185,22 @@ void ota_active_sector() {
UDPLGP("0x%x\n",active_cert_sector);
}

int8_t led=16;
void led_blink_task(void *pvParameter) {
UDPLGP("--- led_blink_task");
if (led<6 || led>11) { //do not allow pins 6-11
UDPLGP(" blinking led pin %d\n",led);
gpio_enable(led, GPIO_OUTPUT);
while(1) {
gpio_write(led, 1); vTaskDelay(BLINKDELAY/portTICK_PERIOD_MS);
gpio_write(led, 0); vTaskDelay(BLINKDELAY/portTICK_PERIOD_MS);
}
} else {
UDPLGP(": invalid pin %d\n",led);
}
vTaskDelete(NULL);
}

void ota_init() {
UDPLGP("--- ota_init\n");

Expand All @@ -197,12 +213,12 @@ void ota_init() {

sysparam_status_t status;
uint8_t led_info=0;
int8_t led=0;

status = sysparam_get_int8("led_pin", &led);
if (status == SYSPARAM_OK) {
if (led<0) {led_info=0x10; led=-led;}
led_info+=(led<16)?(0x40+(led&0x0f)):0;
if (led<16) xTaskCreate(led_blink_task, "ledblink", 256, NULL, 1, NULL);
}

//rboot setup
Expand Down
2 changes: 1 addition & 1 deletion ota.h
Expand Up @@ -14,7 +14,7 @@
#define CERTFILE "certs.sector"
#define HOLDOFF_MULTIPLIER 20 //more like 20 -> 20s,400 (~6min),8000 (~2h),160000 (~2days)
#define HOLDOFF_MAX 604800 //more like 604800 (1 week)

#define BLINKDELAY 250
#define EMERGENCY "emergency"

#define SECTORSIZE 4096
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions versions1/1.9.10v/latest-pre-release
@@ -0,0 +1 @@
1.9.10
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion versions1/1.9.9v/latest-pre-release

This file was deleted.

0 comments on commit 21f21d3

Please sign in to comment.