This saves enough memory to fit in under 4kB
Signed-off-by: Keith Packard <keithp@keithp.com>
ao_notask.c \
ao_timer.c \
ao_usb_stm.c \
ao_notask.c \
ao_timer.c \
ao_usb_stm.c \
-PRODUCT=StmFlash-v0.0
-PRODUCT_DEF=-DSTM_FLASH
+PRODUCT=AltosFlash-$(VERSION)
+PRODUCT_DEF=-DALTOS_FLASH
IDPRODUCT=0x000a
CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) -g -Os
IDPRODUCT=0x000a
CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) -g -Os
-PROG=stm-flash-$(VERSION).elf
+PROG=altos-flash-$(VERSION).elf
SRC=$(ALTOS_SRC) ao_stm_flash.c
OBJ=$(SRC:.c=.o)
SRC=$(ALTOS_SRC) ao_stm_flash.c
OBJ=$(SRC:.c=.o)
#define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_1
#define HAS_USB 1
#define AO_RCC_CFGR_PPRE2_DIV STM_RCC_CFGR_PPRE2_DIV_1
#define HAS_USB 1
#define HAS_BEEP 0
#define HAS_TASK 0
#define HAS_ECHO 0
#define HAS_BEEP 0
#define HAS_TASK 0
#define HAS_ECHO 0
#define AO_BOOT_CHAIN 1
#define AO_BOOT_PIN 1
#define AO_BOOT_CHAIN 1
#define AO_BOOT_PIN 1
-#define AO_BOOT_APPLICATION_GPIO stm_gpioa
-#define AO_BOOT_APPLICATION_PIN 0
+#define AO_BOOT_APPLICATION_GPIO stm_gpiod
+#define AO_BOOT_APPLICATION_PIN 2
#define AO_BOOT_APPLICATION_VALUE 1
#define AO_BOOT_APPLICATION_VALUE 1
-#define AO_BOOT_APPLICATION_MODE 0
+#define AO_BOOT_APPLICATION_MODE AO_EXTI_MODE_PULL_UP
ao_put_string(__code char *s)
{
char c;
ao_put_string(__code char *s)
{
char c;
- while ((c = *s++))
- putchar(c);
+ while ((c = *s++)) {
+ if (c == '\n')
+ ao_usb_putchar('\r');
+ ao_usb_putchar(c);
+ }
uint32_t v = 0;
for (;;) {
uint32_t v = 0;
for (;;) {
else
break;
v = (v << 4) | n;
else
break;
v = (v << 4) | n;
return;
}
for (i = 0; i < 256; i++)
return;
}
for (i = 0; i < 256; i++)
- u.data8[i] = getchar();
+ u.data8[i] = ao_usb_getchar();
ao_flash_page(p, u.data32);
}
ao_flash_page(p, u.data32);
}
for (i = 0; i < 256; i++) {
c = *p++;
for (i = 0; i < 256; i++) {
c = *p++;
}
}
static void
ao_show_version(void)
{
}
}
static void
ao_show_version(void)
{
- puts("altos-loader");
- ao_put_string("manufacturer "); puts(ao_manufacturer);
- ao_put_string("product "); puts(ao_product);
- ao_put_string("software-version "); puts(ao_version);
+ ao_put_string("altos-loader");
+ ao_put_string("\nmanufacturer "); ao_put_string(ao_manufacturer);
+ ao_put_string("\nproduct "); ao_put_string(ao_product);
+ ao_put_string("\nsoftware-version "); ao_put_string(ao_version);
+ ao_put_string("\n");
}
static void
ao_flash_task(void) {
for (;;) {
}
static void
ao_flash_task(void) {
for (;;) {
+ ao_usb_flush();
+ switch (ao_usb_getchar()) {
case 'v': ao_show_version(); break;
case 'a': ao_application(); break;
case 'X': ao_block_erase(); break;
case 'v': ao_show_version(); break;
case 'a': ao_application(); break;
case 'X': ao_block_erase(); break;