Difference between revisions of "Using ChibiOS/RT"
From uGFX Wiki
| (3 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
It is fairly easy to include µGFX into your ChibiOS/RT project as ChibiOS/RT uses Makefiles internally as well. | It is fairly easy to include µGFX into your ChibiOS/RT project as ChibiOS/RT uses Makefiles internally as well. | ||
The ChibiOS/RT Makefile has to be modified as the following: | The ChibiOS/RT Makefile has to be modified as the following: | ||
| − | |||
# Include the µGFX top-level Makefile | # Include the µGFX top-level Makefile | ||
# Include the driver or board Makefiles that match your hardware | # Include the driver or board Makefiles that match your hardware | ||
# Add '''GFXSRC''' to the '''CSRC''' variable | # Add '''GFXSRC''' to the '''CSRC''' variable | ||
| − | # Add '''GFXINC''' to the '''INCDIR | + | # Add '''GFXINC''' to the '''INCDIR''' variable |
| − | + | ||
== Example == | == Example == | ||
Latest revision as of 17:56, 8 December 2015
If you're using the ChibiStudio IDE, please follow this guide: Using ChibiStudio.
It is fairly easy to include µGFX into your ChibiOS/RT project as ChibiOS/RT uses Makefiles internally as well. The ChibiOS/RT Makefile has to be modified as the following:
- Include the µGFX top-level Makefile
- Include the driver or board Makefiles that match your hardware
- Add GFXSRC to the CSRC variable
- Add GFXINC to the INCDIR variable
Example
The following Makefile is just an example showing how an existing Makefile has to be modified following the steps above. Please DO NOT copy the entire Makfile. The relevant parts have been highlighted.
############################################################################### Build global options# NOTE: Can be overridden externally.## Compiler options here.ifeq ($(USE_OPT),)
USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16
endif# C specific options here (added to USE_OPT).ifeq ($(USE_COPT),)
USE_COPT =endif# C++ specific options here (added to USE_OPT).ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -fno-rtti
endif# Enable this if you want the linker to remove unused code and dataifeq ($(USE_LINK_GC),)
USE_LINK_GC = yesendif# Linker extra options here.ifeq ($(USE_LDOPT),)
USE_LDOPT =endif# Enable this if you want link time optimizations (LTO)ifeq ($(USE_LTO),)
USE_LTO = noendif# If enabled, this option allows to compile the application in THUMB mode.ifeq ($(USE_THUMB),)
USE_THUMB = yesendif# Enable this if you want to see the full log while compiling.ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = noendif## Build global options############################################################################################################################################################# Architecture or project specific options## Enables the use of FPU on Cortex-M4 (no, softfp, hard).ifeq ($(USE_FPU),)
USE_FPU = noendif## Architecture or project specific options############################################################################################################################################################# Project, sources and paths## Define project name herePROJECT = ugfx# Imported source files and pathsCHIBIOS = /path/to/your/chibios
GFXLIB = /path/to/your/ugfx
include $(CHIBIOS)/os/hal/platforms/STM32F4xx/platform.mk
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F4xx/port.mk
include $(CHIBIOS)/os/kernel/kernel.mk
include $(CHIBIOS)/test/test.mk
include $(GFXLIB)/gfx.mk
include $(GFXLIB)/boards/base/Embest-STM32-DMSTF4BB/board.mk # board
include $(GFXLIB)/drivers/gaudio/vs1053/driver.mk # additional driver
# Define linker script file hereLDSCRIPT= $(PORTLD)/STM32F407xG.ld
#LDSCRIPT= $(PORTLD)/STM32F407xG_CCM.ld# C sources that can be compiled in ARM or THUMB mode depending on the global# setting.CSRC = $(PORTSRC) \
$(KERNSRC) \
$(TESTSRC) \
$(HALSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
$(CHIBIOS)/os/various/evtimer.c \
$(CHIBIOS)/os/various/chprintf.c \
$(CHIBIOS)/os/various/shell.c \
$(CHIBIOS)/os/various/syscalls.c \
$(GFXSRC) \
main.c# C++ sources that can be compiled in ARM or THUMB mode depending on the global# setting.CPPSRC =# C sources to be compiled in ARM mode regardless of the global setting.# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler# option that results in lower performance and larger code size.ACSRC =# C++ sources to be compiled in ARM mode regardless of the global setting.# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler# option that results in lower performance and larger code size.ACPPSRC =# C sources to be compiled in THUMB mode regardless of the global setting.# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler# option that results in lower performance and larger code size.TCSRC =# C sources to be compiled in THUMB mode regardless of the global setting.# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler# option that results in lower performance and larger code size.TCPPSRC =# List ASM source files hereASMSRC = $(PORTASM)
INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
$(HALINC) $(PLATFORMINC) $(BOARDINC) \
$(CHIBIOS)/os/various \
$(GFXINC) \
include## Project, sources and paths############################################################################################################################################################# Compiler settings#MCU = cortex-m4
#TRGT = arm-elf-TRGT = arm-none-eabi-
CC = $(TRGT)gcc
CPPC = $(TRGT)g++
# Enable loading with g++ only if you need C++ runtime support.# NOTE: You can use C++ even without C++ support if you are careful. C++# runtime support makes code size explode.LD = $(TRGT)gcc
#LD = $(TRGT)g++CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
OD = $(TRGT)objdump
SZ = $(TRGT)size
HEX = $(CP) -O ihex
BIN = $(CP) -O binary
# ARM-specific options hereAOPT =# THUMB-specific options hereTOPT = -mthumb -DTHUMB
# Define C warning options hereCWARN = -Wall -Wextra -Wstrict-prototypes
# Define C++ warning options hereCPPWARN = -Wall -Wextra
## Compiler settings############################################################################################################################################################# Start of default section## List all default C defines here, like -D_DEBUG=1DDEFS =# List all default ASM defines here, like -D_DEBUG=1DADEFS =# List all default directories to look for include files hereDINCDIR =# List the default directory to look for the libraries hereDLIBDIR =# List all default libraries hereDLIBS =## End of default section############################################################################################################################################################# Start of user section## List all user C define here, like -D_DEBUG=1UDEFS =# Define ASM defines hereUADEFS =# List all user directories hereUINCDIR =# List the user directory to look for the libraries hereULIBDIR =# List all user libraries hereULIBS =## End of user defines##############################################################################RULESPATH = $(CHIBIOS)/os/ports/GCC/ARMCMx
include $(RULESPATH)/rules.mk