mirror of
https://github.com/liberatedsystems/RNode_Firmware_CE.git
synced 2024-10-01 03:15:40 -04:00
Added firmware hash readout
This commit is contained in:
parent
95970a54fe
commit
312e4ec2fe
1
Device.h
1
Device.h
@ -76,7 +76,6 @@ void device_load_signature() {
|
||||
}
|
||||
|
||||
void device_load_firmware_hash() {
|
||||
Serial.println("Loading hash from EEPROM");
|
||||
for (uint8_t i = 0; i < DEV_HASH_LEN; i++) {
|
||||
dev_firmware_hash_target[i] = EEPROM.read(dev_fwhash_addr(i));
|
||||
}
|
||||
|
@ -46,6 +46,7 @@
|
||||
#define CMD_DEV_HASH 0x56
|
||||
#define CMD_DEV_SIG 0x57
|
||||
#define CMD_FW_HASH 0x58
|
||||
#define CMD_HASHES 0x60
|
||||
#define CMD_UNLOCK_ROM 0x59
|
||||
#define ROM_UNLOCK_BYTE 0xF8
|
||||
#define CMD_RESET 0x55
|
||||
|
1
Power.h
1
Power.h
@ -45,7 +45,6 @@ void measure_battery() {
|
||||
battery_voltage = PMU.getBattVoltage()/1000.0;
|
||||
battery_percent = PMU.getBattPercentage()*1.0;
|
||||
battery_installed = PMU.isBatteryConnect();
|
||||
// auxillary_temperature = PMU.getTemp();
|
||||
external_power = PMU.isVBUSPlug();
|
||||
float ext_voltage = PMU.getVbusVoltage()/1000.0;
|
||||
float ext_current = PMU.getVbusCurrent();
|
||||
|
@ -697,6 +697,18 @@ void serialCallback(uint8_t sbyte) {
|
||||
device_save_signature();
|
||||
}
|
||||
#endif
|
||||
} else if (command == CMD_HASHES) {
|
||||
#if MCU_VARIANT == MCU_ESP32
|
||||
if (sbyte == 0x01) {
|
||||
kiss_indicate_target_fw_hash();
|
||||
} else if (sbyte == 0x02) {
|
||||
kiss_indicate_fw_hash();
|
||||
} else if (sbyte == 0x03) {
|
||||
kiss_indicate_bootloader_hash();
|
||||
} else if (sbyte == 0x04) {
|
||||
kiss_indicate_partition_table_hash();
|
||||
}
|
||||
#endif
|
||||
} else if (command == CMD_FW_HASH) {
|
||||
#if MCU_VARIANT == MCU_ESP32
|
||||
if (sbyte == FESC) {
|
||||
|
42
Utilities.h
42
Utilities.h
@ -43,7 +43,7 @@ uint8_t boot_vector = 0x00;
|
||||
// TODO: Get ESP32 boot flags
|
||||
#endif
|
||||
|
||||
#if BOARD_MODEL == BOARD_RNODE_NG_20
|
||||
#if BOARD_MODEL == BOARD_RNODE_NG_20 || BOARD_RNODE_NG_21
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
#define NP_PIN 4
|
||||
#define NUMPIXELS 1
|
||||
@ -635,6 +635,46 @@ void kiss_indicate_fbstate() {
|
||||
}
|
||||
serial_write(FEND);
|
||||
}
|
||||
|
||||
void kiss_indicate_target_fw_hash() {
|
||||
serial_write(FEND);
|
||||
serial_write(CMD_DEV_HASH);
|
||||
for (int i = 0; i < DEV_HASH_LEN; i++) {
|
||||
uint8_t byte = dev_firmware_hash_target[i];
|
||||
escaped_serial_write(byte);
|
||||
}
|
||||
serial_write(FEND);
|
||||
}
|
||||
|
||||
void kiss_indicate_fw_hash() {
|
||||
serial_write(FEND);
|
||||
serial_write(CMD_DEV_HASH);
|
||||
for (int i = 0; i < DEV_HASH_LEN; i++) {
|
||||
uint8_t byte = dev_firmware_hash[i];
|
||||
escaped_serial_write(byte);
|
||||
}
|
||||
serial_write(FEND);
|
||||
}
|
||||
|
||||
void kiss_indicate_bootloader_hash() {
|
||||
serial_write(FEND);
|
||||
serial_write(CMD_DEV_HASH);
|
||||
for (int i = 0; i < DEV_HASH_LEN; i++) {
|
||||
uint8_t byte = dev_bootloader_hash[i];
|
||||
escaped_serial_write(byte);
|
||||
}
|
||||
serial_write(FEND);
|
||||
}
|
||||
|
||||
void kiss_indicate_partition_table_hash() {
|
||||
serial_write(FEND);
|
||||
serial_write(CMD_DEV_HASH);
|
||||
for (int i = 0; i < DEV_HASH_LEN; i++) {
|
||||
uint8_t byte = dev_partition_table_hash[i];
|
||||
escaped_serial_write(byte);
|
||||
}
|
||||
serial_write(FEND);
|
||||
}
|
||||
#endif
|
||||
|
||||
void kiss_indicate_fb() {
|
||||
|
Loading…
Reference in New Issue
Block a user