Add extracted tools: CitrineOS, OpenOCPP, ShapeShifter
- CitrineOS core extracted (CSMS OCPP 2.0.1) - OpenOCPP extracted (firmware OCPP 1.6J/2.0.1) - ShapeShifter library installed (pip install -e) - ShapeShifter specification extracted - EVerest extracted TODO updated with progress
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
# set the project name
|
||||
project(umwc_fwupdate VERSION 0.1)
|
||||
# specify the C++ standard
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
# add the executable
|
||||
add_executable(umwc_fwupdate main.cpp)
|
||||
target_include_directories(umwc_fwupdate PUBLIC "${PROJECT_BINARY_DIR}" PUBLIC "../umwc_comms/nanopb" PUBLIC "../umwc_comms/protobuf" PUBLIC "../umwc_comms")
|
||||
target_link_libraries(umwc_fwupdate PRIVATE Pal::Sigslot Threads::Threads umwc_comms everest::framework everest::gpio)
|
||||
|
||||
install(TARGETS umwc_fwupdate
|
||||
DESTINATION ${EVEREST_MOD_YETIDRIVER_DESTINATION})
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Copyright 2020 - 2021 Pionix GmbH and Contributors to EVerest
|
||||
#include "evSerial.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sigslot/signal.hpp>
|
||||
|
||||
#include "umwc.pb.h"
|
||||
#include <everest/gpio/gpio.hpp>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
volatile bool sw_version_received = false;
|
||||
|
||||
void recvKeepAliveLo(KeepAliveLo s) {
|
||||
printf("Current uMWC SW Version: %s (Protocol %i.%i)\n", s.sw_version_string, s.protocol_version_major,
|
||||
s.protocol_version_minor);
|
||||
sw_version_received = true;
|
||||
}
|
||||
|
||||
void help() {
|
||||
printf("\nUsage: ./umwc_fwupdate /dev/ttyXXX firmware.bin\n\n");
|
||||
printf("This tool uses stm32flash (version 0.6 and above) which needs to be installed.\n");
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
printf("uMWC ROM Bootloader Firmware Updater\n");
|
||||
if (argc != 3) {
|
||||
help();
|
||||
exit(0);
|
||||
}
|
||||
const char* device = argv[1];
|
||||
const char* filename = argv[2];
|
||||
|
||||
evSerial* p = new evSerial();
|
||||
|
||||
if (p->openDevice(device, 115200)) {
|
||||
// printf("Running\n");
|
||||
p->run();
|
||||
p->signalKeepAliveLo.connect(recvKeepAliveLo);
|
||||
while (true) {
|
||||
if (sw_version_received)
|
||||
break;
|
||||
std::this_thread::sleep_for(100us);
|
||||
}
|
||||
printf("\nRebooting uMWC in ROM Bootloader mode...\n");
|
||||
// send some dummy commands to make sure protocol is in sync
|
||||
p->enable(false);
|
||||
p->enable(false);
|
||||
// now reboot uC in boot loader mode
|
||||
p->firmwareUpdate(true);
|
||||
sleep(1);
|
||||
delete p;
|
||||
|
||||
sleep(1);
|
||||
// Try to hardware reset Yeti controller to be in a known state
|
||||
Everest::Gpio reset_gpio;
|
||||
reset_gpio.open("gpiochip0", 27);
|
||||
reset_gpio.set_output(true);
|
||||
reset_gpio.set(true);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
reset_gpio.set(false);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
reset_gpio.set(true);
|
||||
char cmd[1000];
|
||||
sprintf(cmd, "stm32flash -b 115200 %.100s -v -w %.100s -R", device, filename);
|
||||
// sprintf(cmd, "stm32flash -b115200 %.100s", device);
|
||||
printf("Executing %s ...\n", cmd);
|
||||
system(cmd);
|
||||
|
||||
// printf ("Joining\n");
|
||||
} else {
|
||||
printf("Cannot open device \"%s\"\n", device);
|
||||
delete p;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user