Get MD5 code building for Linux

This commit is contained in:
Adam Novak 2022-02-13 16:36:24 -05:00
parent d249f38b14
commit 498b1f12e9
4 changed files with 63 additions and 4 deletions

View File

@ -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
@ -131,6 +142,8 @@
#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
#define CONFIG_QUEUE_MAX_LENGTH 200
@ -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
@ -149,6 +178,11 @@
#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

View File

@ -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

8
MD5.h
View File

@ -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,

View File

@ -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 $@ $<