Merge branch 'master' into branch-1.9
authorBdale Garbee <bdale@gag.com>
Sat, 29 Oct 2022 05:10:00 +0000 (23:10 -0600)
committerBdale Garbee <bdale@gag.com>
Sat, 29 Oct 2022 05:10:00 +0000 (23:10 -0600)
52 files changed:
Makefile.am
Releasing
altoslib/AltosConfigData.java
altoslib/AltosConvert.java
altoslib/AltosDataListener.java
altoslib/AltosEepromRecordMotor.java
altoslib/AltosLib.java
altosui/Makefile.am
altosui/altos-windows.nsi.in
altosuilib/AltosGraph.java
altosuilib/AltosUIPreferences.java
ao-tools/ao-eeprom/ao-eeprom.c
ao-tools/ao-elftohex/ao-elftohex.1
ao-tools/ao-elftohex/ao-elftohex.c
ao-tools/lib/ao-eeprom-read.h
configure.ac
doc/Makefile.am
doc/dedication.inc
doc/easymini-release-notes.inc
doc/micropeak.txt
doc/motortest-installation.inc
doc/motortest-intro.inc
doc/motortest-operation.inc
doc/release-notes-1.9.12.inc [new file with mode: 0644]
doc/release-notes.inc
doc/specs.inc
doc/telegps-dedication.inc
doc/telegps-release-notes.inc
doc/telelaunch-acknowledgements.inc
micropeak/Makefile.am
src/Makefile
src/aes/ao_aes.c
src/drivers/ao_adxl375.c
src/drivers/ao_adxl375.h
src/easymini-v1.0/Makefile
src/easymini-v1.0/ao_pins.h
src/easymini-v3.0/Makefile
src/easymotor-v3/Makefile [new file with mode: 0644]
src/easymotor-v3/ao_easymotor.c [new file with mode: 0644]
src/easymotor-v3/ao_pins.h [new file with mode: 0644]
src/easymotor-v3/flash-loader/Makefile [new file with mode: 0644]
src/easymotor-v3/flash-loader/ao_pins.h [new file with mode: 0644]
src/kernel/ao_config.c
src/kernel/ao_log.h
src/kernel/ao_telemetry.c
src/lpc/Makefile-flash.defs
src/lpc/altos-loader.ld
src/lpc/ao_beep_lpc.c
src/lpc/ao_interrupt.c
src/lpc/ao_spi_lpc.c
src/lpc/lpc.h
telegps/Makefile.am

index 6918c578cf98d7541754e1938424d7c2b86cc172..9fe615cc392b812ccb9ef3d91896b086be60b88e 100644 (file)
@@ -53,7 +53,9 @@ fat_altos = \
        src/easymega-v1.0/easymega-v1.0-$(VERSION).ihx \
        src/easymega-v2.0/easymega-v2.0-$(VERSION).ihx \
        src/easymini-v1.0/easymini-v1.0-$(VERSION).ihx \
-       src/easymotor-v2/easymotor-v2-$(VERSION).ihx \
+       src/easymini-v2.0/easymini-v2.0-$(VERSION).ihx \
+       src/easymini-v3.0/easymini-v3.0-$(VERSION).ihx \
+       src/easymotor-v3/easymotor-v3-$(VERSION).ihx \
        src/easytimer-v1/easytimer-v1-$(VERSION).ihx \
        src/telebt-v3.0/telebt-v3.0-$(VERSION).ihx \
        src/telebt-v4.0/telebt-v4.0-$(VERSION).ihx \
index 408b180519aa19a986629d7fe236eb7f82b75165..f3ac998aacb565408398fee454c9def8c3936efa 100644 (file)
--- a/Releasing
+++ b/Releasing
@@ -48,6 +48,8 @@ These are Bdale's notes on how to do a release.
                        gcc-i686-linux-gnu gcc-aarch64-linux-gnu \
                        gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf
 
+       - make sure jsign is installed so we can sign Windows installers
+
        - make sure ~/web/altusmetrum has no pending pullable commits
 
        git checkout master
@@ -109,8 +111,8 @@ These are Bdale's notes on how to do a release.
 
        cp src/chaoskey-v1.0/{*.elf,*.ihx,*.bin,*.map} \
           src/easymega-v[1-2].0/{*.elf,*.ihx,*.map} \
-          src/easymini-v[1-2].0/{*.elf,*.ihx,*.map} \
-          src/easymotor-v2/{*.elf,*.ihx,*.map} \
+          src/easymini-v[1-3].0/{*.elf,*.ihx,*.map} \
+          src/easymotor-v3/{*.elf,*.ihx,*.map} \
           src/easytimer-v1/{*.elf,*.ihx,*.map} \
           src/telebt-v[3-4].0/{*.elf,*.ihx,*.map} \
           src/teledongle-v3.0/{*.elf,*.ihx,*.map} \
index cd649113b1a6b8293b3766f05a74f97ae6f79d0b..da6e7bfc6d8199b228e0b8918219c3fafb6038b2 100644 (file)
@@ -662,6 +662,8 @@ public class AltosConfigData {
                                return true;
                        if (product.startsWith("EasyMotor-v2"))
                                return true;
+                       if (product.startsWith("EasyMotor-v3"))
+                               return true;
                }
                throw new AltosUnknownProduct(product);
        }
@@ -676,6 +678,8 @@ public class AltosConfigData {
                                return AltosAdxl375.X_AXIS;
                        if (product.startsWith("EasyMotor-v2"))
                                return AltosAdxl375.X_AXIS;
+                       if (product.startsWith("EasyMotor-v3"))
+                               return AltosAdxl375.X_AXIS;
 
                }
                throw new AltosUnknownProduct(product);
index 099ea04859337bb14e0799df62d607eabc97f9d8..3e1796b2c194bfbeb212a9adbe675a0917642201 100644 (file)
@@ -323,6 +323,16 @@ public class AltosConvert {
                return (voltage - base) / (max - base) * full_scale_pressure;
        }
 
+       static double easy_motor_3_adc(double raw) {
+               return raw / 32767.0;
+       }
+
+       static double easy_motor_3_voltage(int sensor) {
+               double  supply = 3.3;
+
+               return easy_motor_3_adc(sensor) * supply * 15.6 / 10.0;
+       }
+
        static double easy_motor_2_motor_pressure(int sensor, double ground_sensor) {
                double  supply = 3.3;
                double  ground_voltage = easy_mini_2_adc(ground_sensor) * supply * 15.6 / 10.0;
@@ -331,6 +341,14 @@ public class AltosConvert {
                return motor_pressure(voltage) - motor_pressure(ground_voltage);
        }
 
+       static double easy_motor_3_motor_pressure(int sensor, double ground_sensor) {
+               double  supply = 3.3;
+               double  ground_voltage = easy_motor_3_adc(ground_sensor) * supply * 15.6 / 10.0;
+               double  voltage = easy_motor_3_adc(sensor) * supply * 15.6 / 10.0;
+
+               return motor_pressure(voltage) - motor_pressure(ground_voltage);
+       }
+
        public static double radio_to_frequency(int freq, int setting, int cal, int channel) {
                double  f;
 
index db2c14faba1e11f17b735b65388c358679273c4c..b19cbedbbdb513b914a6edf1bbe55cf58af2608f 100644 (file)
@@ -59,6 +59,8 @@ public abstract class AltosDataListener {
 
        public void set_log_format(int log_format) {
                cal_data().set_log_format(log_format);
+               if (cal_data().device_type == AltosLib.MISSING)
+                       cal_data().set_device_type(AltosLib.product_id_from_log_format(log_format));
                switch (log_format) {
                case AltosLib.AO_LOG_FORMAT_TELEGPS:
                        set_state(AltosLib.ao_flight_stateless);
index a8f35db476c58f0a214f038c2f007dcdecde03c3..d5068b08d3f9d10b2222ff7b4137c42f9c0e3ff2 100644 (file)
@@ -68,8 +68,8 @@ public class AltosEepromRecordMotor extends AltosEepromRecord {
                case AltosLib.AO_LOG_SENSOR:
                        AltosConfigData config_data = eeprom.config_data();
 
-                       listener.set_battery_voltage(AltosConvert.easy_mini_2_voltage(v_batt()));
-                       double pa = AltosConvert.easy_motor_2_motor_pressure(motor_pres(), cal_data.ground_motor_pressure);
+                       listener.set_battery_voltage(AltosConvert.easy_motor_3_voltage(v_batt()));
+                       double pa = AltosConvert.easy_motor_3_motor_pressure(motor_pres(), cal_data.ground_motor_pressure);
                        listener.set_motor_pressure(pa);
 
                        int     accel_along = accel_along();
index 07ed31e1997c50aae4f73027f82ee3c6ffbad610..47c10cbf2fdac279f9a9cfe4b4607c221d691421 100644 (file)
@@ -617,6 +617,59 @@ public class AltosLib {
                }
        }
 
+       public static int product_id_from_log_format(int log_format) {
+               switch (log_format){
+               case AO_LOG_FORMAT_UNKNOWN:
+                       return product_altusmetrum;
+               case AO_LOG_FORMAT_FULL:
+                       return product_telemetrum;
+               case AO_LOG_FORMAT_TINY:
+                       return product_telemini;
+               case AO_LOG_FORMAT_TELEMETRY:
+                       return product_altusmetrum;
+               case AO_LOG_FORMAT_TELESCIENCE:
+                       return product_telescience;
+               case AO_LOG_FORMAT_TELEMEGA_OLD:
+                       return product_telemega;
+               case AO_LOG_FORMAT_EASYMINI1:
+                       return product_easymini;
+               case AO_LOG_FORMAT_TELEMETRUM:
+                       return product_telemetrum;
+               case AO_LOG_FORMAT_TELEMINI2:
+                       return product_telemini;
+               case AO_LOG_FORMAT_TELEGPS:
+                       return product_telegps;
+               case AO_LOG_FORMAT_TELEMEGA:
+                       return product_telemega;
+               case AO_LOG_FORMAT_DETHERM:
+                       return product_altusmetrum;
+               case AO_LOG_FORMAT_TELEMINI3:
+                       return product_telemini;
+               case AO_LOG_FORMAT_TELEFIRETWO:
+                       return product_altusmetrum;
+               case AO_LOG_FORMAT_EASYMINI2:
+                       return product_easymini;
+               case AO_LOG_FORMAT_TELEMEGA_3:
+                       return product_telemega;
+               case AO_LOG_FORMAT_EASYMEGA_2:
+                       return product_easymega;
+               case AO_LOG_FORMAT_TELESTATIC:
+                       return product_altusmetrum;
+               case AO_LOG_FORMAT_MICROPEAK2:
+                       return product_altusmetrum;
+               case AO_LOG_FORMAT_TELEMEGA_4:
+                       return product_telemega;
+               case AO_LOG_FORMAT_EASYMOTOR:
+                       return product_easymotor;
+               case AO_LOG_FORMAT_TELEMEGA_5:
+                       return product_telemega;
+               case AO_LOG_FORMAT_NONE:
+                       return product_altusmetrum;
+               default:
+                       return product_altusmetrum;
+               }
+       }
+
        public static String igniter_name(int i) {
                return String.format("Igniter %c", 'A' + i);
        }
index fde718d3abe0de246b82254e99fbea9dd0a6da87..41f0d6ad4085de9ecc283b5cdd1cd19f27a9a3e4 100644 (file)
@@ -1,3 +1,4 @@
+# location of code signing key, et al
 
 JAVAROOT=classes
 AM_JAVACFLAGS=$(JAVAC_VERSION_FLAGS) -encoding UTF-8 -Xlint:deprecation -Xlint:unchecked
@@ -141,14 +142,15 @@ FIRMWARE_TMEGA=$(FIRMWARE_TMEGA_1_0) $(FIRMWARE_TMEGA_2_0) $(FIRMWARE_TMEGA_3_0)
 
 FIRMWARE_EMINI_1_0=$(top_srcdir)/src/easymini-v1.0/easymini-v1.0-$(VERSION).ihx
 FIRMWARE_EMINI_2_0=$(top_srcdir)/src/easymini-v2.0/easymini-v2.0-$(VERSION).ihx
-FIRMWARE_EMINI=$(FIRMWARE_EMINI_1_0) $(FIRMWARE_EMINI_2_0)
+FIRMWARE_EMINI_3_0=$(top_srcdir)/src/easymini-v3.0/easymini-v3.0-$(VERSION).ihx
+FIRMWARE_EMINI=$(FIRMWARE_EMINI_1_0) $(FIRMWARE_EMINI_2_0) $(FIRMWARE_EMINI_3_0)
 
 FIRMWARE_EMEGA_1_0=$(top_srcdir)/src/easymega-v1.0/easymega-v1.0-$(VERSION).ihx
 FIRMWARE_EMEGA_2_0=$(top_srcdir)/src/easymega-v2.0/easymega-v2.0-$(VERSION).ihx
 FIRMWARE_EMEGA=$(FIRMWARE_EMEGA_1_0) $(FIRMWARE_EMEGA_2_0)
 
-FIRMWARE_EMOTOR_2=$(top_srcdir)/src/easymotor-v2/easymotor-v2-$(VERSION).ihx
-FIRMWARE_EMOTOR=$(FIRMWARE_EMOTOR_2)
+FIRMWARE_EMOTOR_3=$(top_srcdir)/src/easymotor-v3/easymotor-v3-$(VERSION).ihx
+FIRMWARE_EMOTOR=$(FIRMWARE_EMOTOR_3)
 
 FIRMWARE_ETIMER_1=$(top_srcdir)/src/easytimer-v1/easytimer-v1-$(VERSION).ihx
 FIRMWARE_ETIMER=$(FIRMWARE_ETIMER_1)
@@ -169,6 +171,7 @@ FIRMWARE=$(FIRMWARE_TM) $(FIRMWARE_TELEMINI) $(FIRMWARE_TD) $(FIRMWARE_TBT) $(FI
 ALTUSMETRUM_DOC=$(top_srcdir)/doc/altusmetrum.pdf
 ALTOS_DOC=$(top_srcdir)/doc/altos.pdf
 TELEMETRY_DOC=$(top_srcdir)/doc/telemetry.pdf
+MOTORTEST_DOC=$(top_srcdir)/doc/motortest.pdf
 TEMPLATE_DOC=\
        $(top_srcdir)/doc/telemetrum-outline.pdf \
        $(top_srcdir)/doc/easymini-outline.pdf \
@@ -176,7 +179,7 @@ TEMPLATE_DOC=\
        $(top_srcdir)/doc/telemini-v1-outline.pdf \
        $(top_srcdir)/doc/telemini-v3-outline.pdf
 
-DOC=$(ALTUSMETRUM_DOC) $(ALTOS_DOC) $(TELEMETRY_DOC) $(TEMPLATE_DOC)
+DOC=$(ALTUSMETRUM_DOC) $(ALTOS_DOC) $(TELEMETRY_DOC) $(MOTORTEST_DOC) $(TEMPLATE_DOC)
 
 # Distribution targets
 LINUX_DIST=Altos-Linux-$(VERSION).tar.bz2
@@ -409,3 +412,8 @@ $(MACOSX_DIST): $(MACOSX_FILES) $(MACOSX_EXTRA) Makefile
 $(WINDOWS_DIST): $(WINDOWS_FILES) altos-windows.nsi Instdrv/NSIS/Includes/java.nsh
        -rm -f $@
        makensis -Oaltos-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" altos-windows.nsi || (cat altos-windows.log && exit 1)
+       if [ "$(HAVE_WINDOWS_KEY)" = "yes" ]; then \
+       jsign --keystore "$(WINDOWSKEYFILE)" --alias 1 \
+               --storetype PKCS12 --storepass `cat "$(WINDOWSKEYPASSFILE)"` \
+               --tsaurl http://ts.ssl.com --tsmode RFC3161 $@ ; \
+       fi
index 6e8b1cca8b0362ed491d38fd8ad6f153ed7931fc..7abd4d03f15ce4d2205ae0b1d7dd097fa41fe322 100644 (file)
@@ -135,9 +135,10 @@ Section "Firmware"
        File "../src/telemega-v5.0/telemega-v5.0-${VERSION}.ihx"
        File "../src/easymini-v1.0/easymini-v1.0-${VERSION}.ihx"
        File "../src/easymini-v2.0/easymini-v2.0-${VERSION}.ihx"
+       File "../src/easymini-v3.0/easymini-v3.0-${VERSION}.ihx"
        File "../src/easymega-v1.0/easymega-v1.0-${VERSION}.ihx"
        File "../src/easymega-v2.0/easymega-v2.0-${VERSION}.ihx"
-       File "../src/easymotor-v2/easymotor-v2-${VERSION}.ihx"
+       File "../src/easymotor-v3/easymotor-v3-${VERSION}.ihx"
        File "../src/easytimer-v1/easytimer-v1-${VERSION}.ihx"
        File "../src/telelco-v2.0/telelco-v2.0-${VERSION}.ihx"
        File "../src/telefireeight-v1.0/telefireeight-v1.0-${VERSION}.ihx"
@@ -152,6 +153,7 @@ Section "Documentation"
        File "../doc/altusmetrum.pdf"
        File "../doc/altos.pdf"
        File "../doc/telemetry.pdf"
+       File "../doc/motortest.pdf"
        File "../doc/telemetrum-outline.pdf"
        File "../doc/telemega-outline.pdf"
        File "../doc/easymini-outline.pdf"
index 1ccde1d6c2e341a2930dc636b603e4f565ff47d7..46dc80f36e02b56defd2fa5a99d0e430c8a04bfe 100644 (file)
@@ -95,8 +95,19 @@ public class AltosGraph extends AltosUIGraph {
 
        AltosUIFlightSeries flight_series;
 
+       boolean enable_axis(int product_id, String label) {
+               switch (product_id) {
+               case AltosLib.product_easymotor:
+                       return(label.equals(AltosUIFlightSeries.motor_pressure_name) ||
+                              label.equals(AltosUIFlightSeries.accel_name));
+               default:
+                       return true;
+               }
+       }
+
        AltosUITimeSeries[] setup(AltosFlightStats stats, AltosUIFlightSeries flight_series) {
                AltosCalData    cal_data = flight_series.cal_data();
+               int             product_id = cal_data.device_type;
 
                AltosUIAxis     height_axis, speed_axis, accel_axis, voltage_axis, temperature_axis, nsat_axis, dbm_axis;
                AltosUIAxis     pressure_axis, thrust_axis;
@@ -134,7 +145,7 @@ public class AltosGraph extends AltosUIGraph {
 
                flight_series.register_marker(AltosUIFlightSeries.state_name,
                                              state_color,
-                                             true,
+                                             enable_axis(product_id, AltosUIFlightSeries.state_name),
                                              plot,
                                              true);
 
@@ -151,12 +162,12 @@ public class AltosGraph extends AltosUIGraph {
 
                flight_series.register_axis(AltosUIFlightSeries.accel_name,
                                            accel_color,
-                                           true,
+                                           enable_axis(product_id, AltosUIFlightSeries.accel_name),
                                            accel_axis);
 
                flight_series.register_axis(AltosUIFlightSeries.vert_accel_name,
                                            vert_accel_color,
-                                           true,
+                                           enable_axis(product_id, AltosUIFlightSeries.vert_accel_name),
                                            accel_axis);
 
                flight_series.register_axis(AltosUIFlightSeries.kalman_accel_name,
@@ -171,12 +182,12 @@ public class AltosGraph extends AltosUIGraph {
 
                flight_series.register_axis(AltosUIFlightSeries.speed_name,
                                            speed_color,
-                                           true,
+                                           enable_axis(product_id, AltosUIFlightSeries.speed_name),
                                            speed_axis);
 
                flight_series.register_axis(AltosUIFlightSeries.kalman_speed_name,
                                            kalman_speed_color,
-                                           true,
+                                           enable_axis(product_id, AltosUIFlightSeries.kalman_speed_name),
                                            speed_axis);
 
                flight_series.register_axis(AltosUIFlightSeries.pressure_name,
@@ -186,7 +197,7 @@ public class AltosGraph extends AltosUIGraph {
 
                flight_series.register_axis(AltosUIFlightSeries.height_name,
                                            height_color,
-                                           true,
+                                           enable_axis(product_id, AltosUIFlightSeries.height_name),
                                            height_axis);
 
                flight_series.register_axis(AltosUIFlightSeries.altitude_name,
@@ -347,7 +358,7 @@ public class AltosGraph extends AltosUIGraph {
 
                flight_series.register_axis(AltosUIFlightSeries.thrust_name,
                                            accel_color,
-                                           true,
+                                           enable_axis(product_id, AltosUIFlightSeries.thrust_name),
                                            thrust_axis);
 
                for (int channel = 0; channel < 8; channel++) {
@@ -359,7 +370,7 @@ public class AltosGraph extends AltosUIGraph {
 
                flight_series.register_axis(AltosUIFlightSeries.motor_pressure_name,
                                            motor_pressure_color,
-                                           true,
+                                           enable_axis(product_id, AltosUIFlightSeries.motor_pressure_name),
                                            motor_pressure_axis);
 
                flight_series.check_axes();
index c40903ced0c37c590214b11d764af264bde8714e..2066741bd8bfa450a617c080fc2130d0a98c45f2 100644 (file)
@@ -130,22 +130,18 @@ public class AltosUIPreferences extends AltosPreferences {
                        flush_preferences();
                        AltosUILib.set_fonts(font_size);
                        for (AltosFontListener l : font_listeners) {
-                               System.out.printf("notifying %s of font size change\n", l);
                                l.font_size_changed(font_size);
                        }
-                       System.out.printf("all fonts changed\n");
                }
        }
 
        public static void register_font_listener(AltosFontListener l) {
-               System.out.printf("register font listener\n");
                synchronized (backend) {
                        font_listeners.add(l);
                }
        }
 
        public static void unregister_font_listener(AltosFontListener l) {
-               System.out.printf("unregister font listener\n");
                synchronized (backend) {
                        font_listeners.remove(l);
                }
index e249af9e884d912571c388300adb3b15810dee79..ec5f9c4da932c91785ad7d20d995993bb45efc3e 100644 (file)
@@ -148,7 +148,7 @@ ao_thrust(int16_t value, int16_t max_adc, double ref, double r1, double r2)
 }
 
 static void
-ao_pressure(int16_t value, int16_t max_adc, double ref, double r1, double r2)
+ao_pressure(int16_t value, int16_t max_adc, double ref, double r1, double r2, double sensor_range)
 {
        printf(" pressure %5d", value);
        if (r1 && r2 && ref) {
@@ -156,7 +156,7 @@ ao_pressure(int16_t value, int16_t max_adc, double ref, double r1, double r2)
                if (volts < 0.5) volts = 0.5;
                if (volts > 4.5) volts = 4.5;
 
-               double psi = (volts - 0.5) / 4.0 * 2500.0;
+               double psi = (volts - 0.5) / 4.0 * sensor_range;
                double pa = psi_to_pa(psi);
                printf(" %9.3f kPa", pa / 1000.0);
        }
@@ -261,6 +261,7 @@ main (int argc, char **argv)
                double  sense_r1 = 0.0, sense_r2 = 0.0;
                double  batt_r1 = 0.0, batt_r2 = 0.0;
                double  adc_ref = 0.0;
+               double  pressure_sensor = 0.0;
                int16_t max_adc = 0;
 
                switch (eeprom->log_format) {
@@ -315,6 +316,7 @@ main (int argc, char **argv)
                        break;
                case AO_LOG_FORMAT_TELEFIRETWO:
                        len = 32;
+                       pressure_sensor = 2500.0;
                        max_adc = 4095;
                        adc_ref = 3.3;
                        sense_r1 = batt_r1 = 5600;
@@ -353,7 +355,6 @@ main (int argc, char **argv)
                        break;
                case AO_LOG_FORMAT_TELEMEGA_4:
                        len = 32;
-                       break;
                        max_adc= 4095;
                        adc_ref = 3.3;
                        batt_r1 = 5600;
@@ -361,6 +362,16 @@ main (int argc, char **argv)
                        sense_r1 = 100e3;
                        sense_r2 = 27e3;
                        break;
+               case AO_LOG_FORMAT_EASYMOTOR:
+                       len = 16;
+                       max_adc = 32767;
+                       adc_ref = 3.3;
+                       pressure_sensor = 1600.0;
+                       batt_r1 = 5600;
+                       batt_r2 = 10000;
+                       sense_r1 = 5600;
+                       sense_r2 = 10000;
+                       break;
                }
                if (arg_len)
                        len = arg_len;
@@ -385,6 +396,7 @@ main (int argc, char **argv)
                                struct ao_log_metrum *log_metrum;
                                struct ao_log_gps *log_gps;
                                struct ao_log_firetwo *log_firetwo;
+                               struct ao_log_motor *log_motor;
 
                                if (!csum && !ao_csum_valid(&eeprom->data[pos], len)) {
                                        if (verbose)
@@ -626,7 +638,8 @@ main (int argc, char **argv)
                                        case AO_LOG_SENSOR:
                                                ao_pressure(log_firetwo->u.sensor.pressure,
                                                            max_adc, adc_ref,
-                                                           sense_r1, sense_r2);
+                                                           sense_r1, sense_r2,
+                                                           pressure_sensor);
                                                ao_thrust(log_firetwo->u.sensor.thrust,
                                                          max_adc, adc_ref,
                                                          sense_r1, sense_r2);
@@ -681,6 +694,45 @@ main (int argc, char **argv)
                                                break;
                                        }
                                        break;
+                               case AO_LOG_FORMAT_EASYMOTOR:
+                                       log_motor = (struct ao_log_motor *) &eeprom->data[pos];
+                                       switch (log_motor->type) {
+                                       case AO_LOG_FLIGHT:
+                                               printf(" serial %5u flight %5u ground_accel %6d",
+                                                      eeprom->serial_number,
+                                                      log_motor->u.flight.flight,
+                                                      log_motor->u.flight.ground_accel);
+                                               printf(" along %6d aross %6d through %6d",
+                                                      log_motor->u.flight.ground_accel_along,
+                                                      log_motor->u.flight.ground_accel_across,
+                                                      log_motor->u.flight.ground_accel_through);
+                                               ao_volts("ground pressure",
+                                                        log_motor->u.flight.ground_motor_pressure,
+                                                        max_adc, adc_ref,
+                                                        sense_r1, sense_r2);
+                                               break;
+                                       case AO_LOG_STATE:
+                                               ao_state(log_motor->u.state.state,
+                                                        log_motor->u.state.reason);
+                                               break;
+                                       case AO_LOG_SENSOR:
+                                               ao_volts("pressure",
+                                                        log_motor->u.sensor.pressure,
+                                                        max_adc, adc_ref,
+                                                        sense_r1, sense_r2);
+                                               ao_volts("v_batt",
+                                                        log_motor->u.sensor.v_batt,
+                                                        max_adc,
+                                                        adc_ref, batt_r1, batt_r2);
+                                               printf(" accel %6d",
+                                                      log_motor->u.sensor.accel);
+                                               printf(" along %6d aross %6d through %6d",
+                                                      log_motor->u.sensor.accel_along,
+                                                      log_motor->u.sensor.accel_across,
+                                                      log_motor->u.sensor.accel_through);
+                                               break;
+                                       }
+                                       break;
                                case AO_LOG_FORMAT_DETHERM:
                                        break;
                                }
index e52e6f5a5625ac1fc7b39e0129d484f2b06ebbc7..859d26785fe06215d790af361462b009d974563b 100644 (file)
 .\"
 .TH AO-LOAD 1 "ao-elftohex" ""
 .SH NAME
-ao-elftohex \- convert a program to IHX format
+ao-elftohex \- convert programs to IHX format
 .SH SYNOPSIS
 .B "ao-elftohex"
 [\--output-\fIoutput.ihx\fP]
 [\--verbose]
-\fIinput.elf\fP
+\fIinput.elf ...\fP
 .SH DESCRIPTION
 .I ao-elftohex
-reads the specified .elf file and writes out a .ihx version.
+reads the specified .elf files and writes out a .ihx version.
 .SH OPTIONS
 .TP
 \--output=\fIoutput.ihx\fP
@@ -34,5 +34,10 @@ This specifies the output file (default is stdout)
 .TP
 \--verbose
 Dumps some debug information.
+.TP
+\--nosym
+Excluded symbol table information from the resulting file. This
+information is a non-standard extension supported by the Altus Metrum
+tools.
 .SH AUTHOR
 Keith Packard
index f3ab0c38ca4a1fdeff140e14a553979b1aeecff6..a31f9656f6cd80a88d11f6eded1d9b4f008eef68 100644 (file)
@@ -27,6 +27,7 @@
 static const struct option options[] = {
        { .name = "verbose", .has_arg = 1, .val = 'v' },
        { .name = "output", .has_arg = 1, .val = 'o' },
+       { .name = "nosym", .has_arg = 0, .val = 'n' },
        { 0, 0, 0, 0},
 };
 
@@ -52,13 +53,15 @@ main (int argc, char **argv)
 {
        char                    *input = NULL;
        char                    *output = NULL;
-       struct ao_hex_image     *image;
-       struct ao_sym           *file_symbols;
+       struct ao_hex_image     *full_image = NULL;
+       struct ao_sym           *file_symbols = NULL;
        int                     num_file_symbols;
        FILE                    *file;
        int                     c;
+       int                     i;
+       int                     nosym = 0;
 
-       while ((c = getopt_long(argc, argv, "v:o:", options, NULL)) != -1) {
+       while ((c = getopt_long(argc, argv, "nv:o:", options, NULL)) != -1) {
                switch (c) {
                case 'o':
                        output = optarg;
@@ -66,23 +69,50 @@ main (int argc, char **argv)
                case 'v':
                        ao_verbose = (int) strtol(optarg, NULL, 0);
                        break;
+               case 'n':
+                       nosym = 1;
+                       break;
                default:
                        usage(argv[0]);
                        break;
                }
        }
 
-       input = argv[optind];
-       if (input == NULL)
+       if (optind >= argc)
                usage(argv[0]);
 
-       if (ends_with (input, ".ihx"))
-               image = ao_hex_load(input, &file_symbols, &num_file_symbols);
-       else
-               image = ao_load_elf(input, &file_symbols, &num_file_symbols);
+       for (i = optind; i < argc; i++) {
+               struct ao_hex_image *image;
 
-       if (!image)
-               usage(argv[0]);
+               input = argv[i];
+
+               free(file_symbols);
+               num_file_symbols = 0;
+               if (ends_with (input, ".ihx"))
+                       image = ao_hex_load(input, &file_symbols, &num_file_symbols);
+               else
+                       image = ao_load_elf(input, &file_symbols, &num_file_symbols);
+
+               if (!image) {
+                       fprintf(stderr, "Failed to load %s\n", input);
+                       usage(argv[0]);
+               }
+
+               if (nosym) {
+                       free(file_symbols);
+                       file_symbols = NULL;
+                       num_file_symbols = 0;
+               }
+
+               if (full_image) {
+                       full_image = ao_hex_image_cat(full_image, image);
+                       if (!full_image) {
+                               fprintf(stderr, "Can't merge image %s\n", input);
+                               usage(argv[0]);
+                       }
+               } else
+                       full_image = image;
+       }
 
        if (!output)
                file = stdout;
@@ -94,7 +124,7 @@ main (int argc, char **argv)
                }
        }
 
-       if (!ao_hex_save(file, image, file_symbols, num_file_symbols)) {
+       if (!ao_hex_save(file, full_image, file_symbols, num_file_symbols)) {
                fprintf(stderr, "%s: failed to write hex file\n", output ? output : "<stdout>");
                if (output)
                        unlink(output);
index e4a9b0ccba23b171bea671a4d2407bf0ed45a618..11e4f91d92e0fe6f9daa13b1ff9828ac55de91a9 100644 (file)
@@ -45,6 +45,7 @@
 #define AO_LOG_FORMAT_TELESTATIC       17      /* 32 byte typed telestatic records */
 #define AO_LOG_FORMAT_MICROPEAK2       18      /* 2-byte baro values with header */
 #define AO_LOG_FORMAT_TELEMEGA_4       19      /* 32 byte typed telemega records with 32 bit gyro cal and Bmx160 */
+#define AO_LOG_FORMAT_EASYMOTOR                20      /* 16 byte typed easymotor records with pressure sensor and adxl375 */
 #define AO_LOG_FORMAT_NONE             127     /* No log at all */
 
 enum ao_pyro_flag {
@@ -515,6 +516,37 @@ struct ao_log_gps {
        } u;
 };
 
+struct ao_log_motor {
+       char                    type;                   /* 0 */
+       uint8_t                 csum;                   /* 1 */
+       uint16_t                tick;                   /* 2 */
+       union {                                         /* 4 */
+               /* AO_LOG_FLIGHT */
+               struct {
+                       uint16_t        flight;                 /* 4 */
+                       int16_t         ground_accel;           /* 6 */
+                       int16_t         ground_accel_along;     /* 8 */
+                       int16_t         ground_accel_across;    /* 10 */
+                       int16_t         ground_accel_through;   /* 12 */
+                       int16_t         ground_motor_pressure;  /* 14 */
+               } flight;                                       /* 16 */
+               /* AO_LOG_STATE */
+               struct {
+                       uint16_t        state;                  /* 4 */
+                       uint16_t        reason;                 /* 6 */
+               } state;
+               /* AO_LOG_SENSOR */
+               struct {
+                       uint16_t        pressure;               /* 4 */
+                       uint16_t        v_batt;                 /* 6 */
+                       int16_t         accel;                  /* 8 */
+                       int16_t         accel_across;           /* 10 */
+                       int16_t         accel_along;            /* 12 */
+                       int16_t         accel_through;          /* 14 */
+               } sensor;                                       /* 16 */
+       } u;
+};
+
 struct ao_eeprom {
        struct ao_config        config;
        struct ao_ms5607_prom   ms5607_prom;
index d4164741f882d5a759bb4700d0edf707ea214855..19490ec6e1e351de73f3e7232d8ff70f8b29af49 100644 (file)
@@ -18,13 +18,13 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([altos], 1.9.11)
+AC_INIT([altos], 1.9.12)
 ANDROID_VERSION=35
 AC_CONFIG_SRCDIR([src/kernel/ao.h])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
-RELEASE_DATE=2022-05-29
+RELEASE_DATE=2022-10-28
 AC_SUBST(RELEASE_DATE)
 
 DOC_DATE=`LC_ALL=C date -d $RELEASE_DATE +'%d %b %Y'`
@@ -200,6 +200,22 @@ else
        HAVE_GOOGLE_KEY="no"
 fi
 
+AC_ARG_WITH(windows-key, AS_HELP_STRING([--with-windows-key=PATH],
+            [Set the file containing the Windows installer signing key (defaults to ~/altusmetrumllc/ssl.com/altus_metrum,_llc.p12)]),
+           [WINDOWSKEYFILE="$withval"], [WINDOWSKEYFILE=$HOME/altusmetrumllc/ssl.com/altus_metrum,_llc.p12])
+
+AC_ARG_WITH(windows-key-pass, AS_HELP_STRING([--with-windows-key-pass=PATH],
+            [Set the file containing the Windows installer signing key password (defaults to ~/altusmetrumllc/ssl.com/password)]),
+           [WINDOWSKEYPASSFILE="$withval"], [WINDOWSKEYPASSFILE=$HOME/altusmetrumllc/ssl.com/password])
+
+AC_CHECK_PROG(jsign, jsign, "yes", "no")
+
+if test -s "$WINDOWSKEYFILE" -a -s "$WINDOWSKEYPASSFILE" -a "$jsign" = yes; then
+       HAVE_WINDOWS_KEY="yes"
+else
+       HAVE_WINDOWS_KEY="no"
+fi
+
 WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
 AC_SUBST(WARN_CFLAGS)
 
@@ -210,6 +226,9 @@ AC_ARG_ENABLE(faketime, AS_HELP_STRING([--enable-faketime],
 AM_CONDITIONAL(FAKETIME, [test x$FAKETIME = xyes])
 
 AC_SUBST(GOOGLEKEY)
+AC_SUBST(WINDOWSKEYFILE)
+AC_SUBST(WINDOWSKEYPASSFILE)
+AC_SUBST(HAVE_WINDOWS_KEY)
 
 AC_PROG_CC
 AC_PROG_INSTALL
@@ -585,6 +604,7 @@ echo "    jfreechart..................: ${JFREECHART}"
 echo "    jcommon.....................: ${JCOMMON}"
 echo "    JVM include.................: ${JVM_INCLUDE}"
 echo "    AltosDroid maps API key.....: ${HAVE_GOOGLE_KEY}"
+echo "    Windows installer key.......: ${HAVE_WINDOWS_KEY}"
 if test x${ANDROID_SDK} != "xno"; then
 echo ""
 echo "  Android path"
index 35e696cb6b3ffeff20c2302dd1eca78b4feacb34..3827f79d260ccbeb2653c2ff915a4ed8ddea351d 100644 (file)
@@ -17,6 +17,7 @@ FAKETIME=TZ=UTC faketime -f '$(RELEASE_DATE) 00:00:00 i0'
 endif
 
 RELNOTES_INC=\
+       release-notes-1.9.12.inc \
        release-notes-1.9.11.inc \
        release-notes-1.9.10.inc \
        release-notes-1.9.9.inc \
index 6fac8e450d03083724bbf489e714ee92f3654f11..b7d2b510c41ab98fbba88dcee720ea30fe90fb3c 100644 (file)
@@ -22,5 +22,5 @@
        NAR #87103, TRA #12201
 
        [verse]
-       Keith Packard, KD7SQG
+       Keith Packard, K7WQ
        NAR #88757, TRA #12200
index ed98d5b78d7418856c15d1cdab27f61f49ba01da..e85db6811a0be4f467609e846bb632b6e6b8ef39 100644 (file)
@@ -1,5 +1,9 @@
 [appendix]
 == Release Notes
+       :leveloffset: 2
+       include::release-notes-1.9.12.adoc[]
+
+       <<<<
        :leveloffset: 2
        include::release-notes-1.9.11.adoc[]
 
index afb935d750b9ad2f69164da91f9323b8a06cde01..c02c613a8287c14a145254545c75d674044c1fdd 100644 (file)
@@ -28,7 +28,7 @@ Keith Packard <keithp@keithp.com>; Bdale Garbee <bdale@gag.com>
        NAR #87103, TRA #12201
 
        [verse]
-       Keith Packard, KD7SQG
+       Keith Packard, K7WQ
        NAR #88757, TRA #12200
 
 == Using MicroPeak
index 290c7b8fa7d3542511944278321f2ae77c012bb6..1edee68d4c57293bb32a12e53d854b623a9863c2 100644 (file)
@@ -9,14 +9,11 @@
        === Power Switch and Battery
 
                In addition to the circuit board itself, EasyMotor needs
-               a power switch and battery to operate. Unlike most other
-               Altus Metrum products, EasyMotor does not work with
-               single-cell LiPo batteries. That's because commonly
-               available inexpensive pressure sensors need 5V, which is
-               more than a single-cell LiPo provides. Any battery that
-               provides from 6.5 to about 15 volts should work. Good
-               choices are the common 9V alkaline battery, or the very
-               small and light A23 12V alkaline batteries.
+               a power switch and battery to operate.  Like many Altus 
+               Metrum products, EasyMotor requires a single-cell LiPo 
+               battery, and has an on-board charging circuit.  The 5V
+               needed for inexpensive pressure sensors is generated 
+               onboard using a switching regulator to boost the voltage.
 
                Because he often mounts EasyMotor to the motor's forward
                bulkhead instead of to the airframe itself, Bdale often
@@ -40,7 +37,8 @@
                by the sensor. Very inexpensive sensors that have a
                “1/8 NPT” threaded input, a “Buick-style” 3-pin connector,
                and typically ship with a short cable and mating
-               connector, are readily available on eBay and AliExpress.
+               connector, are readily available through various vendors
+               including Amazon, eBay, and AliExpress.
 
                To log in-flight chamber pressure, a typical approach
                might be to drill a 1/8" sampling hole all the way
@@ -49,3 +47,8 @@
                NPT” pipe tap. Fill the touch hole with grease, screw in
                the pressure sensor, and attach the sensor leads to
                EasyMotor.
+
+               If you aren't up for machining closures yourself, 
+               link:http://lokiresearch.com[Loki Research] sells 
+               54mm and 75mm "experimental bulkheads" with threaded
+               sensor ports that can be used with snap ring cases.
index fa30cb98cf47e42a44257d242e0970013dd77467..85776a25463544baa5f7ee9390b71229678d0276 100644 (file)
@@ -23,5 +23,5 @@ Because documentation is just as prone as software to contain “bugs”, and
 can always be improved… If you have questions that aren't answered in this 
 manual, or just need a little help figuring things out, we strongly suggest 
 joining the Altus Metrum user email list, which you can do by visiting 
-https://lists.gag.com/mailman/listinfo/altusmetrum.
+https://lists.gag.com/mailman3.
 
index e38fbe3a2dd79a85ccea960f187634f06d983008..6371ae04c49301f62ad1d72824e25aadb1032a2f 100644 (file)
@@ -10,5 +10,7 @@
        data 100 times per second throughout the flight.
 
        After flight, AltosUI can be used to download the flight data,
-       then export it to a comma separated values (CSV) file. Such a
-       file can easily be loaded into a spreadsheet for analysis.
+       view a quick graph of acceleration and pressure with pan and
+       zoom capabilities, then export it to a comma separated values 
+       (CSV) file. Such a file can easily be loaded into a spreadsheet 
+       for analysis.
diff --git a/doc/release-notes-1.9.12.inc b/doc/release-notes-1.9.12.inc
new file mode 100644 (file)
index 0000000..ce207fb
--- /dev/null
@@ -0,0 +1,16 @@
+= Release Notes for Version 1.9.12
+include::release-head.adoc[]
+:doctype: article
+
+       Version 1.9.12
+
+       == AltOS
+
+       * Add EasyMini v3.0 and EasyMotor v3.0 support
+
+       * Fix TeleMetrum v2.0 configuration. Saving config would
+         crash the board.
+
+       == AltosUI
+
+       * Add EasyMotor log parsing and graphing.
index 53bba419425d287c1569ba0f0128b8e633c85583..33230a3baa8652c9e8d3ba7b96461140a8c92258 100644 (file)
@@ -1,5 +1,9 @@
 [appendix]
 == Release Notes
+       :leveloffset: 2
+       include::release-notes-1.9.12.adoc[]
+
+       <<<<
        :leveloffset: 2
        include::release-notes-1.9.11.adoc[]
 
index 4bba9a53d3d716a6328883bf734665bbd98909c1..fd63d935bafd930782b68a27365506b27141c3d9 100644 (file)
 
        endif::telemini[]
        ifdef::easymini[]
-       |EasyMini v1.0
-       |MS5607 30km (100k')
-       |-
-       |-
-       |-
-       |1MB
-       |-
-       |3.7-12V
-
-       |EasyMini v2.0
+       |EasyMini v1.0-v3.0
        |MS5607 30km (100k')
        |-
        |-
        endif::easytimer[]
        
        ifdef::easymotor[]
-       |EasyMotor v2.0
+       |EasyMotor v3.0
        |-
        |ADXL375 200g
        |-
        |-
-       |-
+       |8MB
        |-
        |6.5-15V
        endif::easymotor[]
index 719c309c6bc0c4b636fe2db35c851c9f123d67b1..0b7d54d089470c730b08f6bbfe14dff2525783d9 100644 (file)
@@ -15,5 +15,5 @@
        NAR #87103, TRA #12201
 
        [verse]
-       Keith Packard, KD7SQG
+       Keith Packard, K7WQ
        NAR #88757, TRA #12200
index b1e884a5c5fe11b025f83ca765d324af90211e35..0166396c68c8ac0346a7d15ce1c2d5caaadc53b4 100644 (file)
@@ -1,5 +1,9 @@
 [appendix]
 == Release Notes
+       :leveloffset: 2
+       include::release-notes-1.9.12.adoc[]
+
+       <<<<
        :leveloffset: 2
        include::release-notes-1.9.11.adoc[]
 
index 3296624f8e96119a0acc2dbdd8709587a93e6c16..4a0f06ab9d35f09b7aba1a2c707acd511d783677 100644 (file)
@@ -22,5 +22,5 @@
        NAR #87103, TRA #12201
 
        [verse]
-       Keith Packard, KD7SQG
+       Keith Packard, K7WQ
        NAR #88757, TRA #12200
index 09cf9617cf9e07485c4a67c73ed15b363544d615..bd938e2513ed5ede19b7dae7a1b8f56ed4745fe7 100644 (file)
@@ -1,3 +1,5 @@
+# location of code signing key, et al
 JAVAROOT=classes
 AM_JAVACFLAGS=$(JAVAC_VERSION_FLAGS) -encoding UTF-8 -Xlint:deprecation -Xlint:unchecked
 
@@ -345,6 +347,11 @@ $(MACOSX_DIST): $(MACOSX_FILES)
 $(WINDOWS_DIST): $(WINDOWS_FILES) micropeak-windows.nsi
        -rm -f $@
        makensis -Omicropeak-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" micropeak-windows.nsi || (cat micropeak-windows.log && exit 1)
+       if [ "$(HAVE_WINDOWS_KEY)" = "yes" ]; then \
+       jsign --keystore "$(WINDOWSKEYFILE)" --alias 1 \
+               --storetype PKCS12 --storepass `cat "$(WINDOWSKEYPASSFILE)"` \
+               --tsaurl http://ts.ssl.com --tsmode RFC3161 $@ ; \
+       fi
 
 Manifest.txt: Makefile
        echo 'Main-Class: org.altusmetrum.micropeak.MicroPeak' > $@
index 2cc04e5354233b247d3bf42084c8c9c450671d91..45adc166059d717fd00b68f9c224b1c4b3dd52af 100644 (file)
@@ -19,7 +19,7 @@ include Makedefs
 ARMM3DIRS=\
        easymega-v1.0 easymega-v1.0/flash-loader \
        easymega-v2.0 easymega-v2.0/flash-loader \
-       easymotor-v2 easymotor-v2/flash-loader \
+       easymotor-v3 easymotor-v3/flash-loader \
        easytimer-v1 easytimer-v1/flash-loader \
        telemega-v0.1 telemega-v0.1/flash-loader \
        telemega-v1.0 telemega-v1.0/flash-loader \
@@ -51,6 +51,7 @@ ARMM0DIRS=\
        chaoskey-v1.0 chaoskey-v1.0/flash-loader \
        telemini-v3.0 telemini-v3.0/flash-loader \
        easymini-v2.0 easymini-v2.0/flash-loader \
+       easymini-v3.0 easymini-v3.0/flash-loader \
        micropeak-v2.0
 
 AVRDIRS=\
index 0bc8188e3d2ae68c7eca2b78a214b473ce34b712..ce87e3a80bf491c09cd6f11bd760e30988c99dd2 100644 (file)
@@ -362,7 +362,7 @@ uint8_t ao_aes_mutex;
 static word32 key[16/4];
 static roundkey        rkk;
 
-static word32 iv[16/4];
+static word32 iv[32/4];
 
 void
 ao_aes_set_mode(enum ao_aes_mode mode)
index c95bf9e32bc02776c31b25aa2eec055d79080230..9e5666cc5d6dcb83ea11697e676ba3b544555f01 100644 (file)
@@ -21,7 +21,7 @@
 #define DEBUG          0
 
 #if DEBUG
-#define PRINTD(l, ...) do { if (DEBUG & (l)) { printf ("\r%5u %s: ", ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } } while(0)
+#define PRINTD(l, ...) do { if (DEBUG & (l)) { printf ("\r%5lu %s: ", ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } } while(0)
 #else
 #define PRINTD(l,...)
 #endif
@@ -55,7 +55,7 @@ ao_adxl375_reg_read(uint8_t addr)
        ao_spi_duplex(d, d, 2, AO_ADXL375_SPI_INDEX);
        ao_adxl375_stop();
 
-       PRINTD(DEBUG_LOW, "read %x = %x\n", addr, d);
+       PRINTD(DEBUG_LOW, "read %x = %x\n", addr, d[1]);
 
        return d[1];
 }
@@ -73,7 +73,7 @@ ao_adxl375_reg_write(uint8_t addr, uint8_t value)
        ao_adxl375_stop();
 
 #if DEBUG & DEBUG_LOW
-       d[0] = addr | AO_ADXL375_READ
+       d[0] = addr | AO_ADXL375_READ;
        d[1] = 0;
        ao_adxl375_start();
        ao_spi_duplex(d, d, 2, AO_ADXL375_SPI_INDEX);
@@ -129,7 +129,7 @@ ao_adxl375_total_value(struct ao_adxl375_total *total, int samples)
 #define AO_ADXL375_DATA_FORMAT_SETTINGS(self_test) (                   \
                AO_ADXL375_DATA_FORMAT_FIXED |                          \
                (self_test << AO_ADXL375_DATA_FORMAT_SELF_TEST) |       \
-               (AO_ADXL375_DATA_FORMAT_SPI_4_WIRE << AO_ADXL375_DATA_FORMAT_SPI_4_WIRE) | \
+               (AO_ADXL375_DATA_FORMAT_SPI_4_WIRE << AO_ADXL375_DATA_FORMAT_SPI) | \
                (0 << AO_ADXL375_DATA_FORMAT_INT_INVERT) |              \
                (0 << AO_ADXL375_DATA_FORMAT_JUSTIFY))
 
index fe448fd0e27857d06592188d5aa38548ca5b6348..32fe0fac30247948e710c3d9b8fcaaf080ea64d9 100644 (file)
@@ -72,8 +72,8 @@
 # define AO_ADXL375_DATA_FORMAT_FIXED          0x0b    /* these bits must be set to 1 */
 # define AO_ADXL375_DATA_FORMAT_SELF_TEST      7
 # define AO_ADXL375_DATA_FORMAT_SPI            6
-# define  AO_ADXL375_DATA_FORMAT_SPI_3_WIRE            0
-# define  AO_ADXL375_DATA_FORMAT_SPI_4_WIRE            1
+# define  AO_ADXL375_DATA_FORMAT_SPI_3_WIRE            1
+# define  AO_ADXL375_DATA_FORMAT_SPI_4_WIRE            0
 # define AO_ADXL375_DATA_FORMAT_INT_INVERT     5
 # define AO_ADXL375_DATA_FORMAT_JUSTIFY                2
 #define AO_ADXL375_DATAX0              0x32
index e146f54a46fd954224bc95ae8bb1cbe3c9b98ca8..755de1f06ea72779a7f140ad88c654b2d10746e4 100644 (file)
@@ -56,15 +56,25 @@ CFLAGS = $(PRODUCT_DEF) $(LPC_CFLAGS)
 PROGNAME=easymini-v1.0
 PROG=$(PROGNAME)-$(VERSION).elf
 HEX=$(PROGNAME)-$(VERSION).ihx
+FLASH_PROG=flash-loader/$(PROGNAME)-altos-flash-$(VERSION).elf
+BOTH_HEX=$(PROGNAME)-combined-$(VERSION).ihx
 
 SRC=$(ALTOS_SRC) ao_easymini.c
 OBJ=$(SRC:.c=.o)
 
-all: $(PROG) $(HEX)
+all: $(PROG) $(HEX) $(BOTH_HEX)
 
 $(PROG): Makefile $(OBJ) altos.ld
        $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)
 
+$(BOTH_HEX): $(PROG) $(FLASH_PROG)
+       ../../ao-tools/ao-elftohex/ao-elftohex -n --output=$@ $(FLASH_PROG) $(PROG)
+
+$(FLASH_PROG): FRC
+       +cd flash-loader && make
+
+FRC:
+
 $(OBJ): $(INC)
 
 load: $(PROG)
index eb805c76bd34ff71c187c9cdd3a279427cbde503..940d0d98c26a7ac62e292a3c4b262a9a78fb5862 100644 (file)
 /* System clock frequency */
 #define AO_LPC_SYSCLK  24000000
 
+/* Beeper is on pio0_14 ct32b1_mat1 */
+#define BEEPER_PORT    0
+#define BEEPER_PIN     14
+#define BEEPER_TIMER   1
+#define BEEPER_OUTPUT  1
+
 #define HAS_USB                1
 
 #define HAS_USB_CONNECT        0
index 681c295619e003975a9563ec2e7262a08efe829a..81be85f46869ec41260c9ec26ce6c35efcbe5a7e 100644 (file)
@@ -56,15 +56,23 @@ CFLAGS = $(PRODUCT_DEF) $(LPC_CFLAGS)
 PROGNAME=easymini-v3.0
 PROG=$(PROGNAME)-$(VERSION).elf
 HEX=$(PROGNAME)-$(VERSION).ihx
+FLASH_PROG=flash-loader/$(PROGNAME)-altos-flash-$(VERSION).elf
+BOTH_HEX=$(PROGNAME)-combined-$(VERSION).ihx
 
 SRC=$(ALTOS_SRC) ao_easymini.c
 OBJ=$(SRC:.c=.o)
 
-all: $(PROG) $(HEX)
+all: $(PROG) $(HEX) $(BOTH_HEX)
 
 $(PROG): Makefile $(OBJ) altos.ld
        $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)
 
+$(BOTH_HEX): $(PROG) $(FLASH_PROG)
+       ../../ao-tools/ao-elftohex/ao-elftohex -n --output=$@ $(FLASH_PROG) $(PROG)
+
+$(FLASH_PROG): FRC
+       +cd flash-loader && make
+
 $(OBJ): $(INC)
 
 load: $(PROG)
@@ -79,3 +87,5 @@ clean:
 install:
 
 uninstall:
+
+FRC:
diff --git a/src/easymotor-v3/Makefile b/src/easymotor-v3/Makefile
new file mode 100644 (file)
index 0000000..b33572a
--- /dev/null
@@ -0,0 +1,78 @@
+#
+# AltOS build
+#
+#
+
+include ../lpc/Makefile.defs
+
+INC = \
+       ao.h \
+       ao_arch.h \
+       ao_arch_funcs.h \
+       ao_pins.h \
+       ao_product.h \
+       ao_adxl375.h \
+       lpc.h
+
+#
+# Common AltOS sources
+#
+
+ALTOS_SRC = \
+       ao_interrupt.c \
+       ao_boot_chain.c \
+       ao_romconfig.c \
+       ao_product.c \
+       ao_mutex.c \
+       ao_panic.c \
+       ao_stdio.c \
+       ao_storage.c \
+       ao_report.c \
+       ao_flight.c \
+       ao_kalman.c \
+       ao_sample.c \
+       ao_data.c \
+       ao_convert_volt.c \
+       ao_task.c \
+       ao_log.c \
+       ao_log_motor.c \
+       ao_cmd.c \
+       ao_config.c \
+       ao_timer_lpc.c \
+       ao_exti_lpc.c \
+       ao_spi_lpc.c \
+       ao_adc_lpc.c \
+       ao_usb_lpc.c \
+       ao_m25.c \
+       ao_adxl375.c \
+       ao_beep_lpc.c
+
+PRODUCT=EasyMotor-v3
+PRODUCT_DEF=-DEASYMOTOR_V_3
+IDPRODUCT=0x002c
+
+CFLAGS = $(PRODUCT_DEF) $(LPC_CFLAGS)
+
+PROGNAME=easymotor-v3
+PROG=$(PROGNAME)-$(VERSION).elf
+HEX=$(PROGNAME)-$(VERSION).ihx
+
+SRC=$(ALTOS_SRC) ao_easymotor.c
+OBJ=$(SRC:.c=.o)
+
+all: $(PROG) $(HEX)
+
+$(PROG): Makefile $(OBJ)
+       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)
+
+$(OBJ): $(INC)
+
+distclean:     clean
+
+clean:
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
+       rm -f ao_product.h
+
+install:
+
+uninstall:
diff --git a/src/easymotor-v3/ao_easymotor.c b/src/easymotor-v3/ao_easymotor.c
new file mode 100644 (file)
index 0000000..154c4c0
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright © 2022 Bdale Garbee <bdale@gag.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include <ao.h>
+#include <ao_adxl375.h>
+#include <ao_log.h>
+#include <ao_exti.h>
+
+int
+main(void)
+{
+       ao_clock_init();
+       ao_task_init();
+       ao_timer_init();
+
+//     ao_dma_init();
+       ao_spi_init();
+       ao_exti_init();
+
+       ao_adc_init();
+       ao_beep_init();
+       ao_cmd_init();
+       ao_usb_init();
+
+       ao_adxl375_init();
+
+       ao_storage_init();
+       ao_flight_init();
+       ao_log_init();
+       ao_report_init();
+       ao_config_init();
+
+       ao_start_scheduler();
+}
diff --git a/src/easymotor-v3/ao_pins.h b/src/easymotor-v3/ao_pins.h
new file mode 100644 (file)
index 0000000..856c763
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ * Copyright © 2022 Bdale Garbee <bdale@gag.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#ifndef _AO_PINS_H_
+#define _AO_PINS_H_
+
+#define AO_STACK_SIZE           352
+#define SLEEP_HASH_SIZE         3
+#define AO_NUM_TASKS            6
+
+#define HAS_TASK_QUEUE         1
+#define IS_FLASH_LOADER                0
+
+/* Crystal on the board */
+#define AO_LPC_CLKIN    12000000
+
+/* Main clock frequency. 48MHz for USB so we don't use the USB PLL */
+#define AO_LPC_CLKOUT   48000000
+
+/* System clock frequency */
+#define AO_LPC_SYSCLK   24000000
+
+#define HAS_USB                        1
+#define HAS_USB_CONNECT                0
+#define HAS_USB_VBUS           0
+#define HAS_USB_PULLUP         1
+#define AO_USB_PULLUP_PORT      0
+#define AO_USB_PULLUP_PIN       20
+
+#define PACKET_HAS_SLAVE       0
+
+#define HAS_SERIAL             0
+
+#define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX       (1984 * 1024)
+#define AO_CONFIG_MAX_SIZE                     1024
+#define LOG_ERASE_MARK                         0x55
+#define LOG_MAX_ERASE                          128
+#define AO_LOG_FORMAT                          AO_LOG_FORMAT_EASYMOTOR
+
+#define HAS_EEPROM             1
+#define USE_INTERNAL_FLASH     0
+#define USE_EEPROM_CONFIG      0
+#define USE_STORAGE_CONFIG     1
+#define AO_PA11_PA12_RMP       1
+#define HAS_BEEP               1
+#define HAS_BATTERY_REPORT     1
+#define HAS_PAD_REPORT         1
+
+/* Beeper is on pio0_1 ct32b0_mat2 */
+#define AO_LPC_BEEP_PORT       0
+#define AO_LPC_BEEP_PIN                1
+#define AO_LPC_BEEP_TIMER      0
+#define AO_LPC_BEEP_CHANNEL    2
+
+#define HAS_RADIO              0
+#define HAS_TELEMETRY          0
+#define HAS_APRS               0
+#define HAS_COMPANION          0
+
+#define LOW_LEVEL_DEBUG                0
+
+#define HAS_GPS                        0
+#define HAS_FLIGHT             1
+#define HAS_LOG                        1
+
+/*
+ * ADC
+ */
+#define HAS_ADC                        1
+
+#define AO_NUM_ADC             2
+
+#define AO_ADC_0               1
+#define AO_ADC_1               1
+
+#define AO_DATA_RING           32
+
+struct ao_adc {
+       int16_t                 v_batt;
+       int16_t                 motor_pressure;
+};
+
+#define AO_ADC_DUMP(p) \
+       printf("tick: %5lu batt: %5d motor_pressure: %5d\n", \
+              (p)->tick, \
+              (p)->adc.v_batt, \
+              (p)->adc.motor_pressure); 
+
+/*
+ * Voltage divider on ADC battery sampler
+ */
+#define AO_BATTERY_DIV_PLUS     56     /* 5.6k */
+#define AO_BATTERY_DIV_MINUS    100    /* 10k */
+
+/*
+ * Voltage divider on pressure sensor input
+ */
+#define AO_PRESSURE_DIV_PLUS    56      /* 5.6k 0.1% */
+#define AO_PRESSURE_DIV_MINUS   100     /* 10k  0.1% */ 
+
+/*
+ * ADC reference in decivolts
+ */
+#define AO_ADC_REFERENCE_DV    33
+
+/* SPI */
+
+#define HAS_SPI_0              1
+#define SPI_0_MODE             ((0 << LPC_SSP_CR0_CPOL) | (0 << LPC_SSP_CR0_CPHA))
+#define SPI_SCK0_P0_6           1
+#define HAS_SPI_1               1
+#define SPI_SCK1_P1_15          1
+#define SPI_MISO1_P0_22         1
+#define SPI_MOSI1_P0_21         1
+#define SPI_1_MODE             ((1 << LPC_SSP_CR0_CPOL) | (1 << LPC_SSP_CR0_CPHA))
+
+/*
+ * SPI Flash memory
+ */
+
+#define M25_MAX_CHIPS          1
+#define AO_M25_SPI_CS_PORT     0
+#define AO_M25_SPI_CS_MASK     (1 << 3)
+#define AO_M25_SPI_BUS         0
+
+/* ADXL375 */
+
+#define HAS_ADXL375            1
+#define AO_ADXL375_SPI_INDEX   1
+#define AO_ADXL375_CS_PORT     0
+#define AO_ADXL375_CS_PIN      19
+
+#define AO_ADXL375_AXIS                x
+#define AO_ADXL375_ACROSS_AXIS y
+#define AO_ADXL375_THROUGH_AXIS        z
+#define AO_ADXL375_INVERT      0
+#define HAS_IMU                        1
+#define USE_ADXL375_IMU                1
+
+/* Motor pressure */
+#define HAS_MOTOR_PRESSURE     1
+#define ao_data_motor_pressure(packet) ((packet)->adc.motor_pressure)
+
+typedef int16_t        motor_pressure_t;
+
+#endif /* _AO_PINS_H_ */
diff --git a/src/easymotor-v3/flash-loader/Makefile b/src/easymotor-v3/flash-loader/Makefile
new file mode 100644 (file)
index 0000000..8db9825
--- /dev/null
@@ -0,0 +1,8 @@
+#
+# AltOS flash loader build
+#
+#
+
+TOPDIR=../..
+HARDWARE=easymotor-v3
+include $(TOPDIR)/lpc/Makefile-flash.defs
diff --git a/src/easymotor-v3/flash-loader/ao_pins.h b/src/easymotor-v3/flash-loader/ao_pins.h
new file mode 100644 (file)
index 0000000..0837bc1
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright © 2022 Bdale Garbee <bdale@gag.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#ifndef _AO_PINS_H_
+#define _AO_PINS_H_
+
+#include <ao_flash_lpc_pins.h>
+
+#define AO_BOOT_PIN            1
+#define AO_BOOT_APPLICATION_GPIO       0
+#define AO_BOOT_APPLICATION_PIN                2
+#define AO_BOOT_APPLICATION_VALUE      1
+#define AO_BOOT_APPLICATION_MODE       AO_EXTI_MODE_PULL_UP
+
+#define HAS_USB_PULLUP 1
+#define AO_USB_PULLUP_PORT     0
+#define AO_USB_PULLUP_PIN      20
+
+#endif /* _AO_PINS_H_ */
index 84efb11cd0e2e3474723e9bf51ea339f9130a2e1..b5dd7ddf8f1c32f47de032be6d65d8904b43944e 100644 (file)
@@ -477,6 +477,7 @@ ao_config_accel_calibrate_set(void)
                return;
        down = (int16_t) ao_cmd_decimal();
        auto_cal = (up == 0 && ao_cmd_status != ao_cmd_success);
+       ao_cmd_status = ao_cmd_success;
        if (auto_cal) {
                up = ao_config_accel_calibrate_auto("up");
 #if HAS_IMU
index 837fc31eed8ea6a3ecdadf274374e967e2701ce1..1faea957639ce667ad44895b60dd22bf52b893d7 100644 (file)
@@ -59,7 +59,7 @@ extern enum ao_flight_state ao_log_state;
 #define AO_LOG_FORMAT_TELESTATIC       17      /* 32 byte typed telestatic records */
 #define AO_LOG_FORMAT_MICROPEAK2       18      /* 2-byte baro values with header */
 #define AO_LOG_FORMAT_TELEMEGA_4       19      /* 32 byte typed telemega records with 32 bit gyro cal and Bmx160 */
-#define AO_LOG_FORMAT_EASYMOTOR                20      /* ? byte typed easymotor records with pressure sensor and adxl375 */
+#define AO_LOG_FORMAT_EASYMOTOR                20      /* 16 byte typed easymotor records with pressure sensor and adxl375 */
 #define AO_LOG_FORMAT_TELEMEGA_5       21      /* 32 byte typed telemega records with 32 bit gyro cal, mpu6000 and mmc5983 */
 #define AO_LOG_FORMAT_NONE             127     /* No log at all */
 
index d567f9c2a3604c0a3a073432b869bd7204d8f92e..1fd4037f540b8d0d01618b6a22672cd613bb187b 100644 (file)
@@ -636,45 +636,47 @@ ao_telemetry_set_interval(uint16_t interval)
                interval = min_interval[ao_config.radio_rate];
 #endif
        ao_telemetry_interval = interval;
+       if (interval) {
 #if AO_SEND_MEGA
-       if (interval > 1)
-               ao_telemetry_mega_data_max = 1;
-       else
-               ao_telemetry_mega_data_max = 2;
-       if (ao_telemetry_mega_data_max > cur)
-               cur++;
-       ao_telemetry_mega_data_cur = cur;
+               if (interval > 1)
+                       ao_telemetry_mega_data_max = 1;
+               else
+                       ao_telemetry_mega_data_max = 2;
+               if (ao_telemetry_mega_data_max > cur)
+                       cur++;
+               ao_telemetry_mega_data_cur = cur;
 #endif
 #if AO_SEND_METRUM
-       ao_telemetry_metrum_data_max = (int16_t) (AO_SEC_TO_TICKS(1) / interval);
-       if (ao_telemetry_metrum_data_max > cur)
-               cur++;
-       ao_telemetry_metrum_data_cur = cur;
+               ao_telemetry_metrum_data_max = (int16_t) (AO_SEC_TO_TICKS(1) / interval);
+               if (ao_telemetry_metrum_data_max > cur)
+                       cur++;
+               ao_telemetry_metrum_data_cur = cur;
 #endif
 
 #if HAS_COMPANION
-       if (!ao_companion_setup.update_period)
-               ao_companion_setup.update_period = AO_SEC_TO_TICKS(1);
-       ao_telemetry_companion_max = (int16_t) (ao_companion_setup.update_period / interval);
-       if (ao_telemetry_companion_max > cur)
-               cur++;
-       ao_telemetry_companion_cur = cur;
+               if (!ao_companion_setup.update_period)
+                       ao_companion_setup.update_period = AO_SEC_TO_TICKS(1);
+               ao_telemetry_companion_max = (int16_t) (ao_companion_setup.update_period / interval);
+               if (ao_telemetry_companion_max > cur)
+                       cur++;
+               ao_telemetry_companion_cur = cur;
 #endif
 
 #if HAS_GPS
-       ao_telemetry_gps_max = (int16_t) (AO_SEC_TO_TICKS(1) / interval);
-       if (ao_telemetry_gps_max > cur)
-               cur++;
-       ao_telemetry_loc_cur = cur;
-       if (ao_telemetry_gps_max > cur)
-               cur++;
-       ao_telemetry_sat_cur = cur;
-#endif
-
-       ao_telemetry_config_max = (int16_t) (AO_SEC_TO_TICKS(5) / interval);
-       if (ao_telemetry_config_max > cur)
-               cur++;
-       ao_telemetry_config_cur = cur;
+               ao_telemetry_gps_max = (int16_t) (AO_SEC_TO_TICKS(1) / interval);
+               if (ao_telemetry_gps_max > cur)
+                       cur++;
+               ao_telemetry_loc_cur = cur;
+               if (ao_telemetry_gps_max > cur)
+                       cur++;
+               ao_telemetry_sat_cur = cur;
+#endif
+
+               ao_telemetry_config_max = (int16_t) (AO_SEC_TO_TICKS(5) / interval);
+               if (ao_telemetry_config_max > cur)
+                       cur++;
+               ao_telemetry_config_cur = cur;
+       }
 
 #ifndef SIMPLIFY
        ao_telemetry_time = 
index 3965919515eeddc6d4f78a62eecf82bcb4f33cb7..cbe1d8731927b3a8ae258bf9b08b3399131358a5 100644 (file)
@@ -35,7 +35,7 @@ IDPRODUCT=0x000a
 
 CFLAGS = $(PRODUCT_DEF) $(LPC_CFLAGS)
 
-LDFLAGS=-nostartfiles $(CFLAGS) -L$(TOPDIR)/lpc -Taltos-loader.ld
+LDFLAGS=-Wl,--undefined=force_no_isp -nostartfiles $(CFLAGS) -L$(TOPDIR)/lpc -Taltos-loader.ld
 
 PROGNAME=$(HARDWARE)-altos-flash
 PROG=$(PROGNAME)-$(VERSION).elf
index 75b527fb24bf9fc79a3d9addc5f53d179e44ad66..d8bcfb44b3c0db7d408694e1177d286da335a84a 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-__flash = 0x0;
-__flash_size = 4K;
+__flash = 0x300;
+__flash_size = 4K - 0x300;
 __ram = 0x10000000;
 __ram_size = 4k;
 __stack_size = 128;
 
 INCLUDE registers.ld
-INCLUDE picolibc.ld
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright © 2019 Keith Packard
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials provided
+ *    with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+ENTRY(_start)
+
+/*
+ * These values should be provided by the application. We'll include
+ * some phony values here to make things link for testing
+ */
+
+MEMORY
+{
+       low (rxai!w)   : ORIGIN = 0x0, LENGTH = 0x2fc
+       no_isp (rxai!w): ORIGIN = 0x2fc, LENGTH = 4
+       flash (rxai!w) : ORIGIN = DEFINED(__flash) ? __flash : 0x10000000, LENGTH = DEFINED(__flash_size) ? __flash_size : 0x10000
+       ram (wxa!ri)   : ORIGIN = DEFINED(__ram  ) ? __ram   : 0x20000000, LENGTH = DEFINED(__ram_size  ) ? __ram_size   : 0x08000
+}
+
+PHDRS
+{
+       text PT_LOAD;
+       ram PT_LOAD;
+       ram_init PT_LOAD;
+       tls PT_TLS;
+}
+
+SECTIONS
+{
+       PROVIDE(__stack = ORIGIN(ram) + LENGTH(ram));
+
+       .init : {
+               KEEP (*(.text.init.enter))
+               KEEP (*(.data.init.enter))
+               KEEP (*(SORT_BY_NAME(.init) SORT_BY_NAME(.init.*)))
+       } >low AT>low :text
+
+       .text.low : {
+               ao_boot_chain.o(.text .text.*)
+               ao_boot_pin.o(.text .text.*)
+               ao_flash_loader_lpc.o(.text .text.*)
+               ao_notask.o(*.text .text.*)
+               ao_product.o(.rodata .rodata.*)
+       } >low AT>low :text
+
+       .no_isp : {
+               *(.no_isp)
+       } > no_isp AT>no_isp :text
+
+       .text : {
+
+                /* code */
+               *(.text.unlikely .text.unlikely.*)
+               *(.text.startup .text.startup.*)
+               *(.text .text.*)
+               *(.gnu.linkonce.t.*)
+               KEEP (*(.fini .fini.*))
+               __text_end = .;
+
+               PROVIDE (__etext = __text_end);
+               PROVIDE (_etext = __text_end);
+               PROVIDE (etext = __text_end);
+
+                /* read-only data */
+               *(.rdata)
+               *(.rodata .rodata.*)
+               *(.gnu.linkonce.r.*)
+
+               *(.srodata.cst16)
+               *(.srodata.cst8)
+               *(.srodata.cst4)
+               *(.srodata.cst2)
+               *(.srodata .srodata.*)
+               *(.data.rel.ro .data.rel.ro.*)
+               *(.got .got.*)
+
+                /* Need to pre-align so that the symbols come after padding */
+               . = ALIGN(8);
+
+                /* lists of constructors and destructors */
+               PROVIDE_HIDDEN ( __preinit_array_start = . );
+               KEEP (*(.preinit_array))
+               PROVIDE_HIDDEN ( __preinit_array_end = . );
+
+               PROVIDE_HIDDEN ( __init_array_start = . );
+               KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
+               KEEP (*(.init_array .ctors))
+               PROVIDE_HIDDEN ( __init_array_end = . );
+
+               PROVIDE_HIDDEN ( __fini_array_start = . );
+               KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
+               KEEP (*(.fini_array .dtors))
+               PROVIDE_HIDDEN ( __fini_array_end = . );
+       } >flash AT>flash :text
+
+        /* additional sections when compiling with C++ exception support */
+       /*
+        .except_ordered : {
+               *(.gcc_except_table *.gcc_except_table.*)
+               KEEP (*(.eh_frame .eh_frame.*))
+               *(.ARM.extab* .gnu.linkonce.armextab.*)
+       } >flash AT>flash :text
+
+       .except_unordered : {
+                . = ALIGN(8);
+
+               PROVIDE(__exidx_start = .);
+               *(.ARM.exidx*)
+               PROVIDE(__exidx_end = .);
+        } >flash AT>flash :text
+       */
+
+       /*
+        * Data values which are preserved across reset
+        */
+       .preserve (NOLOAD) : {
+               PROVIDE(__preserve_start__ = .);
+               KEEP(*(SORT_BY_NAME(.preserve.*)))
+               KEEP(*(.preserve))
+               PROVIDE(__preserve_end__ = .);
+       } >ram AT>ram :ram
+
+       .data : ALIGN_WITH_INPUT {
+               *(.data .data.*)
+               *(.gnu.linkonce.d.*)
+
+                /* Need to pre-align so that the symbols come after padding */
+               . = ALIGN(8);
+
+               PROVIDE( __global_pointer$ = . + 0x800 );
+               *(.sdata .sdata.* .sdata2.*)
+               *(.gnu.linkonce.s.*)
+       } >ram AT>flash :ram_init
+       PROVIDE(__data_start = ADDR(.data));
+       PROVIDE(__data_source = LOADADDR(.data));
+
+       /* Thread local initialized data. This gets
+        * space allocated as it is expected to be placed
+        * in ram to be used as a template for TLS data blocks
+        * allocated at runtime. We're slightly abusing that
+        * by placing the data in flash where it will be copied
+        * into the allocate ram addresses by the existing
+        * data initialization code in crt0
+        */
+       .tdata : ALIGN_WITH_INPUT {
+               *(.tdata .tdata.* .gnu.linkonce.td.*)
+               PROVIDE(__data_end = .);
+               PROVIDE(__tdata_end = .);
+       } >ram AT>flash :tls :ram_init
+       PROVIDE( __tls_base = ADDR(.tdata));
+       PROVIDE( __tdata_start = ADDR(.tdata));
+       PROVIDE( __tdata_source = LOADADDR(.tdata) );
+       PROVIDE( __tdata_source_end = LOADADDR(.tdata) + SIZEOF(.tdata) );
+       PROVIDE( __tdata_size = SIZEOF(.tdata) );
+
+       PROVIDE( __edata = __data_end );
+       PROVIDE( _edata = __data_end );
+       PROVIDE( edata = __data_end );
+       PROVIDE( __data_size = __data_end - __data_start );
+
+       .tbss (NOLOAD) : {
+               *(.tbss .tbss.* .gnu.linkonce.tb.*)
+               *(.tcommon)
+               PROVIDE( __tls_end = . );
+               PROVIDE( __tbss_end = . );
+       } >ram AT>ram :tls :ram
+       PROVIDE( __bss_start = ADDR(.tbss));
+       PROVIDE( __tbss_start = ADDR(.tbss));
+       PROVIDE( __tbss_size = SIZEOF(.tbss) );
+       PROVIDE( __tls_size = __tls_end - __tls_base );
+
+       /*
+        * The linker special cases .tbss segments which are
+        * identified as segments which are not loaded and are
+        * thread_local.
+        *
+        * For these segments, the linker does not advance 'dot'
+        * across them.  We actually need memory allocated for tbss,
+        * so we create a special segment here just to make room
+        */
+       .tbss_space (NOLOAD) : {
+               . = . + SIZEOF(.tbss);
+       } >ram AT>ram :ram
+
+       .bss (NOLOAD) : {
+               *(.sbss*)
+               *(.gnu.linkonce.sb.*)
+               *(.bss .bss.*)
+               *(.gnu.linkonce.b.*)
+               *(COMMON)
+
+                /* Align the heap */
+               . = ALIGN(8);
+               __bss_end = .;
+       } >ram AT>ram :ram
+       PROVIDE( __end = __bss_end );
+       PROVIDE( _end = __bss_end );
+       PROVIDE( end = __bss_end );
+       PROVIDE( __bss_size = __bss_end - __bss_start );
+
+       /* Make the rest of memory available for heap storage */
+       PROVIDE (__heap_start = __end);
+       PROVIDE (__heap_end = __stack - (DEFINED(__stack_size) ? __stack_size : 0x800));
+       PROVIDE (__heap_size = __heap_end - __heap_start);
+
+       /* Define a stack region to make sure it fits in memory */
+       .stack (NOLOAD) : {
+               . += (DEFINED(__stack_size) ? __stack_size : 0x800);
+       } >ram :ram
+
+       /* Throw away C++ exception handling information */
+
+       
+
+       /DISCARD/ : {
+               *(.note .note.*)
+               *(.eh_frame .eh_frame.*)
+               *(.ARM.extab* .gnu.linkonce.armextab.*)
+               *(.ARM.exidx*)
+       }
+
+       
+}
index 8cbd3ed2f8fadb407dd909471ee3ecbf8976716d..32e108cd8a974a730f0c8a3c102abafe1b872b91 100644 (file)
@@ -81,7 +81,7 @@ ao_beep(uint8_t beep)
 }
 
 void
-ao_beep_for(uint8_t beep, AO_TICK_TYPE ticks) 
+ao_beep_for(uint8_t beep, AO_TICK_TYPE ticks)
 {
        ao_beep(beep);
        ao_delay(ticks);
index bc2848c3bffa364ba6298d3a32c9439a817dc57c..25413abb04964676c1367d968118bd7d200a6a18 100644 (file)
@@ -162,6 +162,12 @@ const void *const __interrupt_vector[0x30] = {
 __attribute__ ((section(".init.0")))
 const void *const __interrupt_pad[0x10];
 
+#if IS_FLASH_LOADER
+/* Flash loader needs a magic value at 0x2fc to be 0x4E69 7370 */
+__attribute__ ((section(".no_isp")))
+const uint32_t force_no_isp = 0x4E697370;
+#endif
+
 void main(void) __attribute__((__noreturn__));
 
 void *__interrupt_ram[sizeof(__interrupt_vector)/sizeof(__interrupt_vector[0])] __attribute((section(".preserve.1")));
index ec48e95c386eeec40a1f90b936606aa22193fede..010feb63ec3ebc5e2c4c74b165e20dc38a83ad50 100644 (file)
@@ -90,7 +90,7 @@ ao_spi_put(uint8_t id)
 }
 
 static void
-ao_spi_channel_init(uint8_t id)
+ao_spi_channel_init(uint8_t id, uint8_t mode)
 {
        struct lpc_ssp  *lpc_ssp = ao_lpc_ssp[id];
        uint8_t d;
@@ -102,8 +102,7 @@ ao_spi_channel_init(uint8_t id)
 
        lpc_ssp->cr0 = ((LPC_SSP_CR0_DSS_8 << LPC_SSP_CR0_DSS) |
                        (LPC_SSP_CR0_FRF_SPI << LPC_SSP_CR0_FRF) |
-                       (0 << LPC_SSP_CR0_CPOL) |
-                       (0 << LPC_SSP_CR0_CPHA) |
+                       mode |
                        (0 << LPC_SSP_CR0_SCR));
 
        /* Enable the device */
@@ -121,6 +120,9 @@ void
 ao_spi_init(void)
 {
 #if HAS_SPI_0
+#ifndef SPI_0_MODE
+#define SPI_0_MODE     0
+#endif
        /* Configure pins */
 #if SPI_SCK0_P0_6
        lpc_ioconf.pio0_6 = ao_lpc_alternate(LPC_IOCONF_FUNC_PIO0_6_SCK0);
@@ -149,10 +151,13 @@ ao_spi_init(void)
        /* Reset the device */
        lpc_scb.presetctrl &= ~(1UL << LPC_SCB_PRESETCTRL_SSP0_RST_N);
        lpc_scb.presetctrl |= (1 << LPC_SCB_PRESETCTRL_SSP0_RST_N);
-       ao_spi_channel_init(0);
+       ao_spi_channel_init(0, SPI_0_MODE);
 #endif
 
 #if HAS_SPI_1
+#ifndef SPI_1_MODE
+#define SPI_1_MODE     0
+#endif
 
 #if SPI_SCK1_P1_15
        lpc_ioconf.pio1_15 = ao_lpc_alternate(LPC_IOCONF_FUNC_PIO1_15_SCK1);
@@ -199,6 +204,6 @@ ao_spi_init(void)
        /* Reset the device */
        lpc_scb.presetctrl &= ~(1UL << LPC_SCB_PRESETCTRL_SSP1_RST_N);
        lpc_scb.presetctrl |= (1 << LPC_SCB_PRESETCTRL_SSP1_RST_N);
-       ao_spi_channel_init(1);
+       ao_spi_channel_init(1, SPI_1_MODE);
 #endif /* HAS_SPI_1 */
 }
index fbf529c941d494d6ed4499ac896b75cebecf7148..be0dc021d7a7cf6e12629349b8398d0543161ef4 100644 (file)
@@ -110,13 +110,13 @@ extern struct lpc_ioconf lpc_ioconf;
 /* PIO0_1 */
 #define  LPC_IOCONF_FUNC_PIO0_1                0
 #define  LPC_IOCONF_FUNC_CLKOUT                1
-#define  LPC_IOCONF_FUNC_CT32B0_MAT2   2
+#define  LPC_IOCONF_FUNC_PIO0_1_CT32B0_MAT2    2
 #define  LPC_IOCONF_FUNC_USB_FTOGGLE   3
 
 /* PIO0_2 */
 #define  LPC_IOCONF_FUNC_PIO0_2                0
 #define  LPC_IOCONF_FUNC_SSEL0         1
-#define  LPC_IOCONF_FUNC_CT16B0_CAP0   2
+#define  LPC_IOCONF_FUNC_PIO0_2_CT16B0_CAP0    2
 
 /* PIO0_3 */
 #define  LPC_IOCONF_FUNC_PIO0_3                0
@@ -142,36 +142,36 @@ extern struct lpc_ioconf lpc_ioconf;
 /* PIO0_8 */
 #define  LPC_IOCONF_FUNC_PIO0_8                0
 #define  LPC_IOCONF_FUNC_MISO0         1
-#define  LPC_IOCONF_FUNC_CT16B0_MAT0   2
+#define  LPC_IOCONF_FUNC_PIO0_8_CT16B0_MAT0    2
 
 /* PIO0_9 */
 #define  LPC_IOCONF_FUNC_PIO0_9                0
 #define  LPC_IOCONF_FUNC_MOSI0         1
-#define  LPC_IOCONF_FUNC_CT16B0_MAT1   2
+#define  LPC_IOCONF_FUNC_PIO0_9_CT16B0_MAT1    2
 
 /* PIO0_10 */
 #define  LPC_IOCONF_FUNC_SWCLK         0
 #define  LPC_IOCONF_FUNC_PIO0_10       1
 #define  LPC_IOCONF_FUNC_PIO0_10_SCK0  2
-#define  LPC_IOCONF_FUNC_CT16B0_MAT2   3
+#define  LPC_IOCONF_FUNC_PIO0_10_CT16B0_MAT2   3
 
 /* PIO0_11 */
 #define  LPC_IOCONF_FUNC_TDI           0
 #define  LPC_IOCONF_FUNC_PIO0_11       1
 #define  LPC_IOCONF_FUNC_AD0           2
-#define  LPC_IOCONF_FUNC_CT32B0_MAT3   3
+#define  LPC_IOCONF_FUNC_PIO0_11_CT32B0_MAT3   3
 
 /* PIO0_12 */
 #define  LPC_IOCONF_FUNC_TMS           0
 #define  LPC_IOCONF_FUNC_PIO0_12       1
 #define  LPC_IOCONF_FUNC_AD1           2
-#define  LPC_IOCONF_FUNC_CT32B1_CAP0   3
+#define  LPC_IOCONF_FUNC_PIO0_12_CT32B1_CAP0   3
 
 /* PIO0_13 */
 #define  LPC_IOCONF_FUNC_TD0           0
 #define  LPC_IOCONF_FUNC_PIO0_13       1
 #define  LPC_IOCONF_FUNC_AD2           2
-#define  LPC_IOCONF_FUNC_CT32B1_MAT0   3
+#define  LPC_IOCONF_FUNC_PIO0_13_CT32B1_MAT0   3
 
 /* PIO0_14 */
 #define  LPC_IOCONF_FUNC_TRST          0
@@ -183,12 +183,12 @@ extern struct lpc_ioconf lpc_ioconf;
 #define  LPC_IOCONF_FUNC_SWDIO         0
 #define  LPC_IOCONF_FUNC_PIO0_15       1
 #define  LPC_IOCONF_FUNC_AD4           2
-#define  LPC_IOCONF_FUNC_CT32B1_MAT2   3
+#define  LPC_IOCONF_FUNC_PIO0_15_CT32B1_MAT2   3
 
 /* PIO0_16 */
 #define  LPC_IOCONF_FUNC_PIO0_16       0
 #define  LPC_IOCONF_FUNC_AD5           1
-#define  LPC_IOCONF_FUNC_CT32B1_MAT3   2
+#define  LPC_IOCONF_FUNC_PIO0_16_CT32B1_MAT3   2
 
 /* PIO0_17 */
 #define  LPC_IOCONF_FUNC_PIO0_17       0
@@ -208,17 +208,17 @@ extern struct lpc_ioconf lpc_ioconf;
 
 /* PIO0_20 */
 #define  LPC_IOCONF_FUNC_PIO0_20       0
-#define  LPC_IOCONF_FUNC_CT16B1_CAP0   1
+#define  LPC_IOCONF_FUNC_PIO0_20_CT16B1_CAP0   1
 
 /* PIO0_21 */
 #define  LPC_IOCONF_FUNC_PIO0_21       0
-#define  LPC_IOCONF_FUNC_CT16B1_MAT0   1
+#define  LPC_IOCONF_FUNC_PIO0_21_CT16B1_MAT0   1
 #define  LPC_IOCONF_FUNC_PIO0_21_MOSI1 2
 
 /* PIO0_22 */
 #define  LPC_IOCONF_FUNC_PIO0_22       0
 #define  LPC_IOCONF_FUNC_AD6           1
-#define  LPC_IOCONF_FUNC_CT16B1_MAT1   2
+#define  LPC_IOCONF_FUNC_PIO0_22_CT16B1_MAT1   2
 #define  LPC_IOCONF_FUNC_PIO0_22_MISO1 3
 
 /* PIO0_23 */
@@ -227,11 +227,11 @@ extern struct lpc_ioconf lpc_ioconf;
 
 /* PIO1_0 */
 #define  LPC_IOCONF_FUNC_PIO1_0                0
-#define  LPC_IOCONF_FUNC_CT32B1_MAT1   1
+#define  LPC_IOCONF_FUNC_PIO1_0_CT32B1_MAT1    1
 
 /* PIO1_1 */
 #define  LPC_IOCONF_FUNC_PIO1_1                0
-#define  LPC_IOCONF_FUNC_CT32B1_MAT1   1
+#define  LPC_IOCONF_FUNC_PIO1_1_CT32B1_MAT1    1
 
 /* PIO1_2 */
 #define  LPC_IOCONF_FUNC_PIO1_2                0
@@ -247,7 +247,7 @@ extern struct lpc_ioconf lpc_ioconf;
 
 /* PIO1_5 */
 #define  LPC_IOCONF_FUNC_PIO1_5                0
-#define  LPC_IOCONF_FUNC_CT32B1_CAP1   1
+#define  LPC_IOCONF_FUNC_PIO1_5_CT32B1_CAP1    1
 
 /* PIO1_6 */
 #define  LPC_IOCONF_FUNC_PIO1_6                0
@@ -273,13 +273,13 @@ extern struct lpc_ioconf lpc_ioconf;
 /* PIO1_13 */
 #define  LPC_IOCONF_FUNC_PIO1_13       0
 #define  LPC_IOCONF_FUNC_DTR           1
-#define  LPC_IOCONF_FUNC_CT16B0_MAT0   2
+#define  LPC_IOCONF_FUNC_PIO1_13_CT16B0_MAT0   2
 #define  LPC_IOCONF_FUNC_PIO1_13_TXD           3
 
 /* PIO1_14 */
 #define  LPC_IOCONF_FUNC_PIO1_14       0
 #define  LPC_IOCONF_FUNC_DSR           1
-#define  LPC_IOCONF_FUNC_CT16B0_MAT1   2
+#define  LPC_IOCONF_FUNC_PIO1_14_CT16B0_MAT1   2
 #define  LPC_IOCONF_FUNC_PIO1_13_RXD           3
 
 /* PIO1_15 */
@@ -291,16 +291,16 @@ extern struct lpc_ioconf lpc_ioconf;
 /* PIO1_16 */
 #define  LPC_IOCONF_FUNC_PIO1_16       0
 #define  LPC_IOCONF_FUNC_RI            1
-#define  LPC_IOCONF_FUNC_CT16B0_CAP0   2
+#define  LPC_IOCONF_FUNC_PIO1_16_CT16B0_CAP0   2
 
 /* PIO1_17 */
 #define  LPC_IOCONF_FUNC_PIO1_17       0
-#define  LPC_IOCONF_FUNC_CT16B0_CAP1   1
+#define  LPC_IOCONF_FUNC_PIO1_17_CT16B0_CAP1   1
 #define  LPC_IOCONF_FUNC_PIO1_17_RXD           2
 
 /* PIO1_18 */
 #define  LPC_IOCONF_FUNC_PIO1_18       0
-#define  LPC_IOCONF_FUNC_CT16B1_CAP1   1
+#define  LPC_IOCONF_FUNC_PIO1_18_CT16B1_CAP1   1
 #define  LPC_IOCONF_FUNC_PIO1_18_TXD           2
 
 /* PIO1_19 */
index 7ab0749cfa01162f0389f01c7f82bab851eb0e9e..9388f3ba0b84f8752d44331543d89a32144e1862 100644 (file)
@@ -1,3 +1,5 @@
+# location of code signing key, et al
 JAVAROOT=classes
 AM_JAVACFLAGS=$(JAVAC_VERSION_FLAGS) -encoding UTF-8 -Xlint:deprecation -Xlint:unchecked
 
@@ -337,6 +339,11 @@ $(MACOSX_DIST): $(MACOSX_FILES) $(MACOSX_EXTRA) Makefile
 $(WINDOWS_DIST): $(WINDOWS_FILES) telegps-windows.nsi
        -rm -f $@
        makensis -Otelegps-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" telegps-windows.nsi || (cat telegps-windows.log && exit 1)
+       if [ "$(HAVE_WINDOWS_KEY)" = "yes" ]; then \
+       jsign --keystore "$(WINDOWSKEYFILE)" --alias 1 \
+               --storetype PKCS12 --storepass `cat "$(WINDOWSKEYPASSFILE)"` \
+               --tsaurl http://ts.ssl.com --tsmode RFC3161 $@ ; \
+       fi
 
 Manifest.txt: Makefile
        echo 'Main-Class: org.altusmetrum.telegps.TeleGPS' > $@