mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2024-10-01 03:15:39 -04:00
Get MD5 code building for Linux
This commit is contained in:
parent
d249f38b14
commit
498b1f12e9
36
Config.h
36
Config.h
@ -8,10 +8,12 @@
|
||||
|
||||
#define PLATFORM_AVR 0x90
|
||||
#define PLATFORM_ESP32 0x80
|
||||
#define PLATFORM_LINUX 0x70
|
||||
|
||||
#define MCU_1284P 0x91
|
||||
#define MCU_2560 0x92
|
||||
#define MCU_ESP32 0x81
|
||||
#define MCU_LINUX 0x71
|
||||
|
||||
#define BOARD_RNODE 0x31
|
||||
#define BOARD_HMBRW 0x32
|
||||
@ -20,6 +22,10 @@
|
||||
#define BOARD_GENERIC_ESP32 0x35
|
||||
#define BOARD_LORA32_V2_0 0x36
|
||||
#define BOARD_LORA32_V2_1 0x37
|
||||
#define BOARD_SPIDEV 0x38
|
||||
|
||||
#define LIBRARY_ARDUINO 0x1
|
||||
#define LIBRARY_C 0x2
|
||||
|
||||
#define MODE_HOST 0x11
|
||||
#define MODE_TNC 0x12
|
||||
@ -33,6 +39,9 @@
|
||||
#elif defined(ESP32)
|
||||
#define PLATFORM PLATFORM_ESP32
|
||||
#define MCU_VARIANT MCU_ESP32
|
||||
#elif defined(__unix__)
|
||||
#define PLATFORM PLATFORM_LINUX
|
||||
#define MCU_VARIANT MCU_LINUX
|
||||
#else
|
||||
#error "The firmware cannot be compiled for the selected MCU variant"
|
||||
#endif
|
||||
@ -54,6 +63,7 @@
|
||||
const int pin_led_tx = 13;
|
||||
|
||||
#define BOARD_MODEL BOARD_RNODE
|
||||
#define LIBRARY_TYPE LIBRARY_ARDUINO
|
||||
|
||||
#define CONFIG_UART_BUFFER_SIZE 6144
|
||||
#define CONFIG_QUEUE_SIZE 6144
|
||||
@ -70,6 +80,7 @@
|
||||
const int pin_led_tx = 13;
|
||||
|
||||
#define BOARD_MODEL BOARD_HMBRW
|
||||
#define LIBRARY_TYPE LIBRARY_ARDUINO
|
||||
|
||||
#define CONFIG_UART_BUFFER_SIZE 768
|
||||
#define CONFIG_QUEUE_SIZE 5120
|
||||
@ -130,6 +141,8 @@
|
||||
#else
|
||||
#error An unsupported board was selected. Cannot compile RNode firmware.
|
||||
#endif
|
||||
|
||||
#define LIBRARY_TYPE LIBRARY_ARDUINO
|
||||
|
||||
#define CONFIG_UART_BUFFER_SIZE 6144
|
||||
#define CONFIG_QUEUE_SIZE 6144
|
||||
@ -141,6 +154,22 @@
|
||||
#define GPS_BAUD_RATE 9600
|
||||
#define PIN_GPS_TX 12
|
||||
#define PIN_GPS_RX 34
|
||||
#elif MCU_VARIANT == MCU_LINUX
|
||||
const int pin_cs = -1;
|
||||
const int pin_reset = -1;
|
||||
const int pin_dio = -1;
|
||||
const int pin_led_rx = -1;
|
||||
const int pin_led_tx = -1;
|
||||
|
||||
#define BOARD_MODEL BOARD_SPIDEV
|
||||
#define LIBRARY_TYPE LIBRARY_C
|
||||
|
||||
#define CONFIG_UART_BUFFER_SIZE 6144
|
||||
#define CONFIG_QUEUE_SIZE 6144
|
||||
#define CONFIG_QUEUE_MAX_LENGTH 200
|
||||
|
||||
#define EEPROM_SIZE 4096
|
||||
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
||||
#endif
|
||||
|
||||
#if BOARD_MODEL == BOARD_TBEAM
|
||||
@ -148,7 +177,12 @@
|
||||
#define I2C_SCL 22
|
||||
#define PMU_IRQ 35
|
||||
#endif
|
||||
|
||||
|
||||
#if LIBRARY_TYPE == LIBRARY_C
|
||||
// We need standard int types before we go any further
|
||||
#include <cstdint>
|
||||
#endif
|
||||
|
||||
#define eeprom_addr(a) (a+EEPROM_OFFSET)
|
||||
|
||||
// MCU independent configuration parameters
|
||||
|
8
MD5.cpp
8
MD5.cpp
@ -1,5 +1,11 @@
|
||||
#include "MD5.h"
|
||||
|
||||
#if LIBRARY_TYPE == LIBRARY_ARDUINO
|
||||
#include "Arduino.h"
|
||||
#elif LIBRARY_TYPE == LIBRARY_C
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
MD5::MD5()
|
||||
{
|
||||
//nothing
|
||||
@ -298,4 +304,4 @@ unsigned char* MD5::make_hash(char *arg,size_t size)
|
||||
MD5Update(&context, arg, size);
|
||||
MD5Final(hash, &context);
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
10
MD5.h
10
MD5.h
@ -1,7 +1,13 @@
|
||||
#ifndef MD5_h
|
||||
#define MD5_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "Config.h"
|
||||
|
||||
#if LIBRARY_TYPE == LIBRARY_ARDUINO
|
||||
#include "Arduino.h"
|
||||
#elif LIBRARY_TYPE == LIBRARY_C
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is an OpenSSL-compatible implementation of the RSA Data Security,
|
||||
@ -49,4 +55,4 @@ public:
|
||||
static void MD5Update(void *ctxBuf, const void *data, size_t size);
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
13
Makefile
13
Makefile
@ -10,6 +10,9 @@ prep-samd:
|
||||
arduino-cli core update-index --config-file arduino-cli.yaml
|
||||
arduino-cli core install adafruit:samd
|
||||
|
||||
prep-linux:
|
||||
mkdir -p bin
|
||||
mkdir -p obj
|
||||
|
||||
|
||||
firmware:
|
||||
@ -135,3 +138,13 @@ release-mega2560:
|
||||
arduino-cli compile --fqbn arduino:avr:mega -e
|
||||
cp build/arduino.avr.mega/RNode_Firmware.ino.hex Release/rnode_firmware_latest_m2560.hex
|
||||
rm -r build
|
||||
|
||||
.PHONY: clean prep-linux
|
||||
|
||||
clean:
|
||||
rm -Rf bin
|
||||
rm -Rf obj
|
||||
|
||||
obj/MD5.o: MD5.cpp MD5.h Config.h ROM.h prep-linux
|
||||
$(CC) -c -o $@ $<
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user