altos: Clean up AO_ROMCONFIG bits
authorKeith Packard <keithp@keithp.com>
Wed, 12 Sep 2018 01:53:15 +0000 (18:53 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 3 Oct 2018 21:51:57 +0000 (14:51 -0700)
Remove address parameter (doesn't work with gcc), create shared
ao_romconfig in kernel.

Signed-off-by: Keith Packard <keithp@keithp.com>
12 files changed:
src/attiny/ao_arch.h
src/avr/ao_romconfig.c [deleted file]
src/kernel/ao.h
src/kernel/ao_product.c
src/kernel/ao_romconfig.c [new file with mode: 0644]
src/lpc/ao_arch.h
src/lpc/ao_romconfig.c [deleted file]
src/stm/ao_arch.h
src/stm/ao_romconfig.c [deleted file]
src/stm32f4/ao_arch.h
src/stmf0/ao_arch.h
src/stmf0/ao_romconfig.c [deleted file]

index a9c450fcce036dac59975bc3edd03d63d3ca6103..dfd41afe2ec90dba9d5decdc51f7f340101fc714 100644 (file)
@@ -49,6 +49,8 @@
 
 #define ao_arch_interrupt(n)   /* nothing */
 
+#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const
+
 #undef putchar
 #undef getchar
 #define putchar(c)     ao_putchar(c)
diff --git a/src/avr/ao_romconfig.c b/src/avr/ao_romconfig.c
deleted file mode 100644 (file)
index 4acfc1c..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright © 2011 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.
- */
-
-#include "ao.h"
-
-AO_ROMCONFIG_SYMBOL (0) uint16_t ao_serial_number = 0;
index 1b269d73e09b8871d9e5834e3c18327351511d3c..9baae8b437d310b071618b57795b11575c650637 100644 (file)
@@ -81,6 +81,19 @@ typedef AO_PORT_TYPE ao_port_t;
 void
 ao_panic(uint8_t reason);
 
+/*
+ * ao_romconfig.c
+ */
+
+#define AO_ROMCONFIG_VERSION   2
+
+extern AO_ROMCONFIG_SYMBOL uint16_t ao_romconfig_version;
+extern AO_ROMCONFIG_SYMBOL uint16_t ao_romconfig_check;
+extern AO_ROMCONFIG_SYMBOL uint16_t ao_serial_number;
+#if HAS_RADIO
+extern AO_ROMCONFIG_SYMBOL uint32_t ao_radio_cal;
+#endif
+
 /*
  * ao_timer.c
  */
index 4c2d83efcaba5ebb3bc224c5bae5261c28f17460..7248865427b725a60d6544f3e4fbec90bca59511 100644 (file)
@@ -61,7 +61,7 @@ const char ao_product[] = AO_iProduct_STRING;
 #define NUM_INTERFACES         (AO_USB_HAS_INT + 1)
 
 /* USB descriptors in one giant block of bytes */
-AO_ROMCONFIG_SYMBOL(0x00aa) uint8_t ao_usb_descriptors [] =
+AO_ROMCONFIG_SYMBOL uint8_t ao_usb_descriptors [] =
 {
        /* Device descriptor */
        0x12,
diff --git a/src/kernel/ao_romconfig.c b/src/kernel/ao_romconfig.c
new file mode 100644 (file)
index 0000000..b75142f
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright © 2011 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.
+ */
+
+#include "ao.h"
+
+AO_ROMCONFIG_SYMBOL uint16_t ao_romconfig_version = AO_ROMCONFIG_VERSION;
+AO_ROMCONFIG_SYMBOL uint16_t ao_romconfig_check = ~AO_ROMCONFIG_VERSION;
+AO_ROMCONFIG_SYMBOL uint16_t ao_serial_number = 0;
+#if HAS_RADIO
+AO_ROMCONFIG_SYMBOL uint32_t ao_radio_cal = AO_RADIO_CAL_DEFAULT;
+#endif
index 889be53e76b5b2065d3377e83d583e63b3bea456..35dcc9de57e2ad58286beab8d3f7cb5cfe67d45d 100644 (file)
  * ao_romconfig.c
  */
 
-#define AO_ROMCONFIG_VERSION   2
-
-#define AO_ROMCONFIG_SYMBOL(a) __attribute__((section(".romconfig"))) const
-
-extern const uint16_t ao_romconfig_version;
-extern const uint16_t ao_romconfig_check;
-extern const uint16_t ao_serial_number;
-extern const uint32_t ao_radio_cal;
+#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const
 
 #define ao_arch_task_members\
        uint32_t *sp;                   /* saved stack pointer */
diff --git a/src/lpc/ao_romconfig.c b/src/lpc/ao_romconfig.c
deleted file mode 100644 (file)
index 4e7bab8..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright © 2011 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.
- */
-
-#include "ao.h"
-
-AO_ROMCONFIG_SYMBOL (0) uint16_t ao_romconfig_version = AO_ROMCONFIG_VERSION;
-AO_ROMCONFIG_SYMBOL (0) uint16_t ao_romconfig_check = ~AO_ROMCONFIG_VERSION;
-AO_ROMCONFIG_SYMBOL (0) uint16_t ao_serial_number = 0;
-#ifdef AO_RADIO_CAL_DEFAULT
-AO_ROMCONFIG_SYMBOL (0) uint32_t ao_radio_cal = AO_RADIO_CAL_DEFAULT;
-#endif
index aee9df3c970d08b9d04d3d03df51229ae971abf0..e56375ca35a9524314e601cd84fb776ce58ebc07 100644 (file)
  * ao_romconfig.c
  */
 
-#define AO_ROMCONFIG_VERSION   2
-
-#define AO_ROMCONFIG_SYMBOL(a) __attribute__((section(".romconfig"))) const
-
-extern const uint16_t ao_romconfig_version;
-extern const uint16_t ao_romconfig_check;
-extern const uint16_t ao_serial_number;
-extern const uint32_t ao_radio_cal;
+#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const
 
 #define ao_arch_task_members\
        uint32_t *sp;                   /* saved stack pointer */
diff --git a/src/stm/ao_romconfig.c b/src/stm/ao_romconfig.c
deleted file mode 100644 (file)
index 63a48be..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright © 2011 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.
- */
-
-#include "ao.h"
-
-AO_ROMCONFIG_SYMBOL (0) uint16_t ao_romconfig_version = AO_ROMCONFIG_VERSION;
-AO_ROMCONFIG_SYMBOL (0) uint16_t ao_romconfig_check = ~AO_ROMCONFIG_VERSION;
-AO_ROMCONFIG_SYMBOL (0) uint16_t ao_serial_number = 0;
-#ifndef AO_RADIO_CAL_DEFAULT
-#define AO_RADIO_CAL_DEFAULT 0x01020304
-#endif
-#if HAS_RADIO
-AO_ROMCONFIG_SYMBOL (0) uint32_t ao_radio_cal = AO_RADIO_CAL_DEFAULT;
-#endif
index 083a4e5b448763779c24aa8d9d7c19e3a2ee021b..4e9bdeb68b8202bf0befe59e4a397515e546cc99 100644 (file)
 
 #define AO_PORT_TYPE   uint16_t
 
+#define ao_arch_reboot() \
+       (stm_scb.aircr = ((STM_SCB_AIRCR_VECTKEY_KEY << STM_SCB_AIRCR_VECTKEY) | \
+                         (1 << STM_SCB_AIRCR_SYSRESETREQ)))
+
 #define ao_arch_nop()          asm("nop")
 
+#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const
+
 #define ao_arch_task_members\
        uint32_t *sp;                   /* saved stack pointer */
 
index 15642951308e7c664f0decedcc8971698bb2cd19..22e706b2a975bca6cdb24b210dfbfc56ac52bf32 100644 (file)
@@ -58,9 +58,7 @@
  * ao_romconfig.c
  */
 
-#define AO_ROMCONFIG_VERSION   2
-
-#define AO_ROMCONFIG_SYMBOL(a) __attribute__((section(".romconfig"))) const
+#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const
 
 extern const uint16_t ao_romconfig_version;
 extern const uint16_t ao_romconfig_check;
diff --git a/src/stmf0/ao_romconfig.c b/src/stmf0/ao_romconfig.c
deleted file mode 100644 (file)
index 9d5fd6f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright © 2011 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.
- */
-
-#include "ao.h"
-
-AO_ROMCONFIG_SYMBOL (0) uint16_t ao_romconfig_version = AO_ROMCONFIG_VERSION;
-AO_ROMCONFIG_SYMBOL (0) uint16_t ao_romconfig_check = ~AO_ROMCONFIG_VERSION;
-AO_ROMCONFIG_SYMBOL (0) uint16_t ao_serial_number = 0;
-#ifndef AO_RADIO_CAL_DEFAULT
-#define AO_RADIO_CAL_DEFAULT 0x01020304
-#endif
-AO_ROMCONFIG_SYMBOL (0) uint32_t ao_radio_cal = AO_RADIO_CAL_DEFAULT;
-