From 39f10bd4baafcaeb044902b2a6fc272a5d479c67 Mon Sep 17 00:00:00 2001 From: tkl Date: Tue, 16 Aug 2016 09:33:49 +0200 Subject: [PATCH] stm32f4 target spec code compiling --- Makefile | 5 +++-- .../arch/stm32f4xx/{stm32f4xx_ctx._c => stm32f4xx_ctx.c} | 0 .../arch/stm32f4xx/{stm32f4xx_irq._c => stm32f4xx_irq.c} | 0 .../arch/stm32f4xx/{stm32f4xx_isr._c => stm32f4xx_isr.c} | 0 .../stm32f4xx/{stm32f4xx_stack._c => stm32f4xx_stack.c} | 0 source/firmware/kernel/driver/driver.c | 4 ++-- source/firmware/kernel/include/ctx.h | 7 ++----- source/firmware/kernel/include/irq.h | 7 ++----- source/firmware/kernel/include/low_power.h | 7 ++----- source/firmware/kernel/include/schedule.h | 7 ++----- source/firmware/kernel/include/shell_data.h | 3 +++ source/firmware/kernel/include/stack.h | 7 ++----- source/firmware/kernel/kernel.mk | 4 +--- source/firmware/kernel/schedule.c | 2 +- source/firmware/kernel/shell_commands.c | 6 +++--- 15 files changed, 23 insertions(+), 36 deletions(-) rename source/firmware/arch/stm32f4xx/{stm32f4xx_ctx._c => stm32f4xx_ctx.c} (100%) rename source/firmware/arch/stm32f4xx/{stm32f4xx_irq._c => stm32f4xx_irq.c} (100%) rename source/firmware/arch/stm32f4xx/{stm32f4xx_isr._c => stm32f4xx_isr.c} (100%) rename source/firmware/arch/stm32f4xx/{stm32f4xx_stack._c => stm32f4xx_stack.c} (100%) diff --git a/Makefile b/Makefile index b7fdd15..663a1b2 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,6 @@ GEN_FLAGS := \ -ffunction-sections \ -fdata-sections \ -ffreestanding \ - -flto \ -fno-move-loop-invariants \ -Werror \ -Wunused \ @@ -28,6 +27,7 @@ GEN_FLAGS := \ -Waggregate-return \ -Wfloat-equal \ -g3 +# -flto ## behind -ffreestanding C_FLAGS = \ -DDEBUG \ @@ -62,7 +62,8 @@ L_FLAGS := \ INCLUDES += \ /opt/arm-2011.09/arm-none-eabi/include \ - /opt/arm-2011.09/lib/gcc/arm-none-eabi/4.6.1/include + /opt/arm-2011.09/lib/gcc/arm-none-eabi/4.6.1/include \ + source/firmware ############################################################################### # TOOLS Section diff --git a/source/firmware/arch/stm32f4xx/stm32f4xx_ctx._c b/source/firmware/arch/stm32f4xx/stm32f4xx_ctx.c similarity index 100% rename from source/firmware/arch/stm32f4xx/stm32f4xx_ctx._c rename to source/firmware/arch/stm32f4xx/stm32f4xx_ctx.c diff --git a/source/firmware/arch/stm32f4xx/stm32f4xx_irq._c b/source/firmware/arch/stm32f4xx/stm32f4xx_irq.c similarity index 100% rename from source/firmware/arch/stm32f4xx/stm32f4xx_irq._c rename to source/firmware/arch/stm32f4xx/stm32f4xx_irq.c diff --git a/source/firmware/arch/stm32f4xx/stm32f4xx_isr._c b/source/firmware/arch/stm32f4xx/stm32f4xx_isr.c similarity index 100% rename from source/firmware/arch/stm32f4xx/stm32f4xx_isr._c rename to source/firmware/arch/stm32f4xx/stm32f4xx_isr.c diff --git a/source/firmware/arch/stm32f4xx/stm32f4xx_stack._c b/source/firmware/arch/stm32f4xx/stm32f4xx_stack.c similarity index 100% rename from source/firmware/arch/stm32f4xx/stm32f4xx_stack._c rename to source/firmware/arch/stm32f4xx/stm32f4xx_stack.c diff --git a/source/firmware/kernel/driver/driver.c b/source/firmware/kernel/driver/driver.c index 9eb7bb3..4a0bb0e 100644 --- a/source/firmware/kernel/driver/driver.c +++ b/source/firmware/kernel/driver/driver.c @@ -12,7 +12,7 @@ #include "gpio.h" #include "i2c.h" #include "pwm.h" -#include "rtc.h" +//#include "rtc.h" #include "spi.h" #include "uart.h" @@ -66,7 +66,7 @@ int drv_close(const struct driver *driver) ret = pwm_close((const struct pwm *)(driver->device_driver)); break; case DRIVER_TYPE_RTC: - ret = rtc_close((const struct rtc *)(driver->device_driver)); +// ret = rtc_close((const struct rtc *)(driver->device_driver)); break; case DRIVER_TYPE_SPI: ret = spi_close((const struct spi *)(driver->device_driver)); diff --git a/source/firmware/kernel/include/ctx.h b/source/firmware/kernel/include/ctx.h index e42fb28..9f490ec 100755 --- a/source/firmware/kernel/include/ctx.h +++ b/source/firmware/kernel/include/ctx.h @@ -8,11 +8,8 @@ #ifndef CTX_H_ #define CTX_H_ -#ifdef ARCH_MSP430 -#include "msp430_ctx.h" -#endif -#ifdef ARCH_STM32F4XX +//#ifdef ARCH_STM32F4XX #include "stm32f4xx_ctx.h" -#endif +//#endif #endif /* CTX_H_ */ diff --git a/source/firmware/kernel/include/irq.h b/source/firmware/kernel/include/irq.h index 9588740..0ccfca3 100644 --- a/source/firmware/kernel/include/irq.h +++ b/source/firmware/kernel/include/irq.h @@ -8,10 +8,7 @@ #ifndef IRQ_H_ #define IRQ_H_ -#ifdef ARCH_MSP430 -#include "msp430_irq.h" -#endif -#ifdef ARCH_STM32F4XX +//#ifdef ARCH_STM32F4XX #include "stm32f4xx_irq.h" -#endif +//#endif #endif /* IRQ_H_ */ diff --git a/source/firmware/kernel/include/low_power.h b/source/firmware/kernel/include/low_power.h index f3c3639..efd4751 100755 --- a/source/firmware/kernel/include/low_power.h +++ b/source/firmware/kernel/include/low_power.h @@ -8,11 +8,8 @@ #ifndef LOW_POWER_H_ #define LOW_POWER_H_ -#ifdef ARCH_MSP430 -#include "msp430_low_power.h" -#endif -#ifdef ARCH_STM32F4XX +//#ifdef ARCH_STM32F4XX #include "stm32f4xx_low_power.h" -#endif +//#endif #endif /* LOW_POWER_H_ */ diff --git a/source/firmware/kernel/include/schedule.h b/source/firmware/kernel/include/schedule.h index 84e0c9d..d9c5447 100755 --- a/source/firmware/kernel/include/schedule.h +++ b/source/firmware/kernel/include/schedule.h @@ -8,12 +8,9 @@ #ifndef SCHEDULE_H_ #define SCHEDULE_H_ -#ifdef ARCH_MSP430 -#include "msp430_schedule.h" -#endif -#ifdef ARCH_STM32F4XX +//#ifdef ARCH_STM32F4XX #include "stm32f4xx_ctx.h" -#endif +//#endif #define schedule() arch_schedule() diff --git a/source/firmware/kernel/include/shell_data.h b/source/firmware/kernel/include/shell_data.h index e8d86a4..d26e778 100644 --- a/source/firmware/kernel/include/shell_data.h +++ b/source/firmware/kernel/include/shell_data.h @@ -8,11 +8,14 @@ #ifndef SOURCE_FIRMWARE_KERNEL_INCLUDE_SHELL_DATA_H_ #define SOURCE_FIRMWARE_KERNEL_INCLUDE_SHELL_DATA_H_ +#pragma pack(push) +#pragma pack(1) struct shell_object { struct list command_list; const struct driver *shell_device; bool echo_on; }; +#pragma pack(pop) struct shell_object shell_object; diff --git a/source/firmware/kernel/include/stack.h b/source/firmware/kernel/include/stack.h index b11b21d..2128186 100644 --- a/source/firmware/kernel/include/stack.h +++ b/source/firmware/kernel/include/stack.h @@ -8,11 +8,8 @@ #ifndef STACK_H_ #define STACK_H_ -#ifdef ARCH_MSP430 -#include "msp430_stack.h" -#endif -#ifdef ARCH_STM32F4XX +//#ifdef ARCH_STM32F4XX #include "stm32f4xx_stack.h" -#endif +//#endif #endif /* STACK_H_ */ diff --git a/source/firmware/kernel/kernel.mk b/source/firmware/kernel/kernel.mk index 86c72ec..784ab58 100755 --- a/source/firmware/kernel/kernel.mk +++ b/source/firmware/kernel/kernel.mk @@ -1,7 +1,5 @@ -CHECK_FOLDER += source/firmware/kernel -SUB_FOLDER += source/firmware/kernel +SRC_DIR += source/firmware/kernel INCLUDES += source/firmware/kernel/include INCLUDES += source/firmware/kernel/interface -DOC_SRC += source/firmware/kernel include source/firmware/kernel/driver/driver.mk diff --git a/source/firmware/kernel/schedule.c b/source/firmware/kernel/schedule.c index 3021cdf..dcba422 100755 --- a/source/firmware/kernel/schedule.c +++ b/source/firmware/kernel/schedule.c @@ -21,7 +21,7 @@ extern volatile struct thread_list threads; volatile struct thread_context *current_thread; static struct thread_context idle_task; -static stack_t idle_stack[22]; /* 30 didn't work with tx test app. why? */ +static stack_t idle_stack[22]; void idle_func(void *arg) { while(1) { diff --git a/source/firmware/kernel/shell_commands.c b/source/firmware/kernel/shell_commands.c index 81674ce..519e6d2 100644 --- a/source/firmware/kernel/shell_commands.c +++ b/source/firmware/kernel/shell_commands.c @@ -69,10 +69,10 @@ static void *cmd_list_all_commands_cb(const char *cmd) drv_write(shell_object.shell_device, greeter, strlen(greeter)); for(i = 0; i < (len - 1); i++) { if(NULL != it) { - struct command *cmd = (struct command *)it->data; - drv_write(shell_object.shell_device, cmd->command, strlen(cmd->command)); + struct command *command = (struct command *)it->data; + drv_write(shell_object.shell_device, command->command, strlen(command->command)); drv_write(shell_object.shell_device, " - ", 3); - drv_write(shell_object.shell_device, cmd->description, strlen(cmd->description)); + drv_write(shell_object.shell_device, command->description, strlen(command->description)); drv_write(shell_object.shell_device, "\r\n", 2); it = it->next; }