Skip to content

Commit

Permalink
0.1.9 UDPLOG buffer to 2900 and flush above 700
Browse files Browse the repository at this point in the history
plus some change in the way to report
  • Loading branch information
HomeACcessoryKid committed Nov 25, 2018
1 parent 5c0dfa5 commit c3a866d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
22 changes: 11 additions & 11 deletions deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@ cd life-cycle-manager
```
#initial steps to be expanded

mkdir versions/0.1.8v
cp versions/certs.sector versions/0.1.8v
mkdir versions/0.1.9v
cp versions/certs.sector versions/0.1.9v
#set local.mk to the ota-main program
make -j6 rebuild OTAVERSION=0.1.8
mv firmware/otamain.bin versions/0.1.8v
make -j6 rebuild OTAVERSION=0.1.9
mv firmware/otamain.bin versions/0.1.9v
#set local.mk back to ota-boot program
make -j6 rebuild OTAVERSION=0.1.8
cp firmware/otaboot.bin versions/0.1.8v
make -j6 rebuild OTAVERSION=0.1.9
cp firmware/otaboot.bin versions/0.1.9v

#remove the older versions files

#commit this as version 0.1.8
#set up a new github release 0.1.8 as a pre-release using the just commited master...
#commit this as version 0.1.9
#set up a new github release 0.1.9 as a pre-release using the just commited master...

#erase the flash and upload the privatekey
```
esptool.py -p /dev/cu.usbserial-* --baud 230400 erase_flash
esptool.py -p /dev/cu.usbserial-* --baud 230400 write_flash 0xf5000 privatekey.der
```
#upload the ota-boot program to the device that contains the private key
make flash OTAVERSION=0.1.8
make flash OTAVERSION=0.1.9
#power cycle to prevent the bug for software reset after flash
#create the 3 signature files next to the bin file and upload to github one by one
#verify the hashes on the computer
openssl sha384 versions/0.1.8v/otamain.bin
xxd versions/0.1.8v/otamain.bin.sig
openssl sha384 versions/0.1.9v/otamain.bin
xxd versions/0.1.9v/otamain.bin.sig
#make the release a production release on github
#remove the private key
```
Expand Down
24 changes: 12 additions & 12 deletions ota.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,12 +411,12 @@ char* ota_get_version(char * repo) {
retc = ota_connect(HOST, HTTPS_PORT, &socket, &ssl); //release socket and ssl when ready

if (!retc) {
UDPLOG("send request......");
UDPLGP("%s",recv_buf);
ret = wolfSSL_write(ssl, recv_buf, send_bytes);
if (ret > 0) {
UDPLOG("OK\n\n");
UDPLGP("sent OK\n");

wolfSSL_shutdown(ssl); //by shutting down the connection before even reading, we reduce the payload to the minimum
//wolfSSL_shutdown(ssl); //by shutting down the connection before even reading, we reduce the payload to the minimum
ret = wolfSSL_peek(ssl, recv_buf, RECV_BUF_LEN - 1);
if (ret > 0) {
recv_buf[ret]=0; //error checking
Expand Down Expand Up @@ -487,12 +487,12 @@ int ota_get_file_ex(char * repo, char * version, char * file, int sector, byte
retc = ota_connect(HOST, HTTPS_PORT, &socket, &ssl); //release socket and ssl when ready

if (!retc) {
UDPLOG("send request......");
UDPLGP("%s",recv_buf);
ret = wolfSSL_write(ssl, recv_buf, send_bytes);
if (ret > 0) {
UDPLOG("OK\n\n");
UDPLGP("sent OK\n\n");

wolfSSL_shutdown(ssl); //by shutting down the connection before even reading, we reduce the payload to the minimum
//wolfSSL_shutdown(ssl); //by shutting down the connection before even reading, we reduce the payload to the minimum
ret = wolfSSL_peek(ssl, recv_buf, RECV_BUF_LEN - 1);
if (ret > 0) {
recv_buf[ret]=0; //error checking, e.g. not result=206
Expand Down Expand Up @@ -562,7 +562,7 @@ int ota_get_file_ex(char * repo, char * version, char * file, int sector, byte
ret = wolfSSL_write(ssl, recv_buf, send_bytes);
recv_bytes=0;
if (ret > 0) {
UDPLOG("OK\n\n");
UDPLOG("OK\n");

header=1;
memset(recv_buf,0,RECV_BUF_LEN);
Expand Down Expand Up @@ -606,10 +606,10 @@ int ota_get_file_ex(char * repo, char * version, char * file, int sector, byte
}
collected+=ret;
int i;
for (i=0;i<4;i++) UDPLOG("%02x ", recv_buf[i]);
UDPLOG("... ");
for (i=4;i>0;i--) UDPLOG("%02x ", recv_buf[ret-i]);
UDPLOG(" ");
for (i=0;i<3;i++) UDPLOG("%02x", recv_buf[i]);
UDPLOG("...");
for (i=3;i>0;i--) UDPLOG("%02x", recv_buf[ret-i]);
UDPLOG(" ");
}
} else {
if (ret) {ret=wolfSSL_get_error(ssl,ret); UDPLOG("error %d\n",ret);}
Expand All @@ -618,7 +618,7 @@ int ota_get_file_ex(char * repo, char * version, char * file, int sector, byte
}
header=0; //move to header section itself
} while(recv_bytes<clength);
UDPLOG("\nso far collected %d bytes\n", collected);
UDPLOG(" so far collected %d bytes\n", collected);
} else {
UDPLOG("failed, return [-0x%x]\n", -ret);
ret=wolfSSL_get_error(ssl,ret);
Expand Down
4 changes: 2 additions & 2 deletions udplogger.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include <udplogger.h>

char udplogstring[1450]={0}; //in the end I do not know to prevent overflow, so I use the max size of 1 UDP packet
char udplogstring[2900]={0}; //in the end I do not know to prevent overflow, so I use the max size of 1 UDP packet
int udplogstring_len=0;

void udplog_send(void *pvParameters){
Expand All @@ -38,7 +38,7 @@ void udplog_send(void *pvParameters){
lwip_bind(lSocket, (struct sockaddr *)&sLocalAddr, sizeof(sLocalAddr));

while (1) {
if ((!i && udplogstring_len) || udplogstring_len>1000) {
if ((!i && udplogstring_len) || udplogstring_len>700) {
lwip_sendto(lSocket, udplogstring, udplogstring_len, 0, (struct sockaddr *)&sDestAddr, sizeof(sDestAddr));
udplogstring_len=0;
i=10;
Expand Down
File renamed without changes.
Binary file not shown.
Binary file not shown.

0 comments on commit c3a866d

Please # to comment.