mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-04-21 18:46:07 +02:00
c6c3d4a045
No project uses floating-point, so coprocessor_enable() was dead code. Removes rp2350_coprocessor.c/.h and all references from reset handlers and Makefiles across all 15 CBM drivers (0x01-0x0f).
79 lines
2.0 KiB
Makefile
79 lines
2.0 KiB
Makefile
# ------------------------------------------------------------------------------
|
|
# @file Makefile
|
|
# @author Kevin Thomas
|
|
# @brief Build script for RP2350 bare-metal C timer alarm driver.
|
|
#
|
|
# Compiles, links, and generates UF2 firmware for the RP2350.
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Toolchain
|
|
CC = arm-none-eabi-gcc
|
|
OBJCOPY = arm-none-eabi-objcopy
|
|
SIZE = arm-none-eabi-size
|
|
|
|
# Target
|
|
TARGET = timer
|
|
|
|
# Directories
|
|
SRC_DIR = Src
|
|
INC_DIR = Inc
|
|
BUILD_DIR = build
|
|
|
|
# CPU flags
|
|
CPU_FLAGS = -mcpu=cortex-m33 -mthumb
|
|
|
|
# Compiler flags
|
|
CFLAGS = $(CPU_FLAGS) -Og -g3 -Wall -Wextra \
|
|
-ffunction-sections -fdata-sections \
|
|
-I$(INC_DIR)
|
|
|
|
# Linker flags
|
|
LDFLAGS = $(CPU_FLAGS) -T linker.ld -nostdlib -Wl,--gc-sections
|
|
|
|
# Source files
|
|
SRCS = $(SRC_DIR)/vector_table.c \
|
|
$(SRC_DIR)/rp2350_reset_handler.c \
|
|
$(SRC_DIR)/rp2350_stack.c \
|
|
$(SRC_DIR)/rp2350_xosc.c \
|
|
$(SRC_DIR)/rp2350_reset.c \
|
|
$(SRC_DIR)/rp2350_uart.c \
|
|
$(SRC_DIR)/rp2350_delay.c \
|
|
$(SRC_DIR)/rp2350_timer.c \
|
|
$(SRC_DIR)/main.c \
|
|
$(SRC_DIR)/image_def.c
|
|
|
|
# Object files
|
|
OBJS = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SRCS))
|
|
|
|
# Rules
|
|
.PHONY: all clean flash
|
|
|
|
all: $(BUILD_DIR)/$(TARGET).uf2
|
|
@echo "==================================="
|
|
@echo "SUCCESS! Created $(TARGET).bin and $(TARGET).uf2"
|
|
@echo "==================================="
|
|
|
|
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c | $(BUILD_DIR)
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
$(BUILD_DIR)/$(TARGET).elf: $(OBJS)
|
|
$(CC) $(LDFLAGS) $(OBJS) -o $@
|
|
$(SIZE) $@
|
|
|
|
$(BUILD_DIR)/$(TARGET).bin: $(BUILD_DIR)/$(TARGET).elf
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
$(BUILD_DIR)/$(TARGET).uf2: $(BUILD_DIR)/$(TARGET).bin
|
|
python3 uf2conv.py -b 0x10000000 -f 0xe48bff59 -o $@ $<
|
|
|
|
$(BUILD_DIR):
|
|
mkdir -p $(BUILD_DIR)
|
|
|
|
clean:
|
|
rm -rf $(BUILD_DIR)
|
|
|
|
flash: $(BUILD_DIR)/$(TARGET).elf
|
|
openocd -f interface/cmsis-dap.cfg -f target/rp2350.cfg \
|
|
-c "adapter speed 5000" \
|
|
-c "program $< verify reset exit"
|