serial = strtoul(serial_string, NULL, 0);
if (!serial)
-(argv[0]);
+ usage(argv[0]);
serial_int[0] = serial & 0xff;
serial_int[1] = (serial >> 8) & 0xff;
extern char getchar(void);
extern void ao_avr_stdio_init(void);
-extern const uint16_t ao_serial_number;
+#define AO_ROMCONFIG_VERSION 2
+
+#define AO_ROMCONFIG_SYMBOL(a) const
+
+extern AO_ROMCONFIG_SYMBOL(0) uint16_t ao_serial_number;
#define AVR_PUSH8(stack, val) (*((stack)--) = (val))
#include "ao.h"
-const uint16_t ao_serial_number = 0;
+AO_ROMCONFIG_SYMBOL (0) uint16_t ao_serial_number = 0;
#define AO_ROMCONFIG_VERSION 2
-extern __code __at (0x00a0) uint16_t ao_romconfig_version;
-extern __code __at (0x00a2) uint16_t ao_romconfig_check;
-extern __code __at (0x00a4) uint16_t ao_serial_number;
-extern __code __at (0x00a6) uint32_t ao_radio_cal;
+#define AO_ROMCONFIG_SYMBOL(a) __code __at(a)
+
+extern AO_ROMCONFIG_SYMBOL(0x00a0) uint16_t ao_romconfig_version;
+extern AO_ROMCONFIG_SYMBOL(0x00a2) uint16_t ao_romconfig_check;
+extern AO_ROMCONFIG_SYMBOL(0x00a4) uint16_t ao_serial_number;
+extern AO_ROMCONFIG_SYMBOL(0x00a6) uint32_t ao_radio_cal;
#ifndef HAS_USB
#error Please define HAS_USB
#if HAS_USB
#include "ao_usb.h"
/* USB descriptors in one giant block of bytes */
-__code __at(0x00aa) uint8_t ao_usb_descriptors [] =
+AO_ROMCONFIG_SYMBOL(0x00aa) uint8_t ao_usb_descriptors [] =
{
/* Device descriptor */
0x12,
#define CC1120_DEBUG AO_FEC_DEBUG
#define CC1120_TRACE 0
-const uint32_t ao_radio_cal = 0x6ca333;
+extern const uint32_t ao_radio_cal;
#define FOSC 32000000
ao_spi_recv(&ao_companion_setup, sizeof (ao_companion_setup), AO_COMPANION_SPI_BUS);
COMPANION_DESELECT();
return (ao_companion_setup.board_id ==
- ~ao_companion_setup.board_id_inverse);
+ (uint16_t) ~ao_companion_setup.board_id_inverse);
}
static void
{
uint8_t i;
printf("Companion running: %d\n", ao_companion_running);
+ if (!ao_companion_running)
+ return;
printf("device: %d\n", ao_companion_setup.board_id);
printf("update period: %d\n", ao_companion_setup.update_period);
printf("channels: %d\n", ao_companion_setup.channels);
all: $(PROG)
-$(PROG): Makefile $(OBJ)
+$(PROG): Makefile $(OBJ) altos.ld
$(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(SAT_CLIB) -lgcc
../altitude.h: make-altitude
* Radio (cc1120)
*/
+/* gets pretty close to 434.550 */
+
+#define AO_RADIO_CAL_DEFAULT 0x6ca333
+
#define AO_FEC_DEBUG 0
#define AO_CC1120_SPI_CS_PORT (&stm_gpioc)
#define AO_CC1120_SPI_CS_PIN 5
# to run from SRAM
LD_FLAGS_RAM=-L../stm -Wl,-Taltos-ram.ld
-LD_FLAGS=-L../stm -Wl,-Taltos.ld
+LD_FLAGS=-L../stm -Wl,-Tbringup.ld
CFLAGS=$(DEF_CFLAGS) -mcpu=cortex-m3 -DCONFIG_STM32L_DISCOVERY
%.bin: %.elf
$(OBJCOPY) -O binary $^ $@
-bringup.elf: $(OBJ) $(C_LIB) altos.ld
+bringup.elf: $(OBJ) $(C_LIB) bringup.ld
$(CC) $(CFLAGS) $(LD_FLAGS) -o $@ $(OBJ) $(C_LIB) -lgcc
bringup-ram.elf: $(OBJ) $(C_LIB) altos-ram.ld
EXTERN (stm_interrupt_vector)
SECTIONS {
- . = ORIGIN(rom);
-
/*
* Rom contents
*/
- __text_start__ = .;
-
- .text : {
+ .text ORIGIN(rom) : {
+ __text_start__ = .;
*(.interrupt) /* Interrupt vectors */
+
+ . = ORIGIN(rom) + 0x100;
+
+ ao_romconfig.o(.romconfig*)
+ ao_product.o(.romconfig*)
+
*(.text*) /* Executable code */
*(.rodata*) /* Constants */
+
} > rom
.ARM.exidx : {
__text_end__ = .;
} > rom
- . = ORIGIN(ram);
- __data_start__ = .;
-
/* Data -- relocated to RAM, but written to ROM
*/
- .data : AT (ADDR(.ARM.exidx) + SIZEOF (.ARM.exidx)) {
+ .data ORIGIN(ram) : AT (ADDR(.ARM.exidx) + SIZEOF (.ARM.exidx)) {
+ __data_start__ = .;
*(.data) /* initialized data */
__data_end__ = .;
__bss_start__ = .;
PROVIDE(__stack__ = ORIGIN(ram) + LENGTH(ram));
PROVIDE(end = .);
-
}
ENTRY(start);
extern char getchar(void);
extern void ao_avr_stdio_init(void);
+
+/*
+ * 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 ARM_PUSH32(stack, val) (*(--(stack)) = (val))
#include "ao.h"
-const uint16_t ao_serial_number = 58;
+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