diff options
Diffstat (limited to 'src/lpc')
-rw-r--r-- | src/lpc/Makefile-lpc.defs | 5 | ||||
-rw-r--r-- | src/lpc/altos-loader.ld | 4 | ||||
-rw-r--r-- | src/lpc/altos-standalone.ld | 4 | ||||
-rw-r--r-- | src/lpc/altos.ld | 4 | ||||
-rw-r--r-- | src/lpc/ao_adc_lpc.c | 22 | ||||
-rw-r--r-- | src/lpc/ao_arch.h | 22 | ||||
-rw-r--r-- | src/lpc/ao_arch_funcs.h | 18 | ||||
-rw-r--r-- | src/lpc/ao_beep_lpc.c | 2 | ||||
-rw-r--r-- | src/lpc/ao_boot_pin.c | 2 | ||||
-rw-r--r-- | src/lpc/ao_interrupt.c | 4 | ||||
-rw-r--r-- | src/lpc/ao_led_lpc.c | 21 | ||||
-rw-r--r-- | src/lpc/ao_romconfig.c | 26 | ||||
-rw-r--r-- | src/lpc/ao_timer_lpc.c | 6 | ||||
-rw-r--r-- | src/lpc/ao_usb_lpc.c | 8 |
14 files changed, 43 insertions, 105 deletions
diff --git a/src/lpc/Makefile-lpc.defs b/src/lpc/Makefile-lpc.defs index c4521620..edeedaf0 100644 --- a/src/lpc/Makefile-lpc.defs +++ b/src/lpc/Makefile-lpc.defs @@ -29,15 +29,16 @@ CC=$(ARM_CC) WARN_FLAGS=-Wall -Wextra -Werror -Wcast-align AO_CFLAGS=-I. -I$(TOPDIR)/lpc -I$(TOPDIR)/kernel -I$(TOPDIR)/drivers \ + -DNEWLIB_INTEGER_PRINTF_SCANF \ -I$(TOPDIR)/product -I$(TOPDIR) -I$(TOPDIR)/math -I$(TOPDIR) \ - $(PDCLIB_INCLUDES) + -isystem $(NEWLIB_NANO)/arm-none-eabi/include LPC_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m0 -mthumb\ -ffreestanding -nostdlib $(AO_CFLAGS) $(WARN_FLAGS) NICKLE=nickle -LIBS=$(PDCLIB_LIBS_M0) -lgcc +LIBS=-L$(NEWLIB_NANO)/arm-none-eabi/lib/thumb/v6-m -lc -lm -lgcc V=0 # The user has explicitly enabled quiet compilation. diff --git a/src/lpc/altos-loader.ld b/src/lpc/altos-loader.ld index 84d7610c..be4f115d 100644 --- a/src/lpc/altos-loader.ld +++ b/src/lpc/altos-loader.ld @@ -61,9 +61,9 @@ SECTIONS { /* Data -- relocated to RAM, but written to ROM */ .data : { - __data_start__ = .; + _start__ = .; *(.data*) /* initialized data */ - __data_end__ = .; + _end__ = .; } >ram AT>rom diff --git a/src/lpc/altos-standalone.ld b/src/lpc/altos-standalone.ld index db53dcaf..99d10149 100644 --- a/src/lpc/altos-standalone.ld +++ b/src/lpc/altos-standalone.ld @@ -65,9 +65,9 @@ SECTIONS { /* Data -- relocated to RAM, but written to ROM */ .data ORIGIN(ram) : AT (ADDR(.ARM.exidx) + SIZEOF (.ARM.exidx)) { - __data_start__ = .; + _start__ = .; *(.data) /* initialized data */ - __data_end__ = .; + _end__ = .; __bss_start__ = .; } >ram diff --git a/src/lpc/altos.ld b/src/lpc/altos.ld index e6a6a7ed..028ad775 100644 --- a/src/lpc/altos.ld +++ b/src/lpc/altos.ld @@ -69,9 +69,9 @@ SECTIONS { /* Data -- relocated to RAM, but written to ROM */ .data : AT (ADDR(.ARM.exidx) + SIZEOF (.ARM.exidx)) { - __data_start__ = .; + _start__ = .; *(.data) /* initialized data */ - __data_end__ = .; + _end__ = .; __bss_start__ = .; } >ram diff --git a/src/lpc/ao_adc_lpc.c b/src/lpc/ao_adc_lpc.c index 26a5ea08..63241559 100644 --- a/src/lpc/ao_adc_lpc.c +++ b/src/lpc/ao_adc_lpc.c @@ -112,23 +112,7 @@ void lpc_adc_isr(void) } AO_DATA_PRESENT(AO_DATA_ADC); - if (ao_data_present == AO_DATA_ALL) { -#if HAS_MS5607 - ao_data_ring[ao_data_head].ms5607_raw = ao_ms5607_current; -#endif -#if HAS_MMA655X - ao_data_ring[ao_data_head].mma655x = ao_mma655x_current; -#endif -#if HAS_HMC5883 - ao_data_ring[ao_data_head].hmc5883 = ao_hmc5883_current; -#endif -#if HAS_MPU6000 - ao_data_ring[ao_data_head].mpu6000 = ao_mpu6000_current; -#endif - ao_data_ring[ao_data_head].tick = ao_tick_count; - ao_data_head = ao_data_ring_next(ao_data_head); - ao_wakeup((void *) &ao_data_head); - } + ao_data_fill(ao_data_head); ao_adc_ready = 1; } @@ -147,7 +131,7 @@ ao_adc_poll(void) } static void -ao_adc_dump(void) __reentrant +ao_adc_dump(void) { struct ao_data packet; #ifndef AO_ADC_DUMP @@ -167,7 +151,7 @@ ao_adc_dump(void) __reentrant #endif } -__code struct ao_cmds ao_adc_cmds[] = { +const struct ao_cmds ao_adc_cmds[] = { { ao_adc_dump, "a\0Display current ADC values" }, { 0, NULL }, }; diff --git a/src/lpc/ao_arch.h b/src/lpc/ao_arch.h index da21dc9d..35dcc9de 100644 --- a/src/lpc/ao_arch.h +++ b/src/lpc/ao_arch.h @@ -42,11 +42,6 @@ #define ao_arch_naked_declare __attribute__((naked)) #define ao_arch_naked_define -#define __pdata -#define __data -#define __xdata -#define __code const -#define __reentrant #define __interrupt(n) #define __at(n) @@ -59,26 +54,11 @@ #define ao_arch_interrupt(n) /* nothing */ -#undef putchar -#undef getchar -#define putchar(c) ao_putchar(c) -#define getchar ao_getchar - -extern void putchar(char c); -extern char getchar(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 AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const #define ao_arch_task_members\ uint32_t *sp; /* saved stack pointer */ diff --git a/src/lpc/ao_arch_funcs.h b/src/lpc/ao_arch_funcs.h index 15106dea..0454b38b 100644 --- a/src/lpc/ao_arch_funcs.h +++ b/src/lpc/ao_arch_funcs.h @@ -19,17 +19,17 @@ #ifndef _AO_ARCH_FUNCS_H_ #define _AO_ARCH_FUNCS_H_ -#define ao_spi_get_bit(reg,bit,pin,bus,speed) ao_spi_get_mask(reg,(1<<bit),bus,speed) -#define ao_spi_put_bit(reg,bit,pin,bus) ao_spi_put_mask(reg,(1<<bit),bus) +#define ao_spi_get_bit(reg,bit,bus,speed) ao_spi_get_mask(reg,(1<<bit),bus,speed) +#define ao_spi_put_bit(reg,bit,bus) ao_spi_put_mask(reg,(1<<bit),bus) #define ao_enable_port(port) (lpc_scb.sysahbclkctrl |= (1 << LPC_SCB_SYSAHBCLKCTRL_GPIO)) #define ao_disable_port(port) (lpc_scb.sysahbclkctrl &= ~(1 << LPC_SCB_SYSAHBCLKCTRL_GPIO)) #define lpc_all_bit(port,bit) (((port) << 5) | (bit)) -#define ao_gpio_set(port, bit, pin, v) (lpc_gpio.byte[lpc_all_bit(port,bit)] = (v)) +#define ao_gpio_set(port, bit, v) (lpc_gpio.byte[lpc_all_bit(port,bit)] = (v)) -#define ao_gpio_get(port, bit, pin) (lpc_gpio.byte[lpc_all_bit(port,bit)]) +#define ao_gpio_get(port, bit) (lpc_gpio.byte[lpc_all_bit(port,bit)]) #define PORT0_JTAG_REGS ((1 << 11) | (1 << 12) | (1 << 14)) @@ -41,10 +41,10 @@ static inline void lpc_set_gpio(int port, int bit) { } } -#define ao_enable_output(port,bit,pin,v) do { \ +#define ao_enable_output(port,bit,v) do { \ ao_enable_port(port); \ lpc_set_gpio(port,bit); \ - ao_gpio_set(port, bit, pin, v); \ + ao_gpio_set(port, bit, v); \ lpc_gpio.dir[port] |= (1 << bit); \ } while (0) @@ -204,8 +204,8 @@ static inline void ao_arch_restore_stack(void) { ao_spi_put(bus); \ } while (0) -#define ao_spi_get_bit(reg,bit,pin,bus,speed) ao_spi_get_mask(reg,(1<<bit),bus,speed) -#define ao_spi_put_bit(reg,bit,pin,bus) ao_spi_put_mask(reg,(1<<bit),bus) +#define ao_spi_get_bit(reg,bit,bus,speed) ao_spi_get_mask(reg,(1<<bit),bus,speed) +#define ao_spi_put_bit(reg,bit,bus) ao_spi_put_mask(reg,(1<<bit),bus) void ao_spi_get(uint8_t spi_index, uint32_t speed); @@ -254,7 +254,7 @@ static inline void ao_spi_send_byte(uint8_t byte, uint8_t spi_index) uint8_t __bit__; \ for (__bit__ = 0; __bit__ < 32; __bit__++) { \ if (mask & (1 << __bit__)) \ - ao_enable_output(port, __bit__, PIN, 1); \ + ao_enable_output(port, __bit__, 1); \ } \ } while (0) diff --git a/src/lpc/ao_beep_lpc.c b/src/lpc/ao_beep_lpc.c index b1211752..eab86ee6 100644 --- a/src/lpc/ao_beep_lpc.c +++ b/src/lpc/ao_beep_lpc.c @@ -59,7 +59,7 @@ ao_beep(uint8_t beep) } void -ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant +ao_beep_for(uint8_t beep, uint16_t ticks) { ao_beep(beep); ao_delay(ticks); diff --git a/src/lpc/ao_boot_pin.c b/src/lpc/ao_boot_pin.c index e3c7d0c1..a51c7f8d 100644 --- a/src/lpc/ao_boot_pin.c +++ b/src/lpc/ao_boot_pin.c @@ -36,7 +36,7 @@ ao_boot_check_pin(void) ao_arch_nop(); /* Read the value */ - v = ao_gpio_get(AO_BOOT_APPLICATION_GPIO, AO_BOOT_APPLICATION_PIN, AO_BOOT_APPLICATION); + v = ao_gpio_get(AO_BOOT_APPLICATION_GPIO, AO_BOOT_APPLICATION_PIN); /* Reset the chip to turn off the port and the power interface clock */ ao_gpio_set_mode(AO_BOOT_APPLICATION_GPIO, AO_BOOT_APPLICATION_PIN, 0); diff --git a/src/lpc/ao_interrupt.c b/src/lpc/ao_interrupt.c index 3e0119c6..8d71f43f 100644 --- a/src/lpc/ao_interrupt.c +++ b/src/lpc/ao_interrupt.c @@ -32,7 +32,7 @@ extern void main(void); extern char __stack__; extern char __text_start__, __text_end__; -extern char __data_start__, __data_end__; +extern char _start__, _end__; extern char __bss_start__, __bss_end__; #if RELOCATE_INTERRUPT extern char __interrupt_rom__, __interrupt_start__, __interrupt_end__; @@ -61,7 +61,7 @@ void start(void) { memcpy(&__interrupt_start__, &__interrupt_rom__, &__interrupt_end__ - &__interrupt_start__); lpc_scb.sysmemremap = LPC_SCB_SYSMEMREMAP_MAP_RAM << LPC_SCB_SYSMEMREMAP_MAP; #endif - memcpy(&__data_start__, &__text_end__, &__data_end__ - &__data_start__); + memcpy(&_start__, &__text_end__, &_end__ - &_start__); memset(&__bss_start__, '\0', &__bss_end__ - &__bss_start__); main(); } diff --git a/src/lpc/ao_led_lpc.c b/src/lpc/ao_led_lpc.c index 2d2c3972..3a2d4c98 100644 --- a/src/lpc/ao_led_lpc.c +++ b/src/lpc/ao_led_lpc.c @@ -18,7 +18,7 @@ #include <ao.h> -__pdata AO_PORT_TYPE ao_led_enable; +AO_PORT_TYPE ao_led_enable; void ao_led_on(AO_PORT_TYPE colors) @@ -35,8 +35,8 @@ ao_led_off(AO_PORT_TYPE colors) void ao_led_set(AO_PORT_TYPE colors) { - AO_PORT_TYPE on = colors & ao_led_enable; - AO_PORT_TYPE off = ~colors & ao_led_enable; + AO_PORT_TYPE on = colors & LEDS_AVAILABLE; + AO_PORT_TYPE off = ~colors & LEDS_AVAILABLE; ao_led_off(off); ao_led_on(on); @@ -49,7 +49,7 @@ ao_led_toggle(AO_PORT_TYPE colors) } void -ao_led_for(AO_PORT_TYPE colors, uint16_t ticks) __reentrant +ao_led_for(AO_PORT_TYPE colors, uint16_t ticks) { ao_led_on(colors); ao_delay(ticks); @@ -57,18 +57,17 @@ ao_led_for(AO_PORT_TYPE colors, uint16_t ticks) __reentrant } void -ao_led_init(AO_PORT_TYPE enable) +ao_led_init(void) { - ao_led_enable = enable; ao_enable_port(LED_PORT); if (LED_PORT == 0) { - if (enable & (1 << 11)) + if (LEDS_AVAILABLE & (1 << 11)) lpc_ioconf.pio0_11 = LPC_IOCONF_FUNC_PIO0_11 | (1 << LPC_IOCONF_ADMODE); - if (enable & (1 << 12)) + if (LEDS_AVAILABLE & (1 << 12)) lpc_ioconf.pio0_12 = LPC_IOCONF_FUNC_PIO0_12 | (1 << LPC_IOCONF_ADMODE); - if (enable & (1 << 14)) + if (LEDS_AVAILABLE & (1 << 14)) lpc_ioconf.pio0_14 = LPC_IOCONF_FUNC_PIO0_14 | (1 << LPC_IOCONF_ADMODE); } - lpc_gpio.dir[LED_PORT] |= enable; - ao_led_off(enable); + lpc_gpio.dir[LED_PORT] |= LEDS_AVAILABLE; + ao_led_off(LEDS_AVAILABLE); } diff --git a/src/lpc/ao_romconfig.c b/src/lpc/ao_romconfig.c deleted file mode 100644 index 4e7bab8d..00000000 --- a/src/lpc/ao_romconfig.c +++ /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 diff --git a/src/lpc/ao_timer_lpc.c b/src/lpc/ao_timer_lpc.c index 166e2f15..8999c7ac 100644 --- a/src/lpc/ao_timer_lpc.c +++ b/src/lpc/ao_timer_lpc.c @@ -18,7 +18,7 @@ #include <ao.h> -volatile __data AO_TICK_TYPE ao_tick_count; +volatile AO_TICK_TYPE ao_tick_count; uint16_t ao_time(void) @@ -27,8 +27,8 @@ ao_time(void) } #if AO_DATA_ALL -volatile __data uint8_t ao_data_interval = 1; -volatile __data uint8_t ao_data_count; +volatile uint8_t ao_data_interval = 1; +volatile uint8_t ao_data_count; #endif void lpc_systick_isr(void) diff --git a/src/lpc/ao_usb_lpc.c b/src/lpc/ao_usb_lpc.c index d26a1437..594114b6 100644 --- a/src/lpc/ao_usb_lpc.c +++ b/src/lpc/ao_usb_lpc.c @@ -857,7 +857,7 @@ ao_usb_disable(void) ao_arch_block_interrupts(); #if HAS_USB_PULLUP - ao_gpio_set(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, AO_USB_PULLUP, 0); + ao_gpio_set(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, 0); #endif /* Disable interrupts */ lpc_usb.inten = 0; @@ -975,7 +975,7 @@ ao_usb_enable(void) ao_usb_set_ep0(); #if HAS_USB_PULLUP - ao_gpio_set(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, AO_USB_PULLUP, 1); + ao_gpio_set(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, 1); #endif } @@ -1003,7 +1003,7 @@ ao_usb_irq(void) control_count, out_count, in_count, int_count, reset_count); } -__code struct ao_cmds ao_usb_cmds[] = { +const struct ao_cmds ao_usb_cmds[] = { { ao_usb_irq, "I\0Show USB interrupt counts" }, { 0, NULL } }; @@ -1014,7 +1014,7 @@ ao_usb_init(void) { #if HAS_USB_PULLUP int i; - ao_enable_output(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, AO_USB_PULLUP, 0); + ao_enable_output(AO_USB_PULLUP_PORT, AO_USB_PULLUP_PIN, 0); for (i = 0; i < 40000; i++) ao_arch_nop(); |