mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-23 13:34:46 +00:00
update apollo toolchain
This commit is contained in:
parent
0e93470e34
commit
c1a493fb35
@ -22,7 +22,7 @@ build_flags =
|
|||||||
-fdata-sections
|
-fdata-sections
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/api/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mesh/eth/> -<input> -<buzz> -<modules/RemoteHardwareModule.cpp> -<platform/nrf52> -<platform/portduino> -<platform/rp2040> -<mesh/raspihttp>
|
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/api/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mesh/eth/> -<input> -<buzz> -<modules/RemoteHardwareModule.cpp> -<platform/nrf52> -<platform/portduino> -<platform/rp2040> -<platform/apollo3> -<mesh/raspihttp>
|
||||||
|
|
||||||
board_upload.offset_address = 0x08000000
|
board_upload.offset_address = 0x08000000
|
||||||
upload_protocol = stlink
|
upload_protocol = stlink
|
||||||
|
@ -53,6 +53,15 @@ void OSFS::writeNBytes(uint16_t address, unsigned int num, const byte *input)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool lfs_assert_failed =
|
||||||
|
false; // Note: we use this global on all platforms, though it can only be set true on nrf52 (in our modified lfs_util.h)
|
||||||
|
|
||||||
|
extern "C" void lfs_assert(const char *reason)
|
||||||
|
{
|
||||||
|
LOG_ERROR("LFS assert: %s\n", reason);
|
||||||
|
lfs_assert_failed = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Copies a file from one location to another.
|
* @brief Copies a file from one location to another.
|
||||||
*
|
*
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "RedirectablePrint.h"
|
#include "RedirectablePrint.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "gps/RTC.h"
|
|
||||||
#include "concurrency/OSThread.h"
|
#include "concurrency/OSThread.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
#include "gps/RTC.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "mesh/generated/meshtastic/mesh.pb.h"
|
#include "mesh/generated/meshtastic/mesh.pb.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
// #include "debug.h"
|
// #include "debug.h"
|
||||||
#include "FSCommon.h"
|
#include "FSCommon.h"
|
||||||
#include "Led.h"
|
#include "Led.h"
|
||||||
#include "gps/RTC.h"
|
|
||||||
#include "SPILock.h"
|
#include "SPILock.h"
|
||||||
#include "concurrency/OSThread.h"
|
#include "concurrency/OSThread.h"
|
||||||
#include "concurrency/Periodic.h"
|
#include "concurrency/Periodic.h"
|
||||||
#include "detect/ScanI2C.h"
|
#include "detect/ScanI2C.h"
|
||||||
|
#include "gps/RTC.h"
|
||||||
|
|
||||||
#if !MESHTASTIC_EXCLUDE_I2C
|
#if !MESHTASTIC_EXCLUDE_I2C
|
||||||
#include "detect/ScanI2CTwoWire.h"
|
#include "detect/ScanI2CTwoWire.h"
|
||||||
|
@ -42,7 +42,6 @@ void PhoneAPI::handleStartConfig()
|
|||||||
if (!isConnected()) {
|
if (!isConnected()) {
|
||||||
onConnectionChanged(true);
|
onConnectionChanged(true);
|
||||||
observe(&service->fromNumChanged);
|
observe(&service->fromNumChanged);
|
||||||
#ifdef FSCom
|
|
||||||
#ifdef FSCom
|
#ifdef FSCom
|
||||||
observe(&xModem.packetReady);
|
observe(&xModem.packetReady);
|
||||||
#endif
|
#endif
|
||||||
@ -65,7 +64,6 @@ void PhoneAPI::close()
|
|||||||
state = STATE_SEND_NOTHING;
|
state = STATE_SEND_NOTHING;
|
||||||
|
|
||||||
unobserve(&service->fromNumChanged);
|
unobserve(&service->fromNumChanged);
|
||||||
#ifdef FSCom
|
|
||||||
#ifdef FSCom
|
#ifdef FSCom
|
||||||
unobserve(&xModem.packetReady);
|
unobserve(&xModem.packetReady);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "StreamAPI.h"
|
#include "StreamAPI.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
#include "RTC.h"
|
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
#include "gps/RTC.h"
|
||||||
|
|
||||||
#define START1 0x94
|
#define START1 0x94
|
||||||
#define START2 0xc3
|
#define START2 0xc3
|
||||||
|
@ -68,7 +68,7 @@ void printBytes(const char *label, const uint8_t *p, size_t numbytes)
|
|||||||
|
|
||||||
bool memfll(const uint8_t *mem, uint8_t find, size_t numbytes)
|
bool memfll(const uint8_t *mem, uint8_t find, size_t numbytes)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numbytes; i++) {
|
for (uint8_t i = 0; i < numbytes; i++) {
|
||||||
if (mem[i] != find)
|
if (mem[i] != find)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "MeshService.h"
|
#include "MeshService.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
#include "RTC.h"
|
#include "gps/RTC.h"
|
||||||
#include "meshUtils.h"
|
#include "meshUtils.h"
|
||||||
#include <FSCommon.h>
|
#include <FSCommon.h>
|
||||||
#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_BLUETOOTH
|
#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_BLUETOOTH
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
#include "AES.h"
|
|
||||||
#include "CTR.h"
|
|
||||||
#include "CryptoEngine.h"
|
|
||||||
#include "configuration.h"
|
|
||||||
|
|
||||||
class Apollo3CryptoEngine : public CryptoEngine
|
|
||||||
{
|
|
||||||
|
|
||||||
CTRCommon *ctr = NULL;
|
|
||||||
|
|
||||||
public:
|
|
||||||
Apollo3CryptoEngine() {}
|
|
||||||
|
|
||||||
~Apollo3CryptoEngine() {}
|
|
||||||
|
|
||||||
virtual void setKey(const CryptoKey &k) override
|
|
||||||
{
|
|
||||||
CryptoEngine::setKey(k);
|
|
||||||
LOG_DEBUG("Installing AES%d key!\n", key.length * 8);
|
|
||||||
if (ctr) {
|
|
||||||
delete ctr;
|
|
||||||
ctr = NULL;
|
|
||||||
}
|
|
||||||
if (key.length != 0) {
|
|
||||||
if (key.length == 16)
|
|
||||||
ctr = new CTR<AES128>();
|
|
||||||
else
|
|
||||||
ctr = new CTR<AES256>();
|
|
||||||
|
|
||||||
ctr->setKey(key.bytes, key.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Encrypt a packet
|
|
||||||
*
|
|
||||||
* @param bytes is updated in place
|
|
||||||
*/
|
|
||||||
virtual void encrypt(uint32_t fromNode, uint64_t packetId, size_t numBytes, uint8_t *bytes) override
|
|
||||||
{
|
|
||||||
if (key.length > 0) {
|
|
||||||
initNonce(fromNode, packetId);
|
|
||||||
if (numBytes <= MAX_BLOCKSIZE) {
|
|
||||||
static uint8_t scratch[MAX_BLOCKSIZE];
|
|
||||||
memcpy(scratch, bytes, numBytes);
|
|
||||||
memset(scratch + numBytes, 0,
|
|
||||||
sizeof(scratch) - numBytes); // Fill rest of buffer with zero (in case cypher looks at it)
|
|
||||||
|
|
||||||
ctr->setIV(nonce, sizeof(nonce));
|
|
||||||
ctr->setCounterSize(4);
|
|
||||||
ctr->encrypt(bytes, scratch, numBytes);
|
|
||||||
} else {
|
|
||||||
LOG_ERROR("Packet too large for crypto engine: %d. noop encryption!\n", numBytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void decrypt(uint32_t fromNode, uint64_t packetId, size_t numBytes, uint8_t *bytes) override
|
|
||||||
{
|
|
||||||
// For CTR, the implementation is the same
|
|
||||||
encrypt(fromNode, packetId, numBytes, bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
};
|
|
||||||
|
|
||||||
CryptoEngine *crypto = new Apollo3CryptoEngine();
|
|
@ -61,7 +61,7 @@ class XModemAdapter
|
|||||||
|
|
||||||
uint16_t packetno = 0;
|
uint16_t packetno = 0;
|
||||||
|
|
||||||
#if defined(ARCH_NRF52)
|
#if defined(ARCH_NRF52) || defined(ARCH_STM32WL)
|
||||||
File file = File(FSCom);
|
File file = File(FSCom);
|
||||||
#else
|
#else
|
||||||
File file;
|
File file;
|
||||||
|
Loading…
Reference in New Issue
Block a user