summaryrefslogtreecommitdiff
path: root/src/stm
diff options
context:
space:
mode:
Diffstat (limited to 'src/stm')
-rw-r--r--src/stm/Makefile.defs2
-rw-r--r--src/stm/ao_arch_funcs.h9
-rw-r--r--src/stm/ao_eeprom_stm.c4
-rw-r--r--src/stm/ao_usb_stm.c2
-rw-r--r--src/stm/stm32l.h2
5 files changed, 7 insertions, 12 deletions
diff --git a/src/stm/Makefile.defs b/src/stm/Makefile.defs
index c3d2707f..0ba86f5a 100644
--- a/src/stm/Makefile.defs
+++ b/src/stm/Makefile.defs
@@ -27,7 +27,7 @@ LIBS=$(PDCLIB_LIBS_M3) -lgcc
WARN_FLAGS=-Wall -Wextra -Werror
AO_CFLAGS=-I. -I../stm -I../kernel -I../drivers -I../math -I.. $(PDCLIB_INCLUDES)
-STM_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m3 -mthumb \
+STM_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m3 -mthumb -Wcast-align \
-ffreestanding -nostdlib $(AO_CFLAGS) $(WARN_FLAGS)
LDFLAGS=-L../stm -Wl,-Taltos.ld
diff --git a/src/stm/ao_arch_funcs.h b/src/stm/ao_arch_funcs.h
index 18ca20da..a9d0fa34 100644
--- a/src/stm/ao_arch_funcs.h
+++ b/src/stm/ao_arch_funcs.h
@@ -375,7 +375,7 @@ ao_arch_irq_check(void) {
static inline void
ao_arch_init_stack(struct ao_task *task, void *start)
{
- uint32_t *sp = (uint32_t *) (task->stack + AO_STACK_SIZE);
+ uint32_t *sp = (uint32_t *) ((void*) task->stack + AO_STACK_SIZE);
uint32_t a = (uint32_t) start;
int i;
@@ -413,16 +413,11 @@ static inline void ao_arch_save_stack(void) {
uint32_t *sp;
asm("mov %0,sp" : "=&r" (sp) );
ao_cur_task->sp = (sp);
- if ((uint8_t *) sp < &ao_cur_task->stack[0])
- ao_panic (AO_PANIC_STACK);
}
static inline void ao_arch_restore_stack(void) {
- uint32_t sp;
- sp = (uint32_t) ao_cur_task->sp;
-
/* Switch stacks */
- asm("mov sp, %0" : : "r" (sp) );
+ asm("mov sp, %0" : : "r" (ao_cur_task->sp) );
/* Restore PRIMASK */
asm("pop {r0}");
diff --git a/src/stm/ao_eeprom_stm.c b/src/stm/ao_eeprom_stm.c
index 05f880b8..4f477122 100644
--- a/src/stm/ao_eeprom_stm.c
+++ b/src/stm/ao_eeprom_stm.c
@@ -83,7 +83,7 @@ ao_intflash_write32(uint16_t pos, uint32_t w)
{
volatile uint32_t *addr;
- addr = (uint32_t *) (stm_eeprom + pos);
+ addr = (uint32_t *) (void *) (stm_eeprom + pos);
/* Write a word to a valid address in the data EEPROM */
*addr = w;
@@ -96,7 +96,7 @@ ao_intflash_write8(uint16_t pos, uint8_t d)
uint32_t w, *addr, mask;
uint8_t shift;
- addr = (uint32_t *) (stm_eeprom + (pos & ~3));
+ addr = (uint32_t *) (void *) (stm_eeprom + (pos & ~3));
/* Compute word to be written */
shift = (pos & 3) << 3;
diff --git a/src/stm/ao_usb_stm.c b/src/stm/ao_usb_stm.c
index f2b8ea94..9d72844e 100644
--- a/src/stm/ao_usb_stm.c
+++ b/src/stm/ao_usb_stm.c
@@ -139,7 +139,7 @@ static inline uint32_t set_toggle(uint32_t current_value,
static inline uint32_t *ao_usb_packet_buffer_addr(uint16_t sram_addr)
{
- return (uint32_t *) (stm_usb_sram + 2 * sram_addr);
+ return (uint32_t *) (((void *) ((uint8_t *) stm_usb_sram + 2 * sram_addr)));
}
static inline uint32_t ao_usb_epr_stat_rx(uint32_t epr) {
diff --git a/src/stm/stm32l.h b/src/stm/stm32l.h
index 463125e2..be1e1d65 100644
--- a/src/stm/stm32l.h
+++ b/src/stm/stm32l.h
@@ -1961,7 +1961,7 @@ union stm_usb_bdt {
#define STM_USB_BDT_SIZE 8
-extern uint8_t stm_usb_sram[];
+extern uint8_t stm_usb_sram[] __attribute__ ((aligned(4)));
struct stm_exti {
vuint32_t imr;