summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-01-17 23:38:10 +0700
committerhathach <[email protected]>2023-01-17 23:38:10 +0700
commit8df2fd1916d5e69cfaad7516399a8d7da5060f57 (patch)
tree1b82bd8dc67b97c19042defa39c815c891323115 /examples
parentc86e628a4c199a39f8317a0d4b5dd96e9692e544 (diff)
update freertos example to build with iar
Diffstat (limited to 'examples')
-rw-r--r--examples/device/cdc_msc_freertos/Makefile12
-rw-r--r--examples/device/cdc_msc_freertos/src/FreeRTOSConfig/FreeRTOSConfig.h7
-rw-r--r--examples/device/hid_composite_freertos/Makefile12
-rw-r--r--examples/device/hid_composite_freertos/src/FreeRTOSConfig/FreeRTOSConfig.h7
-rw-r--r--examples/rules.mk19
5 files changed, 37 insertions, 20 deletions
diff --git a/examples/device/cdc_msc_freertos/Makefile b/examples/device/cdc_msc_freertos/Makefile
index ff4b41108..4ee816880 100644
--- a/examples/device/cdc_msc_freertos/Makefile
+++ b/examples/device/cdc_msc_freertos/Makefile
@@ -4,13 +4,14 @@ include ../../../tools/top.mk
include ../../make.mk
FREERTOS_SRC = lib/FreeRTOS-Kernel
+FREERTOS_PORTABLE_SRC= $(FREERTOS_SRC)/portable/$(if $(USE_IAR),IAR,GCC)/$(FREERTOS_PORT)
INC += \
src \
src/FreeRTOSConfig \
$(TOP)/hw \
$(TOP)/$(FREERTOS_SRC)/include \
- $(TOP)/$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)
+ $(TOP)/$(FREERTOS_PORTABLE_SRC)
# Example source
EXAMPLE_SOURCE = \
@@ -27,17 +28,20 @@ SRC_C += \
$(FREERTOS_SRC)/queue.c \
$(FREERTOS_SRC)/tasks.c \
$(FREERTOS_SRC)/timers.c \
- $(subst ../../../,,$(wildcard ../../../$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)/*.c))
+ $(subst ../../../,,$(wildcard ../../../$(FREERTOS_PORTABLE_SRC)/*.c))
+
+SRC_S += \
+ $(subst ../../../,,$(wildcard ../../../$(FREERTOS_PORTABLE_SRC)/*.s))
# include heap manage if configSUPPORT_DYNAMIC_ALLOCATION = 1
# SRC_C += $(FREERTOS_SRC)/portable/MemMang/heap_1.c
# CFLAGS += -Wno-error=sign-compare
# Suppress FreeRTOSConfig.h warnings
-CFLAGS += -Wno-error=redundant-decls
+GCC_CFLAGS += -Wno-error=redundant-decls
# Suppress FreeRTOS source warnings
-CFLAGS += -Wno-error=cast-qual
+GCC_CFLAGS += -Wno-error=cast-qual
# FreeRTOS (lto + Os) linker issue
LDFLAGS += -Wl,--undefined=vTaskSwitchContext
diff --git a/examples/device/cdc_msc_freertos/src/FreeRTOSConfig/FreeRTOSConfig.h b/examples/device/cdc_msc_freertos/src/FreeRTOSConfig/FreeRTOSConfig.h
index 968c59749..efd527ed2 100644
--- a/examples/device/cdc_msc_freertos/src/FreeRTOSConfig/FreeRTOSConfig.h
+++ b/examples/device/cdc_msc_freertos/src/FreeRTOSConfig/FreeRTOSConfig.h
@@ -42,6 +42,9 @@
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
+// skip if is compiled with assembler
+#if !defined(__ASSEMBLER__) && !defined(__IASMARM__)
+
// Include MCU header
#include "bsp/board_mcu.h"
@@ -57,6 +60,8 @@
extern uint32_t SystemCoreClock;
#endif
+#endif
+
/* Cortex M23/M33 port configuration. */
#define configENABLE_MPU 0
#define configENABLE_FPU 1
@@ -166,7 +171,7 @@
#elif defined(__ECLIC_INTCTLBITS)
// RISC-V Bumblebee core from nuclei
#define configPRIO_BITS __ECLIC_INTCTLBITS
-#else
+#elif !defined(__ASSEMBLER__) && !defined(__IASMARM__)
#error "FreeRTOS configPRIO_BITS to be defined"
#endif
diff --git a/examples/device/hid_composite_freertos/Makefile b/examples/device/hid_composite_freertos/Makefile
index 9c66b896d..a354a90b6 100644
--- a/examples/device/hid_composite_freertos/Makefile
+++ b/examples/device/hid_composite_freertos/Makefile
@@ -4,13 +4,14 @@ include ../../../tools/top.mk
include ../../make.mk
FREERTOS_SRC = lib/FreeRTOS-Kernel
+FREERTOS_PORTABLE_SRC= $(FREERTOS_SRC)/portable/$(if $(USE_IAR),IAR,GCC)/$(FREERTOS_PORT)
INC += \
src \
src/FreeRTOSConfig \
$(TOP)/hw \
$(TOP)/$(FREERTOS_SRC)/include \
- $(TOP)/$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)
+ $(TOP)/$(FREERTOS_PORTABLE_SRC)
# Example source
EXAMPLE_SOURCE = \
@@ -26,17 +27,20 @@ SRC_C += \
$(FREERTOS_SRC)/queue.c \
$(FREERTOS_SRC)/tasks.c \
$(FREERTOS_SRC)/timers.c \
- $(subst ../../../,,$(wildcard ../../../$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)/*.c))
+ $(subst ../../../,,$(wildcard ../../../$(FREERTOS_PORTABLE_SRC)/*.c))
+
+SRC_S += \
+ $(subst ../../../,,$(wildcard ../../../$(FREERTOS_PORTABLE_SRC)/*.s))
# include heap manage if configSUPPORT_DYNAMIC_ALLOCATION = 1
# SRC_C += $(FREERTOS_SRC)/portable/MemMang/heap_1.c
# CFLAGS += -Wno-error=sign-compare
# Suppress FreeRTOSConfig.h warnings
-CFLAGS += -Wno-error=redundant-decls
+GCC_CFLAGS += -Wno-error=redundant-decls
# Suppress FreeRTOS source warnings
-CFLAGS += -Wno-error=cast-qual
+GCC_CFLAGS += -Wno-error=cast-qual
# FreeRTOS (lto + Os) linker issue
LDFLAGS += -Wl,--undefined=vTaskSwitchContext
diff --git a/examples/device/hid_composite_freertos/src/FreeRTOSConfig/FreeRTOSConfig.h b/examples/device/hid_composite_freertos/src/FreeRTOSConfig/FreeRTOSConfig.h
index 968c59749..efd527ed2 100644
--- a/examples/device/hid_composite_freertos/src/FreeRTOSConfig/FreeRTOSConfig.h
+++ b/examples/device/hid_composite_freertos/src/FreeRTOSConfig/FreeRTOSConfig.h
@@ -42,6 +42,9 @@
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
+// skip if is compiled with assembler
+#if !defined(__ASSEMBLER__) && !defined(__IASMARM__)
+
// Include MCU header
#include "bsp/board_mcu.h"
@@ -57,6 +60,8 @@
extern uint32_t SystemCoreClock;
#endif
+#endif
+
/* Cortex M23/M33 port configuration. */
#define configENABLE_MPU 0
#define configENABLE_FPU 1
@@ -166,7 +171,7 @@
#elif defined(__ECLIC_INTCTLBITS)
// RISC-V Bumblebee core from nuclei
#define configPRIO_BITS __ECLIC_INTCTLBITS
-#else
+#elif !defined(__ASSEMBLER__) && !defined(__IASMARM__)
#error "FreeRTOS configPRIO_BITS to be defined"
#endif
diff --git a/examples/rules.mk b/examples/rules.mk
index 2c4df85ba..c3b757eec 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -48,8 +48,11 @@ CFLAGS += $(addprefix -I,$(INC))
ifdef USE_IAR
-IAR_CFLAGS += $(CFLAGS) -e --debug
+IAR_CFLAGS += $(CFLAGS) -e --debug --silent
IAR_LDFLAGS += --config $(TOP)/$(IAR_LD_FILE)
+IAR_ASFLAGS += $(CFLAGS) -S
+
+SRC_S += $(IAR_SRC_S)
else
@@ -73,7 +76,9 @@ endif
ASFLAGS += $(CFLAGS)
-endif
+SRC_S += $(GCC_SRC_S)
+
+endif # USE_IAR
# Verbose mode
ifeq ("$(V)","1")
@@ -84,17 +89,11 @@ endif
# Assembly files can be name with upper case .S, convert it to .s
SRC_S := $(SRC_S:.S=.s)
-IAR_SRC_S := $(IAR_SRC_S:.S=.s)
# Due to GCC LTO bug https://bugs.launchpad.net/gcc-arm-embedded/+bug/1747966
# assembly file should be placed first in linking order
# '_asm' suffix is added to object of assembly file
-ifdef USE_IAR
-OBJ += $(addprefix $(BUILD)/obj/, $(IAR_SRC_S:.s=_asm.o))
-else
OBJ += $(addprefix $(BUILD)/obj/, $(SRC_S:.s=_asm.o))
-endif
-
OBJ += $(addprefix $(BUILD)/obj/, $(SRC_C:.c=.o))
# ---------------------------------------
@@ -156,11 +155,11 @@ else
$(BUILD)/$(PROJECT).bin: $(BUILD)/$(PROJECT).elf
@echo CREATE $@
- @$(OBJCOPY) --bin $^ $@
+ @$(OBJCOPY) --silent --bin $^ $@
$(BUILD)/$(PROJECT).hex: $(BUILD)/$(PROJECT).elf
@echo CREATE $@
- @$(OBJCOPY) --ihex $^ $@
+ @$(OBJCOPY) --silent --ihex $^ $@
$(BUILD)/$(PROJECT).elf: $(OBJ)
@echo LINK $@