Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intel-HEX (ISbootloader) support for ISFirmwareUpdater #657

Draft
wants to merge 36 commits into
base: develop
Choose a base branch
from

Conversation

kylemallory
Copy link
Contributor

This is a big PR. Please review it carefully... You have been warned!! A large majority of changes are in 3 primary areas:

  • Refactors ISbootloader* classes to use the same progress/status/info callback signature as the FirmwareUpdater classes. This allows using the same functions for both (since they were similar to begin with). This touches a lot of files in small ways.

  • Implements a "local" mechanism for ISBFirmwareUpdater (new) and ISDFUFirmwareUpdater (existing) to process/communicate using the FirmwareUpdate API, which allows passing fwUpdate messages directly between ISFirmwareUpdater and FirmwareUpdateDevice subclasses, without going through a serial port. This also has ISBFirmwareUpdater and ISDFUFirmwareUpdater extend FirmwareUpdateDevice, and implement their member functions. The interface for passing data is implemented in utils::ByteBuffer and utils::ByteBufferStream.

  • Moves/consolidates more functionality into ISDevice. ISFirmwareUpdater and related classes attempt to rely less on portHandle, or serial_port_t in favor of maintaining a reference to an ISDevice instance for the connected device. ISDevice has a portHandle and serial_port_t*.

In addition to those areas, there are a handful of minor fixes. NOTE THAT THIS DOES NOT PROVIDE FUNCTIONING "Intel HEX/ISbootloader" support. This is still a work-in-progress. This also has dependent changes in the is-common/IMX and is-gpx repos.

kylemallory and others added 20 commits May 30, 2024 12:30
… into feature/SN-4679_iHex_format_in_ISFirmwareUpdater
…wareUpdate mechanisms (primarily status/progress reporting).

Implementing fwUpgradeDevice into ISDFUFirmwareUpdater and ISBFirmwareUpdater
removed dfu namespace from ISDFUFirmwareUpdater.h
… into feature/SN-4679_iHex_format_in_ISFirmwareUpdater
…_GPX.

Attempt detect/query of IMX's in bootloader, adn report accordingly.
Misc improvements to cltool ISB firmware update progress/messaging.
EvalTool won't attempt to communicate with devices if no devics are detected/selected.
Consolidated FirmwareUpdate progress/status callbacks across FirmwareUpdate and ISbootloader* classes.
InertialSense (and ISDevice) attempts to detect hardware type and "run state" (bootloader, vs app firmware).
Further refined InertialSense::OpenSerialPorts() to detect and reject ports which can be opened, but which do not speak "Inertial Sense".
Cleaned up ISDisplay::DataToStringDevInfo() to be more consistent with other DevInfo output (we should really consolidate all of these).
ISFirmwareUpdater::setTarget() attempts to set TARGET_FLAGS for ISB/DFU, and initiate local firmware updaters is appropriate.
Updated ISFirmwareUpdater() to accept direct serial_port_t rather than portName.
FIX: serialPortWriteAscii() returns 0 on first write failure, rather than attempting additional writes of the remaining message portions.
Added ByteBuffer and ByteBufferStream to utils classes.
… into feature/SN-4679_iHex_format_in_ISFirmwareUpdater
… into feature/SN-4679_iHex_format_in_ISFirmwareUpdater
…ug_t.

Improved DeviceCollector::monitorRtkStatus() fix monitoring/reporting.
 DeviceLog.cpp now detects existing log file index numbers, and attempts to avoid overwritting them (indexes to the last detected index + 1).
 InertialSense::LogRawData() attempts to register a DeviceLog() if none exists, and logging is enabled.
 gpx_ldp_tests will now log to a timestamp subfolder.
 gpx_ldp_tests should "deconfigure" (turn off) configured broadcasts.
Cleaned up some warnings.
ISSerialPort::GetComPorts() returns number of ports found.
ISFirmwareUpdater provides return datastream for local FirmwareUpdateDevices().
ISFirmwareUpdater refactored to use device.devInfo rather than local pointer.
ISFirmwareUpdater, when using a local FirmwareUpdateDevice, will directly pass messages to that device instance, and immediately process any returned messages.
ISBFirmwareUpdater uses ISDevice in constructor, rather than serial_port_t.
InertialSense::Update() better accommodates ERR_TIMEOUT, and released the FirmwareUpdater when it occurs.
… into feature/SN-4679_iHex_format_in_ISFirmwareUpdater
@kylemallory kylemallory requested review from waltjohnson and tmcd249 and removed request for waltjohnson June 17, 2024 22:16
… into feature/SN-4679_iHex_format_in_ISFirmwareUpdater
Hides ttyS* unconfigured ports from latest linux kernel.
@kylemallory kylemallory requested a review from waltjohnson June 18, 2024 16:41
… into feature/SN-4679_iHex_format_in_ISFirmwareUpdater
… into feature/SN-4679_iHex_format_in_ISFirmwareUpdater

# Conflicts:
#	cltool/src/cltool.cpp
… into feature/SN-4679_iHex_format_in_ISFirmwareUpdater
…within ISDevice.

Finishes support for writing/erasing flash using ISbootloader/iHex protocol in ISBFirmwareUpdater.
Moderate rework/overriding in ISBFirmwareUpdater to support advanced progress reporting outside of chunk-transfers, accomodating flash erase and flash write steps into the overall progress.
Additionally refactored erase/write operations to be "step-based", essentially making them non-blocking.
Remove references to progressCb/statusCb in ISBFirmwareUpdater, and relies entirely on fwUpdate_sendProgress*().
Adds decimal point betweens seconds and microseconds in utils::getCurrentTimestamp()
… into feature/SN-4679_iHex_format_in_ISFirmwareUpdater
… into feature/SN-4679_iHex_format_in_ISFirmwareUpdater
Removed "scorched-earth" setting of termios flags in serialPortPlatform::configure_serial_port().
Fixed segfault from calling into pfnStatus_cb when null.
… into feature/SN-4679_iHex_format_in_ISFirmwareUpdater

# Conflicts:
#	ExampleProjects/IS_firmwareUpdate_v2/ISFirmwareUpdateExample_v2.cpp
#	cltool/src/cltool.cpp
#	cltool/src/cltool_main.cpp
#	src/DeviceLog.cpp
#	src/DeviceLogRaw.cpp
#	src/ISBootloaderAPP.h
#	src/ISBootloaderBase.cpp
#	src/ISBootloaderBase.h
#	src/ISBootloaderISB.cpp
#	src/ISBootloaderISB.h
#	src/ISBootloaderSAMBA.h
#	src/ISBootloaderSTM32.h
#	src/ISBootloaderSony.h
#	src/ISBootloaderThread.h
#	src/ISDFUFirmwareUpdater.cpp
#	src/ISDevice.cpp
#	src/ISDevice.h
#	src/ISDisplay.cpp
#	src/ISFirmwareUpdater.cpp
#	src/ISFirmwareUpdater.h
#	src/ISLogger.cpp
#	src/InertialSense.cpp
#	src/InertialSense.h
#	src/com_manager.c
#	src/serialPort.c
#	src/serialPortPlatform.c
#	src/util/util.cpp
… refactor)Adds support for '-verbose=' or '-verbose++/--' to cltool to increase/decrease log levels.

Updated ISbootloader and FirmwareUpdate status callbacks to use std::any instead of void* for opaque context pointers.
Cleaned up cltool bootloader status callback message output. Still more to do.
Moved/Refactored InertialSense::HasReceivedDeviceInfo()ISDevice::hasDeviceInfo() to return true if the device has valid device info.
Added InertialSense::HasReceivedDeviceInfoFromAllDevice().
Moved eLogLevel into types.h, so fwUpdater & ISBootloader can use them consistently.
Moved ISBootloader::eDeviceType to types, and renamed to eBootloaderType.
Updates TESTn_PORTs in test_serial_utils to support both loopback and bridge ports (ports 0 & 1 are loopback, while 2 & 3, and 4 & 5 are bridged) -- test_comm_manager.cpp and test_ISComm.cpp probably need some minor updates around this capability.
… into feature/SN-4679_iHex_format_in_ISFirmwareUpdater

# Conflicts:
#	cltool/src/cltool.h
#	cltool/src/cltool_main.cpp
#	src/DeviceLog.cpp
#	src/ISBootloaderBase.h
#	src/ISBootloaderDFU.cpp
#	src/ISBootloaderISB.cpp
#	src/ISBootloaderSAMBA.h
#	src/ISBootloaderThread.cpp
#	src/ISDFUFirmwareUpdater.cpp
#	src/ISDFUFirmwareUpdater.h
#	src/ISDevice.h
#	src/ISDisplay.cpp
#	src/ISSerialPort.h
#	src/serialPort.c
#	src/serialPort.h
#	src/util/util.h
#	tests/test_ISComm.cpp
#	tests/test_com_manager.cpp
#	tests/test_serial_utils.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant