mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Misc cleanups
This commit is contained in:
67
Makefile
67
Makefile
@@ -1,25 +1,47 @@
|
||||
CC=arm-none-eabi-gcc
|
||||
LD=arm-none-eabi-ld.bfd
|
||||
GDB=arm-none-eabi-gdb
|
||||
OBJCOPY=arm-none-eabi-objcopy
|
||||
CFLAGS = -Ilib -I. -Iinclude -Iexternal/freertos/include -Iexternal -Iexternal/freertos/portable/GCC/ARM_CM4F -Iexternal/newlib/libc/include
|
||||
CFLAGS += -DHAVE_CONFIG_H=1 -DPIXMAN_NO_TLS=1 -Wno-unused-const-variable
|
||||
#CFLAGS += -fshort-double # Use the FPU even for doubles
|
||||
#CFLAGS = -I. -Iexternal/freertos/include -Iexternal -Iexternal/freertos/portable/GCC/ARM_CM4F -Iexternal/newlib/libc/include -Iinclude
|
||||
#-I/Users/romain/local/arm-none-eabi/include
|
||||
CFLAGS += -std=c99 -Wall
|
||||
#CFLAGS += -march=armv7e-m -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16
|
||||
TOOLCHAIN=arm-none-eabi
|
||||
COMPILER=llvm
|
||||
|
||||
ifeq ($(COMPILER),llvm)
|
||||
CC=clang
|
||||
CFLAGS += -target thumbv7em-unknown-eabi -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -ffreestanding
|
||||
|
||||
CXX=clang++
|
||||
CXXFLAGS=-target thumbv7em-unknown-eabi -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -ffreestanding
|
||||
CXXFLAGS += -fno-exceptions -fno-unwind-tables -fno-rtti -nostdlib
|
||||
else
|
||||
CC=$(TOOLCHAIN)-gcc
|
||||
CXX=$(TOOLCHAIN)-g++
|
||||
endif
|
||||
|
||||
# Production
|
||||
CFLAGS += -g
|
||||
#CFLAGS += -Os -fdata-sections -ffunction-sections
|
||||
#LDFLAGS += --gc-sections
|
||||
LD=$(TOOLCHAIN)-ld.bfd
|
||||
GDB=$(TOOLCHAIN)-gdb
|
||||
OBJCOPY=$(TOOLCHAIN)-objcopy
|
||||
|
||||
# Compiler flags
|
||||
# Note: We're using CFLAGS, CXXFLAGS, and SFLAGS. SFLAGS are shared flags for both C and C++
|
||||
|
||||
# Flags - Arch
|
||||
ifeq ($(COMPILER),llvm)
|
||||
SFLAGS += -target thumbv7em-unknown-eabi
|
||||
else
|
||||
SFLAGS += -mthumb -march=armv7e-m -mfloat-abi=softfp
|
||||
endif
|
||||
SFLAGS += -mcpu=cortex-m4 -mfpu=fpv4-sp-d16
|
||||
|
||||
# Flags - Header search path
|
||||
SFLAGS += -Ilib -I. -Iinclude -Iexternal/freertos/include -Iexternal -Iexternal/freertos/portable/GCC/ARM_CM4F -Iexternal/newlib/libc/include
|
||||
|
||||
# Flags - Building options
|
||||
SFLAGS += -Wall -ffreestanding
|
||||
|
||||
# Flags - Optimizations
|
||||
ifeq ($(PRODUCTION),1)
|
||||
#echo "*** PRODUCTION BUILD ***"
|
||||
SFLAGS += -Os -fdata-sections -ffunction-sections
|
||||
LDFLAGS += --gc-sections
|
||||
else
|
||||
SFLAGS += -g
|
||||
endif
|
||||
|
||||
# Language-specific flags
|
||||
CFLAGS = -std=c99
|
||||
CXXFLAGS = -std=c++11 -fno-exceptions -fno-unwind-tables -fno-rtti -nostdlib
|
||||
|
||||
products := boot.elf boot.hex boot.bin
|
||||
|
||||
@@ -28,13 +50,14 @@ objs += external/newlib/libc/string/memset.o external/newlib/libc/string/memcpy.
|
||||
|
||||
objs += lib/assert.o
|
||||
|
||||
objs += math/expression.o
|
||||
objs += src/hello.o
|
||||
|
||||
|
||||
default: clean boot.elf
|
||||
|
||||
include platform/Makefile
|
||||
include kandinsky/Makefile
|
||||
include poincare/Makefile
|
||||
|
||||
run: boot.elf
|
||||
$(GDB) -x gdb_script.gdb boot.elf
|
||||
@@ -59,11 +82,11 @@ boot.elf: $(objs)
|
||||
|
||||
%.o: %.c
|
||||
@echo "CC $@"
|
||||
@$(CC) $(CFLAGS) -c $< -o $@
|
||||
@$(CC) $(CFLAGS) $(SFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.cpp
|
||||
@echo "CXX $@"
|
||||
@$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
@$(CXX) $(CXXFLAGS) $(SFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
@echo "CLEAN"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
CFLAGS += -Ikandinsky/include -Iplatform/stm32f429
|
||||
objs += $(addprefix kandinsky/src/, line.o text.o font.o)
|
||||
SFLAGS += -Ikandinsky/include -Iplatform/stm32f429
|
||||
objs += $(addprefix kandinsky/src/, line.o text.o font.o rect.o)
|
||||
|
||||
FREETYPE_PATH := /usr/local/Cellar/freetype/2.5.5
|
||||
LIBPNG_PATH := /usr/local/Cellar/libpng/1.6.17
|
||||
@@ -10,7 +10,7 @@ font_files = $(addprefix kandinsky/src/, font.h font.c)
|
||||
|
||||
$(font_files): kandinsky/fonts/rasterizer
|
||||
@echo "RASTER $(font_files)"
|
||||
@$< kandinsky/fonts/DroidSansMono.ttf 20 20 $(font_files)
|
||||
@$< kandinsky/fonts/ProggyClean.ttf 16 16 $(font_files)
|
||||
|
||||
kandinsky/fonts/rasterizer: kandinsky/fonts/rasterizer.c
|
||||
@echo "HOSTCC $@"
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#ifndef KANDINSKY_KANDINSKY_H
|
||||
#define KANDINSKY_KANDINSKY_H
|
||||
|
||||
#include <kandinsky/point.h>
|
||||
#include <kandinsky/color.h>
|
||||
#include <kandinsky/line.h>
|
||||
#include <kandinsky/point.h>
|
||||
#include <kandinsky/rect.h>
|
||||
#include <kandinsky/text.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#ifndef KANDINSKY_COLOR_H
|
||||
#define KANDINSKY_COLOR_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint8_t KDColor;
|
||||
#include <framebuffer.h>
|
||||
typedef pixel_t KDColor;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef KANDINSKY_POINT_H
|
||||
#define KANDINSKY_POINT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <kandinsky/coordinate.h>
|
||||
|
||||
typedef struct {
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
KDCoordinate x;
|
||||
KDCoordinate y;
|
||||
} KDPoint;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#include <kandinsky/line.h>
|
||||
#include "framebuffer.h"
|
||||
|
||||
void KDDrawLine(KDPoint p1, KDPoint p2) {
|
||||
for (int i=0; i<10; i++) {
|
||||
PIXEL(i,i) = 0xFF;
|
||||
for (KDCoordinate x = p1.x; x<p2.x; x++) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef STM32F4_FRAMEBUFFER_H
|
||||
#define STM32F4_FRAMEBUFFER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint8_t pixel_t;
|
||||
|
||||
#define FRAMEBUFFER_WIDTH 240
|
||||
@@ -8,6 +10,7 @@ typedef uint8_t pixel_t;
|
||||
#define FRAMEBUFFER_BITS_PER_PIXEL 8
|
||||
#define FRAMEBUFFER_ADDRESS (pixel_t *)(0x2001D400)
|
||||
|
||||
#define PIXEL(x,y) *(pixel_t *)(FRAMEBUFFER_ADDRESS+FRAMEBUFFER_WIDTH*(y)+(x))
|
||||
#define PIXEL_ADDRESS(x,y) (pixel_t *)(FRAMEBUFFER_ADDRESS+FRAMEBUFFER_WIDTH*(y)+(x))
|
||||
#define PIXEL(x,y) *PIXEL_ADDRESS(x,y)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "init_lcd.h"
|
||||
#include <src/hello.h>
|
||||
|
||||
void init() {
|
||||
init_lcd();
|
||||
hello();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user