diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml new file mode 100644 index 0000000..d0e4898 --- /dev/null +++ b/.github/workflows/compile.yml @@ -0,0 +1,14 @@ +on: + - push + - pull_request +jobs: + compile-sketch: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: arduino/compile-sketches@v1 + with: + fqbn: "arduino:avr:uno" + sketch-paths: | + - src + - ruggeduino_test \ No newline at end of file diff --git a/.gitignore b/.gitignore index cbd4089..ef5147e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ +.build_ano +lib *.hex -*.elf -serials.csv diff --git a/Makefile b/Makefile deleted file mode 100644 index 80107e1..0000000 --- a/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -FW_VER=2 -DEV=/dev/ttyACM0 - -CC=avr-gcc -CXX=avr-g++ -AR=avr-ar -OBJCOPY=avr-objcopy -AVRDUDE=avrdude -ARDUINO=/usr/share/arduino - -CFLAGS = -Os -Wl,--gc-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=101 \ - -DFW_VER=$(FW_VER) \ - -I$(ARDUINO)/hardware/arduino/cores/arduino \ - -I$(ARDUINO)/hardware/arduino/variants/standard -CXXFLAGS = $(CFLAGS) - -BUILDDIR := build - -CORE_SRCDIR := $(ARDUINO)/hardware/arduino/cores/arduino -CORE_SRC := $(wildcard $(CORE_SRCDIR)/*.cpp) \ - $(wildcard $(CORE_SRCDIR)/*.c) -CORE_OBJ := $(patsubst $(CORE_SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$(filter %.cpp,$(CORE_SRC))) \ - $(patsubst $(CORE_SRCDIR)/%.c,$(BUILDDIR)/%.o,$(filter %.c,$(CORE_SRC))) - -SRCDIR := src -SRC := $(wildcard $(SRCDIR)/*.cpp) -OBJ := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$(filter %.cpp,$(SRC))) - -ruggeduino.hex: ruggeduino.elf - $(OBJCOPY) -O ihex -R .eeprom $< $@ - -ruggeduino.elf: $(OBJ) $(BUILDDIR)/core.a - $(CC) $(CFLAGS) -o $@ $^ -L$(BUILDDIR) - -$(BUILDDIR)/%o: $(SRC) - $(CXX) $(CXXFLAGS) -c -o $@ $< - -$(BUILDDIR)/core.a: $(CORE_OBJ) - $(AR) rcs $@ $^ - -$(BUILDDIR)/%.o: $(CORE_SRCDIR)/%.cpp - $(CXX) $(CXXFLAGS) -c -o $@ $< - -$(BUILDDIR)/%.o: $(CORE_SRCDIR)/%.c - $(CC) $(CFLAGS) -c -o $@ $< - -.PHONY: clean flash - -flash: ruggeduino.hex - $(AVRDUDE) -v -p atmega328p -c arduino -P $(DEV) -D -U flash:w:$<:i - -clean: - rm -rf $(BUILDDIR)/* diff --git a/build/.gitignore b/build/.gitignore deleted file mode 100644 index b818563..0000000 --- a/build/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.d -*.o -*.a diff --git a/commission.py b/commission.py deleted file mode 100755 index bf1d0b6..0000000 --- a/commission.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python -import pyudev -import subprocess - -def get_serial(): - con = pyudev.Context() - for dev in con.list_devices( subsystem = "usb", ID_MODEL="Ruggeduino"): - return dev["ID_SERIAL_SHORT"] - -serial_file = open("serials.csv", "a") - -while True: - part_number = raw_input("Enter part number: ") - serial = get_serial() - subprocess.call(["make", "flash"]) - serial_file.write("{0},{1}\n".format(part_number.upper(), serial)) - serial_file.flush() diff --git a/test_fw/src/LED.cpp b/ruggeduino_test/LED.cpp similarity index 100% rename from test_fw/src/LED.cpp rename to ruggeduino_test/LED.cpp diff --git a/test_fw/src/LED.h b/ruggeduino_test/LED.h similarity index 100% rename from test_fw/src/LED.h rename to ruggeduino_test/LED.h diff --git a/test_fw/src/ruggeduino_test.cpp b/ruggeduino_test/ruggeduino_test.ino similarity index 67% rename from test_fw/src/ruggeduino_test.cpp rename to ruggeduino_test/ruggeduino_test.ino index 311fce1..d3e1a04 100644 --- a/test_fw/src/ruggeduino_test.cpp +++ b/ruggeduino_test/ruggeduino_test.ino @@ -1,43 +1,43 @@ -/* YourDuino Arduino Board TEST +/* YourDuino Arduino Board TEST Tests all Arduino I/O and Analog pins for Source and Sink ability Tests Analog Read on A0..A5 - terry@yourduino.com - + terry@yourduino.com + This test assumes that pins 0 (RX Data) and 1 (TX Data) are OK if programs can be loaded, and that pin 13 is OK if it's attached LED can be blinked. Pin 13 is not tested for current sink ability. - + Test progress and pass-fail results are sent to the Serial Monitor. - At the end of test, Pin 13 LED is blinked very slowly + At the end of test, Pin 13 LED is blinked very slowly for Pass and quickly for Fail. - + This test works with a "Test Shield" that is plugged on top - of the Arduino under test. This shield has a common isolated - connection point. The Common Point has 17 220 ohm resistors + of the Arduino under test. This shield has a common isolated + connection point. The Common Point has 17 220 ohm resistors connected to every digital pin from 2 to 12, and to every analog - pin from 0 to 5. It also has two 100,000 ohm resistors which + pin from 0 to 5. It also has two 100,000 ohm resistors which connect it to Ground and +5.0 volts, forming a voltage divider that sets the common point to 2.50 volts when all pins are in the reset high-impedance input condition. This is read by A0 to - initially test if any of the pins are "stuck" or "leaking", which + initially test if any of the pins are "stuck" or "leaking", which will pull the common point away from 2.50 volts - + Next, pins 3 thru A5 are tested by setting them High or Low against an opposite load presented by pin 2. Each pin must be able to source and sink at least 10 ma to bring the common point near 2.50 volts. - If pin 2 fails, all other pins will fail. - + If pin 2 fails, all other pins will fail. + Next, A0 thru A5 are tested individually with voltages near 1.66, 2.50, 3.33volts and possibly others, using the resistors connected to the digital pins to - make various voltage dividers. - - This design and software is licensed under a Creative Commons + make various voltage dividers. + + This design and software is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License: http://creativecommons.org/licenses/by-nc-sa/3 */ /*-----( Import needed libraries )-----*/ -#include // Easy HAL blink routines +#include "LED.h" // Easy HAL blink routines /*-----( Declare Constants )-----*/ @@ -47,10 +47,10 @@ const int FirstAnaPort = 15; const int LastAnaPort = 19; const int A2D_Delay = 10; //ms delay for A-D to settle -const float LowStuckResultOK = 2.30 ; -const float HighStuckResultOK = 2.50 ; -const float LowVoltResultOK = 2.30 ; -const float HighVoltResultOK = 2.70 ; +const float LowStuckResultOK = 2.30 ; +const float HighStuckResultOK = 2.50 ; +const float LowVoltResultOK = 2.30 ; +const float HighVoltResultOK = 2.70 ; /*-----( Declare objects )-----*/ LED LED13(13); // The only LED we can blink! @@ -86,16 +86,16 @@ void setup() /****** SETUP: RUNS ONCE ******/ void loop() /****** LOOP: RUNS CONSTANTLY ******/ { Failure = 0; - Serial.println(); + Serial.println(); Serial.println("--- TEST START ---"); - + //-------------( TEST 1 )--------------------------------------------- Serial.println("TEST 001 - Any stuck pins??"); //delay(500); IntVoltsRead = analogRead(A0); FloatVoltsRead = a2d2float (IntVoltsRead); Serial.print("VoltsRead = "); - Serial.print(FloatVoltsRead,2); + Serial.print(FloatVoltsRead,2); if (FloatVoltsRead > LowStuckResultOK && FloatVoltsRead < HighStuckResultOK) @@ -105,133 +105,133 @@ void loop() /****** LOOP: RUNS CONSTANTLY ******/ else { Failure ++; - Serial.println(" ** STUCK OR LEAKY PIN FAIL ** "); + Serial.println(" ** STUCK OR LEAKY PIN FAIL ** "); } //-----------------------( TEST 2 )-------------------------------- - Serial.println(); - Serial.println("TEST 002 - Digital Pins Source Current"); + Serial.println(); + Serial.println("TEST 002 - Digital Pins Source Current"); pinMode(2, OUTPUT); // Set Load pin to Output mode - digitalWrite(2, LOW); // Connect Low Load + digitalWrite(2, LOW); // Connect Low Load FailArrayPtr = 0 ; //---------( Write the Digital Pin Labels )--------------- WriteDigitalPinLabels(); - //------( Loop thru pins, testing )----------- - for ( DigPort2Test = FirstDigPort; + //------( Loop thru pins, testing )----------- + for ( DigPort2Test = FirstDigPort; DigPort2Test <= LastDigPort; DigPort2Test ++) {//Loop thru Source Tests FailArrayPtr ++ ; pinMode(DigPort2Test, OUTPUT); // Set tested pin to Output mode - digitalWrite(DigPort2Test, HIGH); // Pin Sources current HIGH + digitalWrite(DigPort2Test, HIGH); // Pin Sources current HIGH delay(A2D_Delay); IntVoltsRead = analogRead(A0); FloatVoltsRead = a2d2float (IntVoltsRead); - pinMode(DigPort2Test, INPUT); // ReSet tested pin to Input mode + pinMode(DigPort2Test, INPUT); // ReSet tested pin to Input mode - Serial.print(FloatVoltsRead,2); - Serial.print(" "); + Serial.print(FloatVoltsRead,2); + Serial.print(" "); if (FloatVoltsRead > LowVoltResultOK && FloatVoltsRead < HighVoltResultOK) { - FailArray[FailArrayPtr] = 0; + FailArray[FailArrayPtr] = 0; } else { - Failure ++; + Failure ++; FailArray[FailArrayPtr] = 1; - } + } }//END Loop thru Source Tests - Serial.println(); + Serial.println(); - //--------( Write the Digital Pin PASS-FAIL Strings )---------------------- + //--------( Write the Digital Pin PASS-FAIL Strings )---------------------- WriteDigitalPassFail(); //--------------------( TEST 3 )---------------------------------------- - Serial.println("TEST 003 - Digital Pins Sink Current"); + Serial.println("TEST 003 - Digital Pins Sink Current"); pinMode(2, OUTPUT); // Set Load pin to Output mode - digitalWrite(2, HIGH); // Connect HIGH Load + digitalWrite(2, HIGH); // Connect HIGH Load FailArrayPtr = 0 ; //---------( Write the Digital Pin Labels )------------ WriteDigitalPinLabels(); - //------( Loop thru pins, testing )----------- - for ( DigPort2Test = FirstDigPort; + //------( Loop thru pins, testing )----------- + for ( DigPort2Test = FirstDigPort; DigPort2Test <= LastDigPort; DigPort2Test ++) {//Loop thru Source Tests FailArrayPtr ++ ; pinMode(DigPort2Test, OUTPUT); // Set tested pin to Output mode - digitalWrite(DigPort2Test, LOW); // Pin Sinks current LOW + digitalWrite(DigPort2Test, LOW); // Pin Sinks current LOW delay(A2D_Delay); IntVoltsRead = analogRead(A0); FloatVoltsRead = a2d2float (IntVoltsRead); - pinMode(DigPort2Test, INPUT); // ReSet tested pin to Input mode + pinMode(DigPort2Test, INPUT); // ReSet tested pin to Input mode - Serial.print(FloatVoltsRead,2); - Serial.print(" "); + Serial.print(FloatVoltsRead,2); + Serial.print(" "); if (FloatVoltsRead > LowVoltResultOK && FloatVoltsRead < HighVoltResultOK) { - FailArray[FailArrayPtr] = 0; + FailArray[FailArrayPtr] = 0; } else { - Failure ++; + Failure ++; FailArray[FailArrayPtr] = 1; - } + } }//END Loop thru Source Tests - Serial.println(); + Serial.println(); - //--------( Write the Digital Pin PASS-FAIL Strings )-------------- + //--------( Write the Digital Pin PASS-FAIL Strings )-------------- WriteDigitalPassFail(); //-------------------------( TEST 4 )---------------------------------------- - Serial.println(); - Serial.println("TEST 004 - Analog Pins Source Current"); + Serial.println(); + Serial.println("TEST 004 - Analog Pins Source Current"); pinMode(2, OUTPUT); // Set Load pin to Output mode - digitalWrite(2, LOW); // Connect Low Load + digitalWrite(2, LOW); // Connect Low Load WriteAnalogPinLabels(); - for ( DigPort2Test = FirstAnaPort; + for ( DigPort2Test = FirstAnaPort; DigPort2Test <= LastAnaPort; DigPort2Test ++) {//Loop thru Source Tests pinMode(DigPort2Test, OUTPUT); // Set tested pin to Output mode - digitalWrite(DigPort2Test, HIGH); // Pin Sources current HIGH + digitalWrite(DigPort2Test, HIGH); // Pin Sources current HIGH delay(A2D_Delay); IntVoltsRead = analogRead(A0); FloatVoltsRead = a2d2float (IntVoltsRead); - pinMode(DigPort2Test, INPUT); // ReSet tested pin to Input mode - Serial.print(FloatVoltsRead,2); - Serial.print(" "); + pinMode(DigPort2Test, INPUT); // ReSet tested pin to Input mode + Serial.print(FloatVoltsRead,2); + Serial.print(" "); if (FloatVoltsRead > LowVoltResultOK && FloatVoltsRead < HighVoltResultOK) { - FailArray[FailArrayPtr] = 0; + FailArray[FailArrayPtr] = 0; } else { - Failure ++; + Failure ++; FailArray[FailArrayPtr] = 1; - } + } }//END Loop thru Source Tests Serial.println(); @@ -239,36 +239,36 @@ void loop() /****** LOOP: RUNS CONSTANTLY ******/ /*---------( TEST 5 )----------------------*/ - Serial.println("TEST 005 - Analog Pins Sink Current"); + Serial.println("TEST 005 - Analog Pins Sink Current"); pinMode(2, OUTPUT); // Set Load pin to Output mode - digitalWrite(2, HIGH); // Connect HIGH Load + digitalWrite(2, HIGH); // Connect HIGH Load WriteAnalogPinLabels(); - for ( DigPort2Test = FirstAnaPort; + for ( DigPort2Test = FirstAnaPort; DigPort2Test <= LastAnaPort; DigPort2Test ++) {//Loop thru Sink Tests pinMode(DigPort2Test, OUTPUT); // Set tested pin to Output mode - digitalWrite(DigPort2Test, LOW); // Pin Sinks current LOW + digitalWrite(DigPort2Test, LOW); // Pin Sinks current LOW delay(A2D_Delay); IntVoltsRead = analogRead(A0); FloatVoltsRead = a2d2float (IntVoltsRead); - pinMode(DigPort2Test, INPUT); // ReSet tested pin to Input mode - Serial.print(FloatVoltsRead,2); - Serial.print(" "); + pinMode(DigPort2Test, INPUT); // ReSet tested pin to Input mode + Serial.print(FloatVoltsRead,2); + Serial.print(" "); if (FloatVoltsRead > LowVoltResultOK && FloatVoltsRead < HighVoltResultOK) { - FailArray[FailArrayPtr] = 0; + FailArray[FailArrayPtr] = 0; } else { - Failure ++; + Failure ++; FailArray[FailArrayPtr] = 1; - } + } }//END Loop thru Source Tests Serial.println(); @@ -278,88 +278,88 @@ void loop() /****** LOOP: RUNS CONSTANTLY ******/ /*---------( TEST 6 )----------------------*/ Serial.println(); - Serial.println("TEST 006 - Analog Pins A0 to A5: A to D (About 2.50 V)"); + Serial.println("TEST 006 - Analog Pins A0 to A5: A to D (About 2.50 V)"); pinMode(2, OUTPUT); // Set Load pin to Output mode digitalWrite(2, HIGH); // Connect HIGH Load - pinMode(3, OUTPUT); // Set Load pin to Output mode - digitalWrite(3, LOW); // Connect LOW Load + pinMode(3, OUTPUT); // Set Load pin to Output mode + digitalWrite(3, LOW); // Connect LOW Load WriteAnalogVoltLabels(); - for ( AnaPort2Test = FirstAnaPort -1; + for ( AnaPort2Test = FirstAnaPort -1; AnaPort2Test <= LastAnaPort; AnaPort2Test ++) {// Loop thru Analog Tests delay(A2D_Delay); IntVoltsRead = analogRead(AnaPort2Test); - FloatVoltsRead = a2d2float (IntVoltsRead); - Serial.print(FloatVoltsRead,2); - Serial.print(" "); - }// END Loop thru Analog Tests + FloatVoltsRead = a2d2float (IntVoltsRead); + Serial.print(FloatVoltsRead,2); + Serial.print(" "); + }// END Loop thru Analog Tests /*---------( TEST 7 )----------------------*/ Serial.println(); Serial.println(); - Serial.println("TEST 007 - Analog Pins A0 to A5: A to D (About 3.33 V)"); + Serial.println("TEST 007 - Analog Pins A0 to A5: A to D (About 3.33 V)"); pinMode(4, OUTPUT); // Set Load pin to Output mode digitalWrite(4, HIGH); // Connect 2nd Resistor WriteAnalogVoltLabels(); - for ( AnaPort2Test = FirstAnaPort -1; + for ( AnaPort2Test = FirstAnaPort -1; AnaPort2Test <= LastAnaPort; AnaPort2Test ++) {// Loop thru Analog Tests delay(A2D_Delay); IntVoltsRead = analogRead(AnaPort2Test); - FloatVoltsRead = a2d2float (IntVoltsRead); - Serial.print(FloatVoltsRead,2); - Serial.print(" "); - }// END Loop thru Analog Tests + FloatVoltsRead = a2d2float (IntVoltsRead); + Serial.print(FloatVoltsRead,2); + Serial.print(" "); + }// END Loop thru Analog Tests /*---------( TEST 8 )----------------------*/ Serial.println(); - Serial.println(); - Serial.println("TEST 008 - Analog Pins A0 to A5: A to D (About 1.66 V)"); + Serial.println(); + Serial.println("TEST 008 - Analog Pins A0 to A5: A to D (About 1.66 V)"); pinMode(4, OUTPUT); // Set Load pin to Output mode digitalWrite(4, LOW); // Connect 2nd Resistor WriteAnalogVoltLabels(); - for ( AnaPort2Test = FirstAnaPort -1; + for ( AnaPort2Test = FirstAnaPort -1; AnaPort2Test <= LastAnaPort; AnaPort2Test ++) {// Loop thru Analog Tests delay(A2D_Delay); IntVoltsRead = analogRead(AnaPort2Test); - FloatVoltsRead = a2d2float (IntVoltsRead); - Serial.print(FloatVoltsRead,2); - Serial.print(" "); - }// END Loop thru Analog Tests + FloatVoltsRead = a2d2float (IntVoltsRead); + Serial.print(FloatVoltsRead,2); + Serial.print(" "); + }// END Loop thru Analog Tests //----------( End Test Digital and Analog Ports: Reset everything)------- pinMode(2, INPUT); // Reset Load pin to Input mode - pinMode(3, INPUT); // Reset Load pin to Input mode - pinMode(4, INPUT); // Reset Load pin to Input mode + pinMode(3, INPUT); // Reset Load pin to Input mode + pinMode(4, INPUT); // Reset Load pin to Input mode MCUCR |= ( 1 << PUD ); //Disable all Pullups /*------------( TEST COMPLETE )----------------*/ - Serial.println(); - Serial.println("TEST COMPLETE"); + Serial.println(); + Serial.println("TEST COMPLETE"); if (Failure > 0) { - Serial.print("!!!!!!!!!! THERE WERE "); - Serial.print(Failure, DEC); - Serial.print(" FAILURES !!!!!!!!!!"); + Serial.print("!!!!!!!!!! THERE WERE "); + Serial.print(Failure, DEC); + Serial.print(" FAILURES !!!!!!!!!!"); LED13.blink(150, 50); } else { LED13.blink(4000, 4); } - Serial.println(); + Serial.println(); // delay(10000); //--(end main loop )--- } @@ -369,7 +369,7 @@ void loop() /****** LOOP: RUNS CONSTANTLY ******/ float fmap(float x, float in_min, float in_max, float out_min, float out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; -} +} float a2d2float (int raw) { @@ -379,28 +379,28 @@ float a2d2float (int raw) void WriteDigitalPinLabels() { //---------( Write the Digital Pin Labels )--------------------- - for ( DigPort2Test = FirstDigPort; + for ( DigPort2Test = FirstDigPort; DigPort2Test <= LastDigPort; - DigPort2Test ++) - {//Write the label strings - Serial.print("PIN-"); + DigPort2Test ++) + {//Write the label strings + Serial.print("PIN-"); Serial.print(DigPort2Test, DEC); - Serial.print(" "); - }// Write Labels + Serial.print(" "); + }// Write Labels Serial.println(); } void WriteAnalogPinLabels() { //---------( Write the Analog Pin Labels )--------------------- - for ( DigPort2Test = FirstAnaPort; + for ( DigPort2Test = FirstAnaPort; DigPort2Test <= LastAnaPort; - DigPort2Test ++) - {//Write the label strings - Serial.print("PIN-"); + DigPort2Test ++) + {//Write the label strings + Serial.print("PIN-"); Serial.print(DigPort2Test -14 , DEC); - Serial.print(" "); - }// Write Labels + Serial.print(" "); + }// Write Labels Serial.println(); } @@ -408,61 +408,61 @@ void WriteAnalogPinLabels() void WriteAnalogVoltLabels() { //---------( Write the Analog Pin Labels )--------------------- - for ( DigPort2Test = FirstAnaPort - 1; + for ( DigPort2Test = FirstAnaPort - 1; DigPort2Test <= LastAnaPort; - DigPort2Test ++) - {//Write the label strings - Serial.print("PIN-"); + DigPort2Test ++) + {//Write the label strings + Serial.print("PIN-"); Serial.print(DigPort2Test -14 , DEC); - Serial.print(" "); - }// Write Labels + Serial.print(" "); + }// Write Labels Serial.println(); } -//--------( Write the Digital Pin PASS-FAIL Strings )---------------------- +//--------( Write the Digital Pin PASS-FAIL Strings )---------------------- void WriteDigitalPassFail() { FailArrayPtr = 0; - for ( DigPort2Test = FirstDigPort; + for ( DigPort2Test = FirstDigPort; DigPort2Test <= LastDigPort; - DigPort2Test ++) - {//Write the PASS-FAIL strings - FailArrayPtr ++; + DigPort2Test ++) + {//Write the PASS-FAIL strings + FailArrayPtr ++; if (FailArray[FailArrayPtr] == 1) // Was a Fail { - Serial.print("FAIL "); + Serial.print("FAIL "); } else { - Serial.print("-OK- "); - } + Serial.print("-OK- "); + } }// Write PASS-FAIL - Serial.println(); + Serial.println(); }//End WriteDigitalPassFail -//--------( Write the Analog Pin PASS-FAIL Strings )---------------------- +//--------( Write the Analog Pin PASS-FAIL Strings )---------------------- void WriteAnalogPassFail() { FailArrayPtr = 0; - for ( DigPort2Test = FirstAnaPort; + for ( DigPort2Test = FirstAnaPort; DigPort2Test <= LastAnaPort; - DigPort2Test ++) - {//Write the PASS-FAIL strings - FailArrayPtr ++; + DigPort2Test ++) + {//Write the PASS-FAIL strings + FailArrayPtr ++; if (FailArray[FailArrayPtr] == 1) // Was a Fail { - Serial.print("FAIL "); + Serial.print("FAIL "); } else { - Serial.print("-OK- "); - } + Serial.print("-OK- "); + } }// Write PASS-FAIL - Serial.println(); + Serial.println(); }//End WriteDigitalPassFail diff --git a/src/ruggeduino.cpp b/src/src.ino similarity index 99% rename from src/ruggeduino.cpp rename to src/src.ino index 475a2b7..f23d1f2 100644 --- a/src/ruggeduino.cpp +++ b/src/src.ino @@ -1,5 +1,7 @@ #include +#define FW_VER 2 + // NB: If you make any changes to this file, then the sample source for // teams to extend in srweb (resources/kit/ruggeduino-fw.ino) will also // need changing similarly (though there are some intentional differences) diff --git a/test_fw/Makefile b/test_fw/Makefile deleted file mode 100644 index 7df9187..0000000 --- a/test_fw/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -FW_VER=1 -DEV=/dev/ttyACM0 - -CC=avr-gcc -CXX=avr-g++ -AR=avr-ar -OBJCOPY=avr-objcopy -AVRDUDE=avrdude -ARDUINO=/usr/share/arduino - -SRCDIR := src - -CFLAGS = -Os -Wl,--gc-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=101 \ - -DFW_VER=$(FW_VER) \ - -I$(ARDUINO)/hardware/arduino/cores/arduino \ - -I$(ARDUINO)/hardware/arduino/variants/standard \ - -I$(SRCDIR) -CXXFLAGS = $(CFLAGS) - -BUILDDIR := build - -CORE_SRCDIR := $(ARDUINO)/hardware/arduino/cores/arduino -CORE_SRC := $(wildcard $(CORE_SRCDIR)/*.cpp) \ - $(wildcard $(CORE_SRCDIR)/*.c) -CORE_OBJ := $(patsubst $(CORE_SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$(filter %.cpp,$(CORE_SRC))) \ - $(patsubst $(CORE_SRCDIR)/%.c,$(BUILDDIR)/%.o,$(filter %.c,$(CORE_SRC))) - -SRC := $(wildcard $(SRCDIR)/*.cpp) -#OBJ := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$(filter %.cpp,$(SRC))) -OBJ := $(SRC:.cpp=.o) - -ruggeduino_test.hex: ruggeduino_test.elf - $(OBJCOPY) -O ihex -R .eeprom $< $@ - -ruggeduino_test.elf: $(OBJ) $(BUILDDIR)/core.a - $(CC) $(CFLAGS) -o $@ $^ -L$(BUILDDIR) - -$(BUILDDIR)/%o: $(SRC) - $(CXX) $(CXXFLAGS) -c -o $@ $< - -$(BUILDDIR)/core.a: $(CORE_OBJ) - $(AR) rcs $@ $^ - -$(BUILDDIR)/%.o: $(CORE_SRCDIR)/%.cpp - $(CXX) $(CXXFLAGS) -c -o $@ $< - -$(BUILDDIR)/%.o: $(CORE_SRCDIR)/%.c - $(CC) $(CFLAGS) -c -o $@ $< - -.PHONY: clean flash - -flash: ruggeduino_test.hex - $(AVRDUDE) -v -p atmega328p -c arduino -P $(DEV) -D -U flash:w:$<:i - -clean: - rm -rf $(BUILDDIR)/*