altos/lpcxpresso: Fix up lpcxpressor demo
authorKeith Packard <keithp@keithp.com>
Mon, 19 Dec 2022 20:42:35 +0000 (12:42 -0800)
committerKeith Packard <keithp@keithp.com>
Mon, 19 Dec 2022 20:42:35 +0000 (12:42 -0800)
Make this work again.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/lpcxpresso/Makefile
src/lpcxpresso/ao_demo.c
src/lpcxpresso/ao_pins.h
src/lpcxpresso/flash-loader/ao_pins.h [new file with mode: 0644]

index 2eef24baee017cfb95779e3a01c39167232c0450..d11d420592dcb2f82515d21f70a71264fddaad10 100644 (file)
@@ -18,6 +18,7 @@ INC = \
 #
 ALTOS_SRC = \
        ao_interrupt.c \
+       ao_boot_chain.c \
        ao_romconfig.c \
        ao_product.c \
        ao_panic.c \
@@ -27,6 +28,7 @@ ALTOS_SRC = \
        ao_timer_lpc.c \
        ao_serial_lpc.c \
        ao_usb_lpc.c \
+       ao_exti_lpc.c \
        ao_stdio.c
 
 PRODUCT=LpcDemo-v0.0
@@ -35,20 +37,19 @@ IDPRODUCT=0x000a
 
 CFLAGS = $(PRODUCT_DEF) $(LPC_CFLAGS)
 
-PROG=lpc-demo.elf
+PROGNAME=lpcxpresso
+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_demo.c
 OBJ=$(SRC:.c=.o)
 
 all: $(PROG)
 
-LDFLAGS=-L../lpc -Wl,-Taltos.ld
-
-$(PROG): Makefile $(OBJ)
-       $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS)
-
-ao_product.h: ao-make-product.5c ../Version
-       $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
+$(PROG): Makefile $(OBJ) altos.ld
+       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)
 
 $(OBJ): $(INC)
 
@@ -58,7 +59,7 @@ load: $(PROG)
 distclean:     clean
 
 clean:
-       rm -f *.o $(PROG)
+       rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx $(PROGNAME)-*.map
        rm -f ao_product.h
 
 install:
index 568ebd1823fa38e259b5186eb4c6c5da72a20d00..a6b2242ba7620eb8e609baaf5b999f8d34f36077 100644 (file)
  */
 
 #include <ao.h>
-#include <ao_usb.h>
+#include <ao_exti.h>
+#include <ao_i2c.h>
 
 int
 main(void)
 {
-       int     i;
-       ao_led_init(LEDS_AVAILABLE);
+       ao_led_init();
        ao_led_on(AO_LED_RED);
+
        ao_clock_init();
+       ao_task_init();
        ao_timer_init();
-       
-       ao_serial_init();
+       ao_exti_init();
+
        ao_usb_init();
+       ao_serial_init();
+       ao_i2c_init();
        ao_cmd_init();
-       ao_task_init();
 
        ao_start_scheduler();
-
-       for (;;) {
-               ao_led_off(AO_LED_RED);
-               for (;;)
-                       if (ao_tick_count & 1)
-                               break;
-               ao_led_on(AO_LED_RED);
-               for (;;)
-                       if (!(ao_tick_count & 1))
-                               break;
-       }
 }
index 1bfc83bf062c2b696f0eeaa3e035b15d7eb24c7c..2658d8f9e0487a65cd0b6249849faabd93bc9c4b 100644 (file)
@@ -18,6 +18,8 @@
 
 #define HAS_BEEP       0
 
+#define IS_FLASH_LOADER        0
+
 /* Crystal on the board */
 #define AO_LPC_CLKIN   12000000
 
 
 #define HAS_USB                1
 
-#define HAS_USB_CONNECT        1
-#define HAS_USB_VBUS   1
+//#define HAS_USB_CONNECT      1
+//#define HAS_USB_VBUS 1
+
+#define HAS_USB_PULLUP         1
+#define HAS_USB_PULLUP_INVERT  1
+#define AO_USB_PULLUP_PORT     0
+#define AO_USB_PULLUP_PIN      6
+
 
 #define PACKET_HAS_SLAVE       0
 
 /* USART */
 
 #define HAS_SERIAL             1
+#define HAS_SERIAL_0           1
 #define USE_SERIAL_0_STDIN     1
 #define SERIAL_0_18_19         1
 #define SERIAL_0_14_15         0
diff --git a/src/lpcxpresso/flash-loader/ao_pins.h b/src/lpcxpresso/flash-loader/ao_pins.h
new file mode 100644 (file)
index 0000000..d8c671a
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright © 2013 Keith Packard <keithp@keithp.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       1
+#define AO_BOOT_APPLICATION_PIN                20
+#define AO_BOOT_APPLICATION_VALUE      1
+#define AO_BOOT_APPLICATION_MODE       AO_EXTI_MODE_PULL_UP
+
+#define HAS_USB_PULLUP         1
+#define HAS_USB_PULLUP_INVERT  1
+#define AO_USB_PULLUP_PORT     0
+#define AO_USB_PULLUP_PIN      6
+
+//#define HAS_USB_CONNECT              1
+//#define HAS_USB_VBUS         1
+
+#endif /* _AO_PINS_H_ */