2019-08-22 01:21:48 +01:00
|
|
|
include ../../py/mkenv.mk
|
|
|
|
|
|
|
|
# qstr definitions (must come before including py.mk)
|
|
|
|
QSTR_DEFS = qstrdefsport.h
|
|
|
|
|
|
|
|
# include py core make definitions
|
|
|
|
include $(TOP)/py/py.mk
|
2022-06-17 17:11:30 +01:00
|
|
|
include $(TOP)/extmod/extmod.mk
|
2019-08-22 01:21:48 +01:00
|
|
|
|
2020-05-26 04:29:55 +01:00
|
|
|
# potato or lpc_serial
|
|
|
|
UART ?= potato
|
|
|
|
|
2019-08-22 01:21:48 +01:00
|
|
|
ARCH = $(shell uname -m)
|
|
|
|
ifneq ("$(ARCH)", "ppc64")
|
|
|
|
ifneq ("$(ARCH)", "ppc64le")
|
2020-05-26 04:37:09 +01:00
|
|
|
CROSS_COMPILE ?= powerpc64le-linux-gnu-
|
2019-08-22 01:21:48 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
INC += -I.
|
|
|
|
INC += -I$(TOP)
|
|
|
|
INC += -I$(BUILD)
|
|
|
|
|
2020-04-09 12:59:11 +01:00
|
|
|
CFLAGS = $(INC) -g -Wall -Wdouble-promotion -Wfloat-conversion -std=c99 $(COPT)
|
2019-08-22 01:21:48 +01:00
|
|
|
CFLAGS += -mno-string -mno-multiple -mno-vsx -mno-altivec -nostdlib
|
|
|
|
CFLAGS += -mlittle-endian -mstrict-align -msoft-float
|
|
|
|
CFLAGS += -Os
|
|
|
|
CFLAGS += -fdata-sections -ffunction-sections -fno-stack-protector -ffreestanding
|
|
|
|
CFLAGS += -U_FORTIFY_SOURCE
|
|
|
|
|
|
|
|
LDFLAGS = -N -T powerpc.lds -nostdlib
|
|
|
|
|
|
|
|
LIBS =
|
|
|
|
|
|
|
|
SRC_C = \
|
|
|
|
main.c \
|
2020-05-26 04:29:55 +01:00
|
|
|
uart_$(UART).c \
|
2021-07-09 05:19:15 +01:00
|
|
|
shared/libc/printf.c \
|
|
|
|
shared/libc/string0.c \
|
|
|
|
shared/readline/readline.c \
|
|
|
|
shared/runtime/pyexec.c \
|
|
|
|
shared/runtime/stdout_helpers.c \
|
2019-08-22 01:21:48 +01:00
|
|
|
$(BUILD)/_frozen_mpy.c \
|
|
|
|
|
2022-07-02 21:05:41 +01:00
|
|
|
SRC_QSTR += shared/readline/readline.c shared/runtime/pyexec.c
|
2022-07-01 20:06:10 +01:00
|
|
|
|
2019-08-22 01:21:48 +01:00
|
|
|
OBJ = $(PY_CORE_O)
|
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
|
|
|
OBJ += $(BUILD)/head.o
|
|
|
|
|
|
|
|
all: $(BUILD)/firmware.elf $(BUILD)/firmware.map $(BUILD)/firmware.bin
|
|
|
|
|
|
|
|
$(BUILD)/_frozen_mpy.c: frozentest.mpy $(BUILD)/genhdr/qstrdefs.generated.h
|
|
|
|
$(ECHO) "MISC freezing bytecode"
|
|
|
|
$(Q)$(MPY_TOOL) -f -q $(BUILD)/genhdr/qstrdefs.preprocessed.h -mlongint-impl=mpz $< > $@
|
|
|
|
|
|
|
|
$(BUILD)/firmware.elf: $(OBJ) powerpc.lds
|
|
|
|
$(ECHO) "LINK $@"
|
2020-05-26 04:38:35 +01:00
|
|
|
$(Q)$(LD) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
|
2019-08-22 01:21:48 +01:00
|
|
|
$(Q)$(SIZE) $@
|
|
|
|
|
|
|
|
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf
|
|
|
|
$(Q)$(OBJCOPY) -O binary $^ $(BUILD)/firmware.bin
|
|
|
|
|
|
|
|
$(BUILD)/firmware.map: $(BUILD)/firmware.elf
|
|
|
|
$(Q)nm $^ | sort > $(BUILD)/firmware.map
|
|
|
|
|
|
|
|
include $(TOP)/py/mkrules.mk
|