kindsoldier / stm32-f4-freertos-opencm3

STM32 F407 FreeRTOS sample with OpenCM3
0 stars 0 forks source link

Does not compile with -Os #1

Open smooker opened 3 years ago

smooker commented 3 years ago

because of the inline functions ?

smooker commented 3 years ago
smooker@sd4 ~/src/stm32src/stm32-f4-freertos-opencm3 $ cat inline.patch 
diff --git a/Makefile b/Makefile
index 7273804..2bdb3f4 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ CFLAGS+= -mcpu=cortex-m4
 CFLAGS+= -fno-common -ffunction-sections -fdata-sections
 CFLAGS+= -g -gdwarf-2
 CFLAGS+= -I${RTOS_LOC}
-
+CFLAGS+= -I../libopencm3/include

 LDFLAGS+= ${CFLAGS}
 LDFLAGS+= --static
@@ -24,7 +24,7 @@ LDFLAGS+= -Wl,--cref -Wl,--gc-sections
 LDFLAGS+= -Wl,--start-group -lc -lm -lgcc -lnosys -Wl,--end-group
 LDFLAGS+= -lopencm3_stm32f4
 LDFLAGS+= -L${RTOS_LOC} -lrtos
-
+LDFLAGS+= -L../libopencm3/lib

 RTOS_OBJS+= $(RTOS_LOC)/croutine.o
 RTOS_OBJS+= $(RTOS_LOC)/event_groups.o
@@ -57,24 +57,24 @@ rtos:  $(RTOS_LOC)/librtos.a
 ${RTOS_OBJS}: FreeRTOSConfig.h

 $(RTOS_LOC)/librtos.a: $(RTOS_OBJS)
-   cd $(@D) && arm-eabi-ar rcv $(@F) $(^F)
+   cd $(@D) && arm-none-eabi-ar rcv $(@F) $(^F)

 master.elf: $(MASTER_OBJS)
-   arm-eabi-gcc $(^F) $(LDFLAGS) -o $@ 
-   arm-eabi-size --format=berkeley $@
+   arm-none-eabi-gcc $(^F) $(LDFLAGS) -o $@ 
+   arm-none-eabi-size --format=berkeley $@

 %.o: %.c
-   arm-eabi-gcc $(CFLAGS) -c -o $@ $<
+   arm-none-eabi-gcc $(CFLAGS) -c -o $@ $<

 %.o: %.S
-   arm-eabi-as $(ASFLAGS) -o $@ $<
+   arm-none-eabi-as $(ASFLAGS) -o $@ $<

 %.bin: %.elf
-   arm-eabi-objcopy -O binary $< $@
+   arm-none-eabi-objcopy -O binary $< $@

 %.elf: %.o
-   arm-eabi-gcc $(^F) $(LDFLAGS) -o $@ 
-   arm-eabi-size --format=berkeley $@
+   arm-none-eabi-gcc $(^F) $(LDFLAGS) -o $@ 
+   arm-none-eabi-size --format=berkeley $@

 clean:
    rm -f *.i *.o *.elf *.bin *.map *~ *.hex *.d *.s
diff --git a/ili9341.c b/ili9341.c
index 295d499..6cc2432 100644
--- a/ili9341.c
+++ b/ili9341.c
@@ -19,12 +19,12 @@ inline void _delay_ms(uint32_t n) {
         __asm__("nop");
 }

-inline void delay_ms(uint32_t n) {
+void delay_ms(uint32_t n) {
     for (volatile int i = 0; i < n * 80000; i++)
         __asm__("nop");
 }

-inline void lcd_write_command(uint8_t comm) {
+void lcd_write_command(uint8_t comm) {
     taskENTER_CRITICAL();
     LCD_COMM = (uint16_t) (comm & 0xFF);
     taskEXIT_CRITICAL();
@@ -40,7 +40,7 @@ inline void lcd_write_byte(uint8_t data) {
     taskEXIT_CRITICAL();
 }

-inline inline void lcd_write_word(uint16_t w) {
+void lcd_write_word(uint16_t w) {
     lcd_write_data((w >> 8) & 0xFF);
     lcd_write_data(w & 0xFF);
 }
kindsoldier commented 3 years ago

because of the inline functions ?

yes.