From 5240c06a757dbe9548a7394611b2a121dccf13e2 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 28 Mar 2023 13:32:48 -0700 Subject: [PATCH] altos/lpcxpresso: Update for 11u24 board This updates the lpcxpresso demo to support the 11u24 board with serial connected like telegps v3.0 on p1_13/p1_14 Signed-off-by: Keith Packard --- src/lpcxpresso/Makefile | 8 ++---- src/lpcxpresso/ao_demo.c | 39 ++++++++++++++++----------- src/lpcxpresso/ao_pins.h | 13 +++++---- src/lpcxpresso/flash-loader/Makefile | 8 ++++++ src/lpcxpresso/flash-loader/ao_pins.h | 35 ++++++++++++++++++++++++ 5 files changed, 76 insertions(+), 27 deletions(-) create mode 100644 src/lpcxpresso/flash-loader/Makefile create mode 100644 src/lpcxpresso/flash-loader/ao_pins.h diff --git a/src/lpcxpresso/Makefile b/src/lpcxpresso/Makefile index 2eef24ba..1c7684f4 100644 --- a/src/lpcxpresso/Makefile +++ b/src/lpcxpresso/Makefile @@ -18,6 +18,7 @@ INC = \ # ALTOS_SRC = \ ao_interrupt.c \ + ao_boot_chain.c \ ao_romconfig.c \ ao_product.c \ ao_panic.c \ @@ -42,13 +43,8 @@ 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) > $@ + $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS) -Wl,-Map=$(PROGNAME)-$(VERSION).map $(OBJ): $(INC) diff --git a/src/lpcxpresso/ao_demo.c b/src/lpcxpresso/ao_demo.c index 568ebd18..cd0f6566 100644 --- a/src/lpcxpresso/ao_demo.c +++ b/src/lpcxpresso/ao_demo.c @@ -19,30 +19,37 @@ #include #include +#if 0 +static void +hello(void) +{ + for (;;) { + const char *s = "hello, world\r\n"; + char c; + while ((c = *s++)) + ao_serial0_putchar(c); + } +} + +struct ao_task hello_task; +#endif + int main(void) { - int i; - ao_led_init(LEDS_AVAILABLE); - ao_led_on(AO_LED_RED); ao_clock_init(); ao_timer_init(); - + + ao_led_init(); + ao_led_on(AO_LED_RED); + + ao_task_init(); + +// ao_add_task(&hello_task, hello, "hello"); + ao_serial_init(); ao_usb_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; - } } diff --git a/src/lpcxpresso/ao_pins.h b/src/lpcxpresso/ao_pins.h index 1bfc83bf..2f4a723b 100644 --- a/src/lpcxpresso/ao_pins.h +++ b/src/lpcxpresso/ao_pins.h @@ -18,6 +18,8 @@ #define HAS_BEEP 0 +#define IS_FLASH_LOADER 0 + /* Crystal on the board */ #define AO_LPC_CLKIN 12000000 @@ -35,17 +37,18 @@ #define LEDS_AVAILABLE AO_LED_RED #define HAS_USB 1 - -#define HAS_USB_CONNECT 1 -#define HAS_USB_VBUS 1 +#define HAS_USB_PULLUP 1 +#define AO_USB_PULLUP_PORT 1 +#define AO_USB_PULLUP_PIN 23 #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_18_19 0 +#define SERIAL_1_13_14 1 #define SERIAL_0_14_15 0 #define SERIAL_0_17_18 0 #define SERIAL_0_26_27 0 diff --git a/src/lpcxpresso/flash-loader/Makefile b/src/lpcxpresso/flash-loader/Makefile new file mode 100644 index 00000000..c8708045 --- /dev/null +++ b/src/lpcxpresso/flash-loader/Makefile @@ -0,0 +1,8 @@ +# +# AltOS flash loader build +# +# + +TOPDIR=../.. +HARDWARE=lpcxpresso +include $(TOPDIR)/lpc/Makefile-flash.defs diff --git a/src/lpcxpresso/flash-loader/ao_pins.h b/src/lpcxpresso/flash-loader/ao_pins.h new file mode 100644 index 00000000..9b7ebf20 --- /dev/null +++ b/src/lpcxpresso/flash-loader/ao_pins.h @@ -0,0 +1,35 @@ +/* + * Copyright © 2023 Keith Packard + * + * 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 + +/* pin next to lower right corner GND pin */ +#define AO_BOOT_PIN 1 +#define AO_BOOT_APPLICATION_GPIO 1 +#define AO_BOOT_APPLICATION_PIN 16 +#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 1 +#define AO_USB_PULLUP_PIN 23 + +#endif /* _AO_PINS_H_ */ -- 2.30.2