Add support for FreeRTOS into make system
This commit is contained in:
parent
3348128fe2
commit
211254ed6c
@ -3,43 +3,23 @@
|
||||
|
||||
#include "Drivers/interrupts.h"
|
||||
|
||||
#include "gfx.h"
|
||||
extern int main(void);
|
||||
|
||||
static void displayTask(void *pvParameters) {
|
||||
coord_t width, height;
|
||||
// Get the screen size
|
||||
width = gdispGetWidth();
|
||||
height = gdispGetHeight();
|
||||
|
||||
// Code Here
|
||||
gdispDrawBox(10, 10, width/2, height/2, Yellow);
|
||||
gdispFillArea(width/2, height/2, width/2-10, height/2-10, Blue);
|
||||
gdispDrawLine(5, 30, width-50, height-40, Red);
|
||||
|
||||
while(1)
|
||||
{
|
||||
vTaskDelay(1000);
|
||||
}
|
||||
|
||||
return;
|
||||
static void mainTask(void *pvParameters) {
|
||||
(void) pvParameters;
|
||||
main();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the systems main entry, some call it a boot thread.
|
||||
*
|
||||
* -- Absolutely nothing wrong with this being called main(), just it doesn't have
|
||||
* -- the same prototype as you'd see in a linux program.
|
||||
**/
|
||||
int main(void) {
|
||||
int FreeRTOS_Main(void) {
|
||||
|
||||
DisableInterrupts();
|
||||
InitInterruptController();
|
||||
|
||||
// Initialize and clear the display
|
||||
gfxInit();
|
||||
|
||||
xTaskCreate(displayTask,
|
||||
(portCHAR *)"Display Task",
|
||||
xTaskCreate(mainTask,
|
||||
(portCHAR *)"Main Task",
|
||||
128,
|
||||
NULL,
|
||||
0,
|
@ -4,7 +4,7 @@
|
||||
.extern vFreeRTOS_ISR
|
||||
.extern vPortYieldProcessor
|
||||
.extern DisableInterrupts
|
||||
.extern main
|
||||
.extern FreeRTOS_Main
|
||||
.section .init
|
||||
.globl _start
|
||||
;;
|
||||
@ -79,7 +79,7 @@ zero_loop:
|
||||
|
||||
|
||||
;@ mov sp,#0x1000000
|
||||
b main ;@ We're ready?? Lets start main execution!
|
||||
b FreeRTOS_Main ;@ We're ready?? Lets start main execution!
|
||||
.section .text
|
||||
|
||||
undefined_instruction:
|
@ -1,73 +1,55 @@
|
||||
# build environment
|
||||
PREFIX ?= /your compiler path/gcc-arm-none-eabi-4_8-2014q1
|
||||
ARCH ?= $(PREFIX)/bin/arm-none-eabi
|
||||
# Possible Targets: all clean Debug cleanDebug Release cleanRelease
|
||||
|
||||
CC = ${ARCH}-gcc
|
||||
CPP = ${ARCH}-g++
|
||||
AS = ${ARCH}-as
|
||||
LD = ${ARCH}-ld
|
||||
AR = ${ARCH}-ar
|
||||
OBJCOPY = ${ARCH}-objcopy
|
||||
##############################################################################################
|
||||
# Settings
|
||||
#
|
||||
|
||||
PLATFORM = raspi
|
||||
LINKER_SCRIPT = raspberrypi.ld
|
||||
# General settings
|
||||
# See $(GFXLIB)/tools/gmake_scripts/readme.txt for the list of variables
|
||||
OPT_OS = freertos
|
||||
OPT_THUMB = yes
|
||||
OPT_LINK_OPTIMIZE = yes
|
||||
# For the raspberry pi we can either use the generic armv6 cpu or the highly optimized raspberrypi settings
|
||||
OPT_CPU = raspberrypi
|
||||
|
||||
CFLAGS = -march=armv6z -g -Wall -Wextra
|
||||
ASFLAGS = -g
|
||||
# uGFX settings
|
||||
# See $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk for the list of variables
|
||||
GFXLIB = ../uGFX
|
||||
GFXBOARD = RaspberryPi
|
||||
GFXDEMO = modules/gdisp/basics
|
||||
|
||||
CFLAGS_FOR_TARGET = #-mcpu=arm1176jzf-s
|
||||
ASFLAGS_FOR_TARGET = #-mcpu=arm1176jzf-s
|
||||
LDFLAGS = #--error-unresolved-symbols
|
||||
# FreeRTOS settings
|
||||
ifeq ($(OPT_OS),freertos)
|
||||
# See $(GFXLIB)/tools/gmake_scripts/os_freertos.mk for the list of variables
|
||||
FREERTOS = ../FreeRTOS
|
||||
FREERTOS_BOARD = RaspberryPi
|
||||
FREERTOS_MODULES = $(GFXLIB)/boards/base/RaspberryPi/FreeRTOS
|
||||
FREERTOS_LDSCRIPT = $(GFXLIB)/boards/base/RaspberryPi/FreeRTOS/raspberrypi.ld
|
||||
endif
|
||||
|
||||
GFXLIB := ../uGFX
|
||||
include $(GFXLIB)/gfx.mk
|
||||
include $(GFXLIB)/drivers/gdisp/framebuffer/driver.mk
|
||||
##############################################################################################
|
||||
# Set these for your project
|
||||
#
|
||||
|
||||
OSLIB := ../FreeRTOS
|
||||
MODULES := $(OSLIB)/Source/portable/GCC/RaspberryPi
|
||||
MODULES += $(OSLIB)/Source/portable/MemMang
|
||||
MODULES += $(OSLIB)/Source
|
||||
MODULES += Drivers
|
||||
|
||||
SRC_DIR := $(MODULES)
|
||||
INC_DIR := $(addsuffix /include,$(SRC_DIR))
|
||||
BUILD_DIR := $(addsuffix /build,$(SRC_DIR))
|
||||
|
||||
INCLUDEDIRS := $(OSLIB)/Source/portable/GCC/RaspberryPi
|
||||
INCLUDEDIRS += $(OSLIB)/Source/include
|
||||
INCLUDEDIRS += Drivers
|
||||
INCLUDEDIRS += $(GFXINC)
|
||||
|
||||
INCLUDES := $(addprefix -I,$(INCLUDEDIRS))
|
||||
|
||||
ASRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.s))
|
||||
AOBJ := $(ASRC:.s=.o)
|
||||
CSRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.c))
|
||||
CSRC += $(GFXSRC)
|
||||
COBJ := $(CSRC:.c=.o)
|
||||
|
||||
vpath %.c $(SRC_DIR)
|
||||
vpath %.cpp $(SRC_DIR)
|
||||
vpath %.s $(SRC_DIR)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c -o $*.o $<
|
||||
|
||||
%.o: %.s
|
||||
$(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $<
|
||||
|
||||
OBJ = $(AOBJ) $(COBJ)
|
||||
|
||||
bin/kernel.img: bin/kernel.elf
|
||||
${OBJCOPY} -O binary $< $@
|
||||
|
||||
bin/kernel.elf: LDFLAGS += -L "$(PREFIX)/lib/gcc/arm-none-eabi/4.8.3" -lgcc
|
||||
bin/kernel.elf: LDFLAGS += -L "$(PREFIX)/arm-none-eabi/lib" -lc
|
||||
bin/kernel.elf: $(OBJ)
|
||||
${LD} $(OBJ) -Map bin/kernel.map -o $@ -T $(LINKER_SCRIPT) ${LDFLAGS}
|
||||
|
||||
clean:
|
||||
rm -f bin/*.elf bin/*.img bin/*.map $(OBJ)
|
||||
ARCH = arm-none-eabi-
|
||||
SRCFLAGS = -ggdb -O0
|
||||
CFLAGS =
|
||||
CXXFLAGS = -fno-rtti
|
||||
ASFLAGS =
|
||||
LDFLAGS =
|
||||
|
||||
SRC =
|
||||
OBJS =
|
||||
DEFS =
|
||||
LIBS =
|
||||
INCPATH =
|
||||
LIBPATH =
|
||||
|
||||
##############################################################################################
|
||||
# These should be at the end
|
||||
#
|
||||
|
||||
include $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk
|
||||
include $(GFXLIB)/tools/gmake_scripts/os_$(OPT_OS).mk
|
||||
include $(GFXLIB)/tools/gmake_scripts/compiler_gcc.mk
|
||||
# *** EOF ***
|
||||
|
18
tools/gmake_scripts/cpu_armv6.mk
Normal file
18
tools/gmake_scripts/cpu_armv6.mk
Normal file
@ -0,0 +1,18 @@
|
||||
#
|
||||
# This file is subject to the terms of the GFX License. If a copy of
|
||||
# the license was not distributed with this file, you can obtain one at:
|
||||
#
|
||||
# http://ugfx.org/license.html
|
||||
#
|
||||
|
||||
#
|
||||
# See readme.txt for the make API
|
||||
#
|
||||
|
||||
# Requirements:
|
||||
#
|
||||
# NONE
|
||||
#
|
||||
|
||||
SRCFLAGS += -march=armv6 -mfpu=vfp -mfloat-abi=hard
|
||||
LDFLAGS += -march=armv6 -mfpu=vfp -mfloat-abi=hard
|
18
tools/gmake_scripts/cpu_raspberrypi.mk
Normal file
18
tools/gmake_scripts/cpu_raspberrypi.mk
Normal file
@ -0,0 +1,18 @@
|
||||
#
|
||||
# This file is subject to the terms of the GFX License. If a copy of
|
||||
# the license was not distributed with this file, you can obtain one at:
|
||||
#
|
||||
# http://ugfx.org/license.html
|
||||
#
|
||||
|
||||
#
|
||||
# See readme.txt for the make API
|
||||
#
|
||||
|
||||
# Requirements:
|
||||
#
|
||||
# NONE
|
||||
#
|
||||
|
||||
SRCFLAGS += -march=armv6zk -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard
|
||||
LDFLAGS += -march=armv6zk -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard
|
36
tools/gmake_scripts/os_freertos.mk
Normal file
36
tools/gmake_scripts/os_freertos.mk
Normal file
@ -0,0 +1,36 @@
|
||||
#
|
||||
# This file is subject to the terms of the GFX License. If a copy of
|
||||
# the license was not distributed with this file, you can obtain one at:
|
||||
#
|
||||
# http://ugfx.org/license.html
|
||||
#
|
||||
|
||||
# See readme.txt for the make API
|
||||
|
||||
# Requirements:
|
||||
#
|
||||
# FREERTOS: The location of the FreeRTOS code eg FREERTOS=../FreeRTOS
|
||||
# FREERTOS_BOARD The board name eg FREERTOS_BOARD=RaspberryPi
|
||||
#
|
||||
|
||||
# Optional:
|
||||
#
|
||||
# FREERTOS_MODULES A list of directories containing FreeRTOS source (eg drivers, startup etc) - default is ""
|
||||
# FREERTOS_LDSCRIPT The loader script - default is ""
|
||||
#
|
||||
|
||||
PATHLIST += FREERTOS
|
||||
|
||||
FREERTOS_MODULES += $(FREERTOS)/Source/portable/GCC/$(FREERTOS_BOARD)
|
||||
FREERTOS_MODULES += $(FREERTOS)/Source/portable/MemMang
|
||||
FREERTOS_MODULES += $(FREERTOS)/Source
|
||||
|
||||
INCPATH += $(FREERTOS)/Source/portable/GCC/$(FREERTOS_BOARD) \
|
||||
$(FREERTOS)/Source/include
|
||||
|
||||
SRC += $(foreach sdir,$(FREERTOS_MODULES),$(wildcard $(sdir)/*.s))
|
||||
SRC += $(foreach sdir,$(FREERTOS_MODULES),$(wildcard $(sdir)/*.c))
|
||||
|
||||
ifeq ($(LDSCRIPT),)
|
||||
LDSCRIPT= $(FREERTOS_LDSCRIPT)
|
||||
endif
|
@ -16,7 +16,7 @@ OPT_COPY_EXE=no|yes - Copy the final program to the local project directory -
|
||||
OPT_NONSTANDARD_FLAGS=no - Turn off adding the standard compiler language flags - default no
|
||||
OPT_LINK_OPTIMIZE=no - Remove unused code/data during link - default no
|
||||
OPT_OS=win32|win32.chibios|linux|osx|chibios|freertos|ecos|raw32|rawrtos - Mandatory: The operating system
|
||||
OPT_CPU=x86|x64|stm32m4|at91sam7 - Add some cpu dependant flags
|
||||
OPT_CPU=x86|x64|stm32m4|at91sam7|armv6|raspberrypi - Add some cpu dependant flags
|
||||
|
||||
BUILDDIR - Build Directory - default is ".build" or "bin/Debug" or "bin/Release" depending on the target
|
||||
PROJECT - Project Name - default is the name of the project directory
|
||||
|
Loading…
Reference in New Issue
Block a user